Skip to content

Commit

Permalink
Attempt to fix cyclic-software#1
Browse files Browse the repository at this point in the history
  • Loading branch information
NoahHaile committed Nov 30, 2023
1 parent b49429e commit 1205931
Showing 1 changed file with 4 additions and 3 deletions.
7 changes: 4 additions & 3 deletions main.py
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down Expand Up @@ -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
Expand Down Expand Up @@ -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"),
Expand Down

0 comments on commit 1205931

Please sign in to comment.