From 493cbbcff0d391766a00519bf2cde194bdb26304 Mon Sep 17 00:00:00 2001 From: CMHopeSunshine <277073121@qq.com> Date: Wed, 7 Sep 2022 19:10:00 +0800 Subject: [PATCH] :bug: fix bug --- LittlePaimon/manager/plugin_manager/__init__.py | 2 +- LittlePaimon/plugins/Paimon_Gacha_Log/data_source.py | 9 ++++----- 2 files changed, 5 insertions(+), 6 deletions(-) diff --git a/LittlePaimon/manager/plugin_manager/__init__.py b/LittlePaimon/manager/plugin_manager/__init__.py index e778042..e49e7ec 100644 --- a/LittlePaimon/manager/plugin_manager/__init__.py +++ b/LittlePaimon/manager/plugin_manager/__init__.py @@ -137,7 +137,7 @@ async def _(): @run_preprocessor async def _(event: MessageEvent, matcher: Matcher): - if matcher.plugin_name in hidden_plugins: + if not matcher.plugin_name or matcher.plugin_name in hidden_plugins: return if isinstance(event, PrivateMessageEvent): session_id = event.user_id diff --git a/LittlePaimon/plugins/Paimon_Gacha_Log/data_source.py b/LittlePaimon/plugins/Paimon_Gacha_Log/data_source.py index 04a08cb..0da1d32 100644 --- a/LittlePaimon/plugins/Paimon_Gacha_Log/data_source.py +++ b/LittlePaimon/plugins/Paimon_Gacha_Log/data_source.py @@ -173,13 +173,12 @@ async def get_gacha_log_img(user_id: str, uid: str, nickname: str): def create_import_command(user_id: int): def file_rule(event: NoticeEvent): - if event.get_user_id() != str(user_id): - return False - if isinstance(event, GroupUploadNoticeEvent): - return True - return event.notice_type == 'offline_file' + if isinstance(event, GroupUploadNoticeEvent) or event.notice_type == 'offline_file': + return event.get_user_id() == str(user_id) + return False import_cmd = on_notice(priority=12, rule=Rule(file_rule), expire_time=datetime.timedelta(minutes=5), temp=True) + import_cmd.plugin_name = 'Paimon_Gacha_Log' @import_cmd.handle() async def _(event: NoticeEvent):