From 1b5d7fdf9ca7571689cde1418b1fb9be1d9f58fb Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?=E6=B4=9B=E6=B0=B4=E5=B1=85=E5=AE=A4?= Date: Sat, 8 Oct 2022 11:14:03 +0800 Subject: [PATCH] =?UTF-8?q?=F0=9F=8E=A8=20=E6=8F=90=E9=AB=98=E4=BB=A3?= =?UTF-8?q?=E7=A0=81=E8=B4=A8=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- plugins/system/update.py | 1 + utils/decorators/error.py | 6 +++--- 2 files changed, 4 insertions(+), 3 deletions(-) diff --git a/plugins/system/update.py b/plugins/system/update.py index a24b934..f5c4fa9 100644 --- a/plugins/system/update.py +++ b/plugins/system/update.py @@ -47,6 +47,7 @@ class UpdatePlugin(Plugin): logger.info(f"用户 {user.full_name}[{user.id}] update命令请求") if self._lock.locked(): await message.reply_text("程序正在更新 请勿重复操作") + return async with self._lock: reply_text = await message.reply_text("正在更新") logger.info(f"正在更新代码") diff --git a/utils/decorators/error.py b/utils/decorators/error.py index b4c4aa8..9e8d159 100644 --- a/utils/decorators/error.py +++ b/utils/decorators/error.py @@ -78,7 +78,7 @@ def error_callable(func: Callable) -> Callable: await send_user_notification(update, context, "出错了呜呜呜 ~ 资源未找到 ~ ") return ConversationHandler.END except InvalidCookies as exc: - if exc.retcode == 10001 or exc.retcode == -100: + if exc.retcode in (10001, -100): await send_user_notification(update, context, "出错了呜呜呜 ~ Cookies无效,请尝试重新绑定账户") elif exc.retcode == 10103: await send_user_notification(update, context, "出错了呜呜呜 ~ Cookie有效,但没有绑定到游戏帐户," @@ -112,12 +112,12 @@ def error_callable(func: Callable) -> Callable: await send_user_notification(update, context, "出错了呜呜呜 ~ API请求错误") return ConversationHandler.END except BadRequest as exc: - logger.warning("python-telegram-bot 请求错误") + logger.error("python-telegram-bot 请求错误") logger.exception(exc) await send_user_notification(update, context, "出错了呜呜呜 ~ telegram-bot-api请求错误") return ConversationHandler.END except Forbidden as exc: - logger.warning("python-telegram-bot返回 Forbidden") + logger.error("python-telegram-bot返回 Forbidden") logger.exception(exc) await send_user_notification(update, context, "出错了呜呜呜 ~ telegram-bot-api请求错误") return ConversationHandler.END