fix config command
This commit is contained in:
parent
7ac1542bae
commit
4922497637
1 changed files with 16 additions and 3 deletions
19
sweebot.py
19
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
|
||||
|
|
Loading…
Reference in a new issue