diff --git a/core/plugin/_funcs.py b/core/plugin/_funcs.py index 0a975fdf..57425458 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 b6e6fb5e..987c016f 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 17dcc61e..c5eaff54 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 3639641c..4a223ae4 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 6ef2f363..298b3e13 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 = {