fix: user_id -> chat_id for unsub:
All checks were successful
Build and Run VSTU Public TG bot / build_and_run (push) Successful in 6s
All checks were successful
Build and Run VSTU Public TG bot / build_and_run (push) Successful in 6s
This commit is contained in:
5
main.py
5
main.py
@@ -270,13 +270,12 @@ async def my_subs(callback: types.CallbackQuery):
|
|||||||
@dp.callback_query(F.data.startswith("unsub:"))
|
@dp.callback_query(F.data.startswith("unsub:"))
|
||||||
async def unsub(callback: types.CallbackQuery):
|
async def unsub(callback: types.CallbackQuery):
|
||||||
sid = int(callback.data.split(":")[1])
|
sid = int(callback.data.split(":")[1])
|
||||||
user_id = callback.from_user.id # ID того, кто нажал на кнопку
|
chat_id = callback.message.chat.id
|
||||||
|
|
||||||
async with async_session() as session:
|
async with async_session() as session:
|
||||||
# Добавляем условие chat_id == user_id
|
|
||||||
stmt = select(Subscription).where(
|
stmt = select(Subscription).where(
|
||||||
Subscription.id == sid,
|
Subscription.id == sid,
|
||||||
Subscription.chat_id == user_id,
|
Subscription.chat_id == chat_id,
|
||||||
Subscription.deleted == False
|
Subscription.deleted == False
|
||||||
)
|
)
|
||||||
result = await session.execute(stmt)
|
result = await session.execute(stmt)
|
||||||
|
|||||||
Reference in New Issue
Block a user