From 139c6758ae2ca360878defbb017640a53c3c1c3a 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, 26 Mar 2023 16:12:11 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=90=9B=20Fix=20issue=20of=20incorrect=20p?= =?UTF-8?q?arameters=20being=20passed=20when=20calling=20`add=5Fdelete=5Fm?= =?UTF-8?q?essage=5Fjob`?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- core/plugin/_funcs.py | 2 +- plugins/genshin/abyss.py | 8 ++++---- plugins/genshin/birthday.py | 4 ++-- plugins/genshin/sign.py | 4 ++-- plugins/genshin/wish.py | 2 +- 5 files changed, 10 insertions(+), 10 deletions(-) diff --git a/core/plugin/_funcs.py b/core/plugin/_funcs.py index 0a975fd..5742545 100644 --- a/core/plugin/_funcs.py +++ b/core/plugin/_funcs.py @@ -104,7 +104,7 @@ class PluginFuncs: job_queue = self.application.job_queue or context.job_queue - if job_queue is None: + if job_queue is None or chat is None: raise RuntimeError return job_queue.run_once( diff --git a/plugins/genshin/abyss.py b/plugins/genshin/abyss.py index b6e6fb5..987c016 100644 --- a/plugins/genshin/abyss.py +++ b/plugins/genshin/abyss.py @@ -142,16 +142,16 @@ class AbyssPlugin(Plugin): reply_message = await message.reply_text( "未查询到您所绑定的账号信息,请先私聊派蒙绑定账号", reply_markup=InlineKeyboardMarkup(buttons) ) - self.add_delete_message_job(reply_message.chat_id) - self.add_delete_message_job(message.chat_id) + self.add_delete_message_job(reply_message) + self.add_delete_message_job(message) else: await message.reply_text("未查询到您所绑定的账号信息,请先绑定账号", reply_markup=InlineKeyboardMarkup(buttons)) return except TooManyRequestPublicCookies: reply_message = await message.reply_text("查询次数太多,请您稍后重试") if filters.ChatType.GROUPS.filter(message): - self.add_delete_message_job(reply_message.chat_id) - self.add_delete_message_job(message.chat_id) + self.add_delete_message_job(reply_message) + self.add_delete_message_job(message) return async def reply_message_func(content: str) -> None: diff --git a/plugins/genshin/birthday.py b/plugins/genshin/birthday.py index 17dcc61..c5eaff5 100644 --- a/plugins/genshin/birthday.py +++ b/plugins/genshin/birthday.py @@ -183,5 +183,5 @@ class BirthdayPlugin(Plugin): text = "没有领取到生日画片哦 ~ 可能是已经领取过了" reply_message = await message.reply_text(text) if filters.ChatType.GROUPS.filter(reply_message): - self.add_delete_message_job(message.chat_id) - self.add_delete_message_job(reply_message.chat_id) + self.add_delete_message_job(message) + self.add_delete_message_job(reply_message) diff --git a/plugins/genshin/sign.py b/plugins/genshin/sign.py index 3639641..4a223ae 100644 --- a/plugins/genshin/sign.py +++ b/plugins/genshin/sign.py @@ -87,7 +87,7 @@ class Sign(Plugin): reply_message = await message.reply_text(msg) if filters.ChatType.GROUPS.filter(message): self.add_delete_message_job(reply_message, delay=30) - self.add_delete_message_job(message.chat_id, delay=30) + self.add_delete_message_job(message, delay=30) return logger.info("用户 %s[%s] 每日签到命令请求", user.full_name, user.id) if filters.ChatType.GROUPS.filter(message): @@ -118,7 +118,7 @@ class Sign(Plugin): ) self.add_delete_message_job(reply_message, delay=30) - self.add_delete_message_job(message.chat_id, delay=30) + self.add_delete_message_job(message, delay=30) else: await message.reply_text("未查询到您所绑定的账号信息,请先绑定账号", reply_markup=InlineKeyboardMarkup(buttons)) except NeedChallenge as exc: diff --git a/plugins/genshin/wish.py b/plugins/genshin/wish.py index 6ef2f36..298b3e1 100644 --- a/plugins/genshin/wish.py +++ b/plugins/genshin/wish.py @@ -241,7 +241,7 @@ class WishSimulatorPlugin(Plugin): reply_message = await message.reply_text("出错了呜呜呜 ~ 卡池部分数据未找到!") if filters.ChatType.GROUPS.filter(message): self.add_delete_message_job(reply_message, name="wish_simulator") - self.add_delete_message_job(message.chat_id, name="wish_simulator") + self.add_delete_message_job(message, name="wish_simulator") return player_gacha_banner_info = player_gacha_info.get_banner_info(banner) template_data = {