diff --git a/pagermaid/__main__.py b/pagermaid/__main__.py index 109f000..c81b119 100644 --- a/pagermaid/__main__.py +++ b/pagermaid/__main__.py @@ -25,8 +25,8 @@ except PhoneNumberInvalidError: for module_name in module_list: try: import_module("pagermaid.modules." + module_name) - except BaseException: - logs.info(f"模块 {module_name} 加载出错。") + except BaseException as exception: + logs.info(f"模块 {module_name} 加载出错: {type(exception)}: {exception}") for plugin_name in plugin_list: try: import_module("plugins." + plugin_name) diff --git a/pagermaid/listener.py b/pagermaid/listener.py index 0caf904..cc74bd0 100644 --- a/pagermaid/listener.py +++ b/pagermaid/listener.py @@ -11,6 +11,8 @@ from telethon.events import StopPropagation from pagermaid import bot, config, help_messages from pagermaid.utils import attach_log +def noop(*args, **kw): + pass def listener(**args): """ Register an event listener. """ @@ -79,16 +81,16 @@ def listener(**args): await attach_log(report, -1001441461877, f"exception.{time()}.pagermaid", None, "Error report generated.") - if not is_plugin: - if 'disabled_cmd' in config and config['disabled_cmd'].count(command) != 0: - return - if not ignore_edited: bot.add_event_handler(handler, events.MessageEdited(**args)) bot.add_event_handler(handler, events.NewMessage(**args)) return handler + if not is_plugin and 'disabled_cmd' in config: + if config['disabled_cmd'].count(command) != 0: + return noop + if description is not None and command is not None: if parameters is None: parameters = ""