🐛 修复未配置错误通知时依然发送日记导致的异常

This commit is contained in:
洛水居室 2022-10-21 19:07:49 +08:00
parent 333994281e
commit 24c63002cd
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC
2 changed files with 3 additions and 2 deletions

View File

@ -37,7 +37,8 @@ class BotConfig(BaseSettings):
redis_db: int = 0
bot_token: str = ""
error_notification_chat_id: str = ""
error_notification_chat_id: Optional[str] = None
api_id: Optional[int] = None
api_hash: Optional[str] = None

View File

@ -35,7 +35,7 @@ class ErrorHandler(Plugin):
logger.error("处理函数时发生异常")
logger.exception(context.error, exc_info=(type(context.error), context.error, context.error.__traceback__))
if notice_chat_id is None:
if notice_chat_id:
return
tb_list = traceback.format_exception(None, context.error, context.error.__traceback__)