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

@@ -18,7 +18,6 @@ class Audio(commands.Cog, name='Audio'):
async def on_ready(self):
logger.info(f'Cog {__name__.split(".")[1]} is ready!.')
# todo: complete check activity
@commands.Cog.listener()
async def on_voice_state_update(self, member: Member,
before: VoiceState,

View File

@@ -1,9 +1,8 @@
import os
import disnake
import psutil
from disnake.ext import commands
from disnake.ext import commands
from __init__ import version_info as ver
from lib.Comands import determine_prefix
from lib.Logger import logger

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 *