💩 修复无法报错、直接 apt update 报错

This commit is contained in:
xtaodada 2020-08-11 23:49:16 +08:00
parent df9abd5e80
commit 9f4b346b1f
No known key found for this signature in database
GPG Key ID: EE4DC37B55E24736
2 changed files with 7 additions and 2 deletions

View File

@ -63,6 +63,8 @@ def listener(**args):
except MessageTooLongError:
await context.edit("出错了呜呜呜 ~ 生成的输出太长,无法显示。")
except BaseException:
exc_info = sys.exc_info()[1]
exc_format = format_exc()
try:
await context.edit("出错了呜呜呜 ~ 执行此命令时发生错误。")
except BaseException:
@ -76,8 +78,8 @@ def listener(**args):
f"# Message: \n-----BEGIN TARGET MESSAGE-----\n" \
f"{context.text}\n-----END TARGET MESSAGE-----\n" \
f"# Traceback: \n-----BEGIN TRACEBACK-----\n" \
f"{str(format_exc())}\n-----END TRACEBACK-----\n" \
f"# Error: \"{str(sys.last_value)}\". \n"
f"{str(exc_format)}\n-----END TRACEBACK-----\n" \
f"# Error: \"{str(exc_info)}\". \n"
await attach_log(report, -1001441461877, f"exception.{time()}.pagermaid", None,
"Error report generated.")

View File

@ -228,6 +228,9 @@ async def plugin(context):
elif context.parameter[0] == "update":
unneed_update = "无需更新:"
need_update = "\n需要更新:"
if not exists(f"{plugin_directory}version.json"):
await context.edit("安装一个仓库内插件再试试?")
return
with open(f"{plugin_directory}version.json", 'r', encoding="utf-8") as f:
version_json = json.load(f)
plugin_online = \