From 1205931800c200e7952d24e861b2dae3596329e5 Mon Sep 17 00:00:00 2001 From: Noah Hailegiorgis Date: Thu, 30 Nov 2023 07:02:06 -0800 Subject: [PATCH] Attempt to fix #1 --- main.py | 7 ++++--- 1 file changed, 4 insertions(+), 3 deletions(-) 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"),