Resolve callback timeout anomalies and clean error handling in unreviewed queue
This commit is contained in:
@@ -9,6 +9,7 @@ import subprocess
|
||||
from datetime import datetime, timezone
|
||||
from typing import Optional, List, Dict, Any, Tuple
|
||||
from telethon import TelegramClient, events, Button
|
||||
from telethon.errors import QueryIdInvalidError, MessageNotModifiedError
|
||||
from telethon.tl.types import PeerChannel, PeerChat, PeerUser, Channel, Chat
|
||||
from db.models import Post, TargetChannel, SourceChannel
|
||||
from db.repository import Repository
|
||||
@@ -1651,6 +1652,8 @@ class AdminBotService:
|
||||
async def on_callback(event: events.CallbackQuery.Event):
|
||||
try:
|
||||
await self._handle_callback(event)
|
||||
except (QueryIdInvalidError, MessageNotModifiedError) as e:
|
||||
logger.debug(f"Benign callback exception ({type(e).__name__}): {e}")
|
||||
except Exception as e:
|
||||
await log_exception("admin_bot.callback", e, {
|
||||
"sender_id": event.sender_id,
|
||||
@@ -2821,9 +2824,14 @@ class AdminBotService:
|
||||
if not posts:
|
||||
await event.answer("✅ هیچ پست بررسینشدهای در صف نیست.", alert=True)
|
||||
return
|
||||
await event.answer(f"⏳ در حال ارسال {len(posts)} پست بررسینشده به کانال ادمین...")
|
||||
for post in posts:
|
||||
await self.send_raw_review_post(post.id)
|
||||
await event.answer(f"✅ تعداد {len(posts)} پست بررسینشده به کانال ادمین ارسال شد.", alert=True)
|
||||
text, buttons = await self._render_copy_hub()
|
||||
try:
|
||||
await event.edit(text, parse_mode="html", buttons=buttons)
|
||||
except Exception:
|
||||
pass
|
||||
|
||||
elif data == "hub_cats":
|
||||
text, buttons = await self._render_categories_menu()
|
||||
|
||||
Reference in New Issue
Block a user