randydev commited on
Commit
3407845
·
verified ·
1 Parent(s): 791a52a

Update Akeno/utils/base_sqlite.py

Browse files
Files changed (1) hide show
  1. Akeno/utils/base_sqlite.py +6 -5
Akeno/utils/base_sqlite.py CHANGED
@@ -28,9 +28,10 @@ async def get_prefix(user_id: int):
28
  return result
29
 
30
  def fetch_prefix_from_db(user_id: int):
31
- cursor = conn.cursor()
32
- cursor.execute('SELECT prefix FROM prefixes WHERE user_id=?', (user_id,))
33
- result = cursor.fetchone()
34
- return result[0] if result else None
35
 
36
- conn.close()
 
 
28
  return result
29
 
30
  def fetch_prefix_from_db(user_id: int):
31
+ with conn.cursor() as cursor:
32
+ cursor.execute('SELECT prefix FROM prefixes WHERE user_id=?', (user_id,))
33
+ result = cursor.fetchone()
34
+ return result[0] if result else None
35
 
36
+ async def close_connection():
37
+ conn.close()