🎨 提高代码质量

This commit is contained in:
洛水居室 2022-10-08 11:14:03 +08:00
parent 08bdd8962b
commit 1b5d7fdf9c
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC
2 changed files with 4 additions and 3 deletions

View File

@ -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"正在更新代码")

View File

@ -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