🏁 尝试修复无法平滑更新的问题 (#21)

* 🏁 尝试修复无法平滑更新的问题
This commit is contained in:
一只瓜 2020-08-09 23:46:25 +08:00 committed by GitHub
parent 91f6b8108f
commit 852c079631
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 8 additions and 6 deletions

View File

@ -25,8 +25,8 @@ except PhoneNumberInvalidError:
for module_name in module_list: for module_name in module_list:
try: try:
import_module("pagermaid.modules." + module_name) import_module("pagermaid.modules." + module_name)
except BaseException: except BaseException as exception:
logs.info(f"模块 {module_name} 加载出错") logs.info(f"模块 {module_name} 加载出错: {type(exception)}: {exception}")
for plugin_name in plugin_list: for plugin_name in plugin_list:
try: try:
import_module("plugins." + plugin_name) import_module("plugins." + plugin_name)

View File

@ -11,6 +11,8 @@ from telethon.events import StopPropagation
from pagermaid import bot, config, help_messages from pagermaid import bot, config, help_messages
from pagermaid.utils import attach_log from pagermaid.utils import attach_log
def noop(*args, **kw):
pass
def listener(**args): def listener(**args):
""" Register an event listener. """ """ Register an event listener. """
@ -79,16 +81,16 @@ def listener(**args):
await attach_log(report, -1001441461877, f"exception.{time()}.pagermaid", None, await attach_log(report, -1001441461877, f"exception.{time()}.pagermaid", None,
"Error report generated.") "Error report generated.")
if not is_plugin:
if 'disabled_cmd' in config and config['disabled_cmd'].count(command) != 0:
return
if not ignore_edited: if not ignore_edited:
bot.add_event_handler(handler, events.MessageEdited(**args)) bot.add_event_handler(handler, events.MessageEdited(**args))
bot.add_event_handler(handler, events.NewMessage(**args)) bot.add_event_handler(handler, events.NewMessage(**args))
return handler 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 description is not None and command is not None:
if parameters is None: if parameters is None:
parameters = "" parameters = ""