diff --git a/main.py b/main.py index 1454d7b..80eceb8 100644 --- a/main.py +++ b/main.py @@ -137,7 +137,7 @@ async def handle_webhook(update: TelegramUpdate, token: str = Depends(auth_teleg elif callback_data == "SUB": cursor.execute("""SELECT chat_id, link FROM users - WHERE shared_status == %s AND chat_id != %s + WHERE shared_status = %s AND chat_id != %s ORDER BY CASE WHEN shares < 0 THEN 2 @@ -184,7 +184,7 @@ async def handle_webhook(update: TelegramUpdate, token: str = Depends(auth_teleg cursor.execute("""SELECT chat_id, link FROM users - WHERE shared_status == %s AND chat_id != %s + WHERE shared_status = %s AND chat_id != %s ORDER BY CASE WHEN shares < 0 THEN 2 @@ -214,11 +214,12 @@ async def handle_webhook(update: TelegramUpdate, token: str = Depends(auth_teleg chat_id_store = result[0] link = result[1] cursor.execute("""UPDATE users SET shared_status=%s where chat_id=%s""", (True, chat_id_store,)) - + conn.commit() cursor.execute("""SELECT viewing FROM users WHERE chat_id=%s""", (chat_id,)) result = cursor.fetchone() cursor.execute("""UPDATE users SET shared_status = %s where chat_id = %s""", (False, result[0],)) + conn.commit() cursor.execute("""UPDATE users SET viewing=%s where chat_id=%s""", (chat_id_store, chat_id)) conn.commit() keyboard = [[InlineKeyboardButton("Subscribed 🫡", callback_data="SUBBED"),