mirror of
https://github.com/BEDOLAGA-DEV/remnawave-bedolaga-telegram-bot.git
synced 2026-05-04 20:15:56 +00:00
fix: webhook:close button not working due to channel check timeout
Channel checker middleware called bot.get_chat_member() which could timeout (60s), causing callback.answer() to fail with "query too old". Skip channel check for lightweight UI callbacks (webhook:close, ban_notify:delete, noop). Also answer callback before delete attempt and add fallback to remove keyboard if delete fails.
This commit is contained in:
@@ -30,10 +30,17 @@ async def handle_webhook_notification_close(
|
||||
):
|
||||
"""Удаляет webhook-уведомление при нажатии кнопки Закрыть."""
|
||||
try:
|
||||
await callback.message.delete()
|
||||
await callback.answer()
|
||||
except Exception:
|
||||
pass
|
||||
await callback.answer()
|
||||
try:
|
||||
await callback.message.delete()
|
||||
except Exception as e:
|
||||
logger.warning('Не удалось удалить webhook-уведомление: %s', e)
|
||||
try:
|
||||
await callback.message.edit_reply_markup(reply_markup=None)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
|
||||
async def handle_unknown_callback(callback: types.CallbackQuery, db_user: User):
|
||||
|
||||
@@ -109,6 +109,15 @@ class ChannelCheckerMiddleware(BaseMiddleware):
|
||||
logger.debug('❌ telegram_id не найден, пропускаем')
|
||||
return await handler(event, data)
|
||||
|
||||
# Skip channel check for lightweight UI callbacks (close/delete notifications)
|
||||
if isinstance(event, CallbackQuery) and event.data in (
|
||||
'webhook:close',
|
||||
'ban_notify:delete',
|
||||
'noop',
|
||||
'current_page',
|
||||
):
|
||||
return await handler(event, data)
|
||||
|
||||
# Админам разрешаем пропускать проверку подписки
|
||||
if settings.is_admin(telegram_id):
|
||||
logger.debug(
|
||||
|
||||
Reference in New Issue
Block a user