diff --git a/plugins/system/update.py b/plugins/system/update.py index 8e58d60..5c5f0db 100644 --- a/plugins/system/update.py +++ b/plugins/system/update.py @@ -4,7 +4,7 @@ from sys import executable from aiofiles import open as async_open from telegram import Update, Message -from telegram.error import BadRequest, Forbidden +from telegram.error import NetworkError from telegram.ext import CallbackContext, CommandHandler from core.bot import bot @@ -37,9 +37,10 @@ class UpdatePlugin(Plugin): try: reply_text = Message.de_json(data, bot.app.bot) await reply_text.edit_text("重启成功") - except (BadRequest, Forbidden, KeyError) as exc: - logger.error("UpdatePlugin 编辑消息出现错误") - logger.exception(exc) + except NetworkError as exc: + logger.error("UpdatePlugin 编辑消息出现错误 %s", exc.message) + except KeyError as exc: + logger.error("UpdatePlugin 编辑消息出现错误", exc_info=exc) os.remove(UPDATE_DATA) @handler(CommandHandler, command="update", block=False)