From 0e6125e3ee65fa7c9fe9ec9f96644361f4f2cc63 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Sun, 18 Sep 2022 16:35:37 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E4=BD=BF=E7=94=A8=20`update.eff?= =?UTF-8?q?ective=5Fmessage`=20=E8=8E=B7=E5=8F=96=E6=B6=88=E6=81=AF?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/genshin/daily_note.py | 2 +- plugins/genshin/gacha/gacha.py | 2 +- plugins/genshin/map/map.py | 2 +- plugins/other/post.py | 2 +- plugins/system/set_quiz.py | 5 +++-- 5 files changed, 7 insertions(+), 6 deletions(-) diff --git a/plugins/genshin/daily_note.py b/plugins/genshin/daily_note.py index dfb8dfd..2d7d7ac 100644 --- a/plugins/genshin/daily_note.py +++ b/plugins/genshin/daily_note.py @@ -85,7 +85,7 @@ class DailyNote(Plugin, BasePlugin): @error_callable async def command_start(self, update: Update, context: CallbackContext) -> Optional[int]: user = update.effective_user - message = update.message + message = update.effective_message logger.info(f"用户 {user.full_name}[{user.id}] 查询游戏状态命令请求") try: client = await get_genshin_client(user.id) diff --git a/plugins/genshin/gacha/gacha.py b/plugins/genshin/gacha/gacha.py index 0072e64..f25aa9b 100644 --- a/plugins/genshin/gacha/gacha.py +++ b/plugins/genshin/gacha/gacha.py @@ -52,7 +52,7 @@ class Gacha(Plugin, BasePlugin): @restricts(restricts_time=3, restricts_time_of_groups=20) @error_callable async def command_start(self, update: Update, context: CallbackContext) -> None: - message = update.message + message = update.effective_message user = update.effective_user args = get_all_args(context) gacha_name = "角色活动" diff --git a/plugins/genshin/map/map.py b/plugins/genshin/map/map.py index de8a4de..2c0f81b 100644 --- a/plugins/genshin/map/map.py +++ b/plugins/genshin/map/map.py @@ -31,7 +31,7 @@ class Map(Plugin, BasePlugin): @error_callable @restricts(restricts_time=20) async def command_start(self, update: Update, context: CallbackContext): - message = update.message + message = update.effective_message args = context.args user = update.effective_user if not self.init_resource_map: diff --git a/plugins/other/post.py b/plugins/other/post.py index 1987e2a..0ace4ac 100644 --- a/plugins/other/post.py +++ b/plugins/other/post.py @@ -134,7 +134,7 @@ class Post(Plugin.Conversation, BasePlugin): async def delete_photo(self, update: Update, context: CallbackContext) -> int: post_handler_data: PostHandlerData = context.chat_data.get("post_handler_data") photo_len = len(post_handler_data.post_images) - message = update.message + message = update.effective_message await message.reply_text("请回复你要删除的图片的序列,从1开始,如果删除多张图片回复的序列请以空格作为分隔符," f"当前一共有 {photo_len} 张图片") return GTE_DELETE_PHOTO diff --git a/plugins/system/set_quiz.py b/plugins/system/set_quiz.py index 830e096..40cfd77 100644 --- a/plugins/system/set_quiz.py +++ b/plugins/system/set_quiz.py @@ -49,7 +49,7 @@ class SetQuizPlugin(Plugin.Conversation, BasePlugin.Conversation): @error_callable async def command_start(self, update: Update, context: CallbackContext) -> int: user = update.effective_user - message = update.message + message = update.effective_message logger.info(f"用户 {user.full_name}[{user.id}] set_quiz命令请求") quiz_command_data: QuizCommandData = context.chat_data.get("quiz_command_data") if quiz_command_data is None: @@ -144,10 +144,11 @@ class SetQuizPlugin(Plugin.Conversation, BasePlugin.Conversation): @conversation.state(state=GET_NEW_QUESTION) @handler.message(filters=filters.TEXT & ~filters.COMMAND, block=True) async def get_new_question(self, update: Update, context: CallbackContext) -> int: + message = update.effective_message quiz_command_data: QuizCommandData = context.chat_data.get("quiz_command_data") reply_text = f"问题:`{escape_markdown(update.message.text, version=2)}`\n" \ f"请填写正确答案:" - quiz_command_data.new_question = update.message.text + quiz_command_data.new_question = message.text await update.message.reply_markdown_v2(reply_text) return GET_NEW_CORRECT_ANSWER