fix(bot): eliminate duplicate review cards caused by sync race and edit fallback
This commit is contained in:
@@ -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:
|
||||
|
||||
Reference in New Issue
Block a user