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