diff --git a/sweebot.py b/sweebot.py index 1edaf91..07c4c87 100644 --- a/sweebot.py +++ b/sweebot.py @@ -38,7 +38,7 @@ class config: self.database.execute("INSERT INTO chans (chan, flags) values(?, '+config');", [chan]) flag = self.chansettings(chan) + flags self.database.execute("UPDATE chans SET FLAGS = ? WHERE chan = ?", [",".join(flag),chan]) - + self.conn.commit() except: print(traceback.format_exc()) return False @@ -489,9 +489,22 @@ while True: elif command[0] == "$config": try: - if len(command) > 2: + if len(command) > 1: if perms == "full": - pass + flag = sbconfig.chansettings(channel) + for i in command[2:]: + if i == "clear": + flag = ["+config"] + if i[0] == "+": + if "-" + i[1:] in flag: + flag[flag.index("-" + i[1:])] = i + elif i[0] == "-": + if "+" + i[1:] in flag: + flag[flag.index("+" + i[1:])] = i + else: + multiline(nick + ": flag name should begin with + or -") + break + sbconfig.setchanconfig(channel, flag) else: irc.send_irc(channel, nick + ": Permission denied") block+=1