💩 修复无法报错、直接 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: except MessageTooLongError:
await context.edit("出错了呜呜呜 ~ 生成的输出太长,无法显示。") await context.edit("出错了呜呜呜 ~ 生成的输出太长,无法显示。")
except BaseException: except BaseException:
exc_info = sys.exc_info()[1]
exc_format = format_exc()
try: try:
await context.edit("出错了呜呜呜 ~ 执行此命令时发生错误。") await context.edit("出错了呜呜呜 ~ 执行此命令时发生错误。")
except BaseException: except BaseException:
@ -76,8 +78,8 @@ def listener(**args):
f"# Message: \n-----BEGIN TARGET MESSAGE-----\n" \ f"# Message: \n-----BEGIN TARGET MESSAGE-----\n" \
f"{context.text}\n-----END TARGET MESSAGE-----\n" \ f"{context.text}\n-----END TARGET MESSAGE-----\n" \
f"# Traceback: \n-----BEGIN TRACEBACK-----\n" \ f"# Traceback: \n-----BEGIN TRACEBACK-----\n" \
f"{str(format_exc())}\n-----END TRACEBACK-----\n" \ f"{str(exc_format)}\n-----END TRACEBACK-----\n" \
f"# Error: \"{str(sys.last_value)}\". \n" f"# Error: \"{str(exc_info)}\". \n"
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.")

View File

@ -228,6 +228,9 @@ async def plugin(context):
elif context.parameter[0] == "update": elif context.parameter[0] == "update":
unneed_update = "无需更新:" unneed_update = "无需更新:"
need_update = "\n需要更新:" 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: with open(f"{plugin_directory}version.json", 'r', encoding="utf-8") as f:
version_json = json.load(f) version_json = json.load(f)
plugin_online = \ plugin_online = \