code cleanup

This commit is contained in:
bacon
2024-03-08 19:56:50 +03:00
parent ccafd97359
commit d9cfc1884c
4 changed files with 4 additions and 14 deletions

View File

@@ -86,10 +86,9 @@ async def prepare_db(guild: int):
try:
connect = sqlite3.connect('user.db')
cursor = connect.cursor()
cursor.execute('''CREATE TABLE IF NOT EXISTS "(guild)"
cursor.execute(f'''CREATE TABLE IF NOT EXISTS "{guild}"
([userid] INTEGER PRIMARY KEY, [username] TEXT,
[nick] TEXT, [isbot] BOOL, [defaulttracks] TEXT, [usertracks] TEXT)''',
{'guild': guild})
[nick] TEXT, [isbot] BOOL, [defaulttracks] TEXT, [usertracks] TEXT)''')
cursor.close()
except sqlite3.Error as _error:
logger.info(_error)
@@ -129,8 +128,7 @@ async def read_db(guild: int, user: int, column: str):
try:
sql_con = sqlite3.connect("user.db")
cursor = sql_con.cursor()
cursor.execute("""SELECT * FROM "%(guild)" where userid = %(user)""",
{'guild': guild, 'user': user})
cursor.execute(f"""SELECT * FROM "{guild}" where userid = {user}""")
record = cursor.fetchone()
return record[_col_dict[column]]
except sqlite3.Error as _error:

View File

@@ -3,9 +3,3 @@ lib
~~~~~~~~~~~~~
Some libs for the bot which help him
"""
# from .ListGenerator import *
# from .Logger import *
# from .Comands import *
# from .Player import *
# from .DB_Worker import *
# from .CogsPrep import *