feat: 插件更新异常处理

This commit is contained in:
Rock Chin
2023-04-03 14:09:30 +00:00
parent 58d991df0a
commit ac81597236
+5
View File
@@ -98,6 +98,7 @@ class PluginUpdateCommand(AbstractCommandNode):
reply = [] reply = []
def closure(): def closure():
try:
import pkg.utils.context import pkg.utils.context
updated = [] updated = []
for key in plugin_list: for key in plugin_list:
@@ -120,6 +121,10 @@ class PluginUpdateCommand(AbstractCommandNode):
main.reset_logging() main.reset_logging()
pkg.utils.context.get_qqbot_manager().notify_admin("已更新插件: {}".format(", ".join(updated))) pkg.utils.context.get_qqbot_manager().notify_admin("已更新插件: {}".format(", ".join(updated)))
except Exception as e:
logging.error("插件更新失败:{}".format(e))
pkg.utils.context.get_qqbot_manager().notify_admin("插件更新失败:{} 请尝试手动更新插件".format(e))
threading.Thread(target=closure).start() threading.Thread(target=closure).start()
reply = ["[bot]正在更新所有插件,请勿重复发起..."] reply = ["[bot]正在更新所有插件,请勿重复发起..."]