🐛 Fix TypeError exception caused by message is None

This commit is contained in:
洛水居室 2023-04-11 09:44:39 +08:00
parent def32d89b9
commit d386a47ac7
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC

View File

@ -83,11 +83,13 @@ class ErrorHandler(Plugin):
try: try:
if update.callback_query: if update.callback_query:
await update.callback_query.answer(content, show_alert=True) await update.callback_query.answer(content, show_alert=True)
else: return
if message:
reply_text = await message.reply_text(content, reply_markup=buttons, allow_sending_without_reply=True) reply_text = await message.reply_text(content, reply_markup=buttons, allow_sending_without_reply=True)
if filters.ChatType.GROUPS.filter(reply_text): if filters.ChatType.GROUPS.filter(reply_text):
self.add_delete_message_job(reply_text, context=context) self.add_delete_message_job(reply_text, context=context)
self.add_delete_message_job(message, context=context) self.add_delete_message_job(message, context=context)
return
except TelegramError as exc: except TelegramError as exc:
logger.error(self.SEND_MSG_ERROR_NOTICE, update.update_id, exc.message) logger.error(self.SEND_MSG_ERROR_NOTICE, update.update_id, exc.message)
except Exception as exc: except Exception as exc: