Update sweebot.py

This commit is contained in:
Swee 2024-10-12 14:28:11 -07:00
parent d387efe3b3
commit 7ac1542bae

View file

@ -16,7 +16,7 @@ class config:
self.database = self.conn.cursor() self.database = self.conn.cursor()
def perms(self, cloak: str): def perms(self, cloak: str):
try: try:
self.database.execute(f"SELECT * FROM users WHERE username = ?;", (cloak)) self.database.execute(f"SELECT * FROM users WHERE username = ?;", [cloak])
output = self.database.fetchall() output = self.database.fetchall()
return output[0][1] return output[0][1]
except: except:
@ -24,7 +24,7 @@ class config:
return '' return ''
def chansettings(self, chan: str): def chansettings(self, chan: str):
try: try:
self.database.execute("SELECT * FROM chans WHERE chan = ?;", (chan)) self.database.execute("SELECT * FROM chans WHERE chan = ?;", [chan])
output = self.database.fetchall() output = self.database.fetchall()
temp = output[0][1].split(",") temp = output[0][1].split(",")
return temp if temp != [''] else [] return temp if temp != [''] else []
@ -35,9 +35,9 @@ class config:
try: try:
if self.chansettings(chan) == []: if self.chansettings(chan) == []:
print("[!!!] Channel doesn't exist in config") print("[!!!] Channel doesn't exist in config")
self.database.execute("INSERT INTO chans (chan, flags) values(?, '+config');", (chan)) self.database.execute("INSERT INTO chans (chan, flags) values(?, '+config');", [chan])
flag = self.chansettings(chan) + flags flag = self.chansettings(chan) + flags
self.database.execute("UPDATE chans SET FLAGS = ? WHERE chan = ?", (",".join(flag),chan)) self.database.execute("UPDATE chans SET FLAGS = ? WHERE chan = ?", [",".join(flag),chan])
except: except:
print(traceback.format_exc()) print(traceback.format_exc())