diff --git a/pagermaid/listener.py b/pagermaid/listener.py index cc74bd0..656dbf2 100644 --- a/pagermaid/listener.py +++ b/pagermaid/listener.py @@ -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.") diff --git a/pagermaid/modules/plugin.py b/pagermaid/modules/plugin.py index ae7439d..6820db1 100644 --- a/pagermaid/modules/plugin.py +++ b/pagermaid/modules/plugin.py @@ -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 = \