редизайн, кнопки назад

This commit is contained in:
Vlad
2024-09-20 03:48:41 +03:00
parent a6d2203e78
commit f8015ced70
11 changed files with 446 additions and 246 deletions
+7 -1
View File
@@ -89,4 +89,10 @@ async def update_balance(tg_id: int, amount: float):
SET balance = balance + ?
WHERE tg_id = ?
''', (amount, tg_id))
await db.commit()
await db.commit()
async def get_key_count(tg_id: int) -> int:
async with aiosqlite.connect(DATABASE_PATH) as db:
async with db.execute('SELECT COUNT(*) FROM keys k JOIN connections c ON k.client_id = c.client_id WHERE c.tg_id = ?', (tg_id,)) as cursor:
count = await cursor.fetchone()
return count[0] if count else 0