Skip to content

Commit 1205931

Browse files
committed
Attempt to fix cyclic-software#1
1 parent b49429e commit 1205931

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

main.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -137,7 +137,7 @@ async def handle_webhook(update: TelegramUpdate, token: str = Depends(auth_teleg
137137
elif callback_data == "SUB":
138138
cursor.execute("""SELECT chat_id, link
139139
FROM users
140-
WHERE shared_status == %s AND chat_id != %s
140+
WHERE shared_status = %s AND chat_id != %s
141141
ORDER BY
142142
CASE
143143
WHEN shares < 0 THEN 2
@@ -184,7 +184,7 @@ async def handle_webhook(update: TelegramUpdate, token: str = Depends(auth_teleg
184184

185185
cursor.execute("""SELECT chat_id, link
186186
FROM users
187-
WHERE shared_status == %s AND chat_id != %s
187+
WHERE shared_status = %s AND chat_id != %s
188188
ORDER BY
189189
CASE
190190
WHEN shares < 0 THEN 2
@@ -214,11 +214,12 @@ async def handle_webhook(update: TelegramUpdate, token: str = Depends(auth_teleg
214214
chat_id_store = result[0]
215215
link = result[1]
216216
cursor.execute("""UPDATE users SET shared_status=%s where chat_id=%s""", (True, chat_id_store,))
217-
217+
conn.commit()
218218
cursor.execute("""SELECT viewing FROM users WHERE chat_id=%s""", (chat_id,))
219219

220220
result = cursor.fetchone()
221221
cursor.execute("""UPDATE users SET shared_status = %s where chat_id = %s""", (False, result[0],))
222+
conn.commit()
222223
cursor.execute("""UPDATE users SET viewing=%s where chat_id=%s""", (chat_id_store, chat_id))
223224
conn.commit()
224225
keyboard = [[InlineKeyboardButton("Subscribed 🫡", callback_data="SUBBED"),

0 commit comments

Comments
 (0)