🎨 Fix Some Issues Identified

🎨 Improve f-string used without any expression

🎨 Remove unnecessary else / elif used after return
This commit is contained in:
luoshuijs 2023-09-06 15:27:03 +08:00 committed by GitHub
parent 656b1e8404
commit f1de1c987d
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 3 additions and 3 deletions

View File

@ -473,7 +473,7 @@ class _NamecardAssets(_AssetsService):
for namecard_id, namecard_data in NAMECARD_DATA.items():
if namecard_data["icon"].split("_")[-1] == avatar_icon_name:
return int(namecard_id)
elif avatar_icon_name in namecard_data["icon"].split("_")[-1]:
if avatar_icon_name in namecard_data["icon"].split("_")[-1]:
fallback = int(namecard_id)
if fallback:
return fallback

View File

@ -140,7 +140,7 @@ class ErrorHandler(Plugin):
notice = self.ERROR_MSG_PREFIX + f"Cookie 无效 错误信息为 {exc.original} 请尝试重新绑定"
elif isinstance(exc, CookieException):
if exc.retcode == 0:
notice = self.ERROR_MSG_PREFIX + "Cookie 已经被刷新,请尝试重试操作~"
notice = self.ERROR_MSG_PREFIX + "Cookie 已经被刷新,请尝试重试发送命令~"
else:
logger.error("未知Cookie错误", exc_info=exc)
notice = self.ERROR_MSG_PREFIX + f"Cookie 无效 错误信息为 {exc.original} 请尝试重新绑定"
@ -164,7 +164,7 @@ class ErrorHandler(Plugin):
if message:
notice = self.ERROR_MSG_PREFIX + f"获取信息发生错误 错误信息为 {message} ~ 请稍后再试"
else:
notice = self.ERROR_MSG_PREFIX + f"获取信息发生错误 请稍后再试"
notice = self.ERROR_MSG_PREFIX + "获取信息发生错误 请稍后再试"
if notice:
self.create_notice_task(update, context, notice)
raise ApplicationHandlerStop