fix(bot): eliminate duplicate review cards caused by sync race and edit fallback

This commit is contained in:
2026-09-29 01:05:24 +03:30
parent a2e7c27e85
commit 1b5fc589fd
3 changed files with 32 additions and 17 deletions
+6 -5
View File
@@ -129,14 +129,15 @@ class BotContext:
return message
async def edit(self, chat_id: int, message_id: int | None, text: str,
reply_markup: dict | None = None) -> None:
reply_markup: dict | None = None) -> bool:
if not message_id:
await self.send(chat_id, text, reply_markup=reply_markup)
return
return False
try:
await self.bale.edit_message_text(chat_id, message_id, text, reply_markup=reply_markup)
except Exception:
await self.send(chat_id, text, reply_markup=reply_markup)
return True
except Exception as exc:
logger.warning("failed to edit message %s in chat %s: %s", message_id, chat_id, exc)
return False
async def delete(self, chat_id: int, message_id: int | None) -> bool:
if not message_id: