From eb3b54975494d1d293377742c1d25072da23fe0d Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Sat, 20 Jan 2024 17:46:16 +0800 Subject: [PATCH] :bug: Fix reply message can't be edited --- plugins/genshin/wish_log.py | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/plugins/genshin/wish_log.py b/plugins/genshin/wish_log.py index ebac661..09139d7 100644 --- a/plugins/genshin/wish_log.py +++ b/plugins/genshin/wish_log.py @@ -7,6 +7,7 @@ from simnet import GenshinClient, Region from simnet.models.genshin.wish import BannerType from telegram import InlineKeyboardButton, InlineKeyboardMarkup, ReplyKeyboardMarkup, ReplyKeyboardRemove from telegram.constants import ChatAction +from telegram.error import BadRequest from telegram.ext import ConversationHandler, filters from telegram.helpers import create_deep_linked_url @@ -239,7 +240,11 @@ class WishLogPlugin(Plugin.Conversation): reply = await message.reply_text("小派蒙正在从服务器获取数据,请稍后", reply_markup=ReplyKeyboardRemove()) await message.reply_chat_action(ChatAction.TYPING) text = await self._refresh_user_data(user, authkey=authkey) - await reply.edit_text(text) + try: + await reply.delete() + except BadRequest: + pass + await message.reply_text(text) return ConversationHandler.END @conversation.entry_point