🎨 Add Handle 1034 Error Raised by Public Query

This commit is contained in:
洛水居室 2023-01-07 15:39:54 +08:00
parent 98db3fe755
commit 24ce0dac92
No known key found for this signature in database
GPG Key ID: C9DE87DA724B88FC
2 changed files with 14 additions and 2 deletions

View File

@ -7,7 +7,7 @@ from typing import Any, Coroutine, List, Match, Optional, Tuple, Union
import ujson as json import ujson as json
from arkowrapper import ArkoWrapper from arkowrapper import ArkoWrapper
from genshin import Client from genshin import Client, GenshinException
from pytz import timezone from pytz import timezone
from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Message, Update from telegram import InlineKeyboardButton, InlineKeyboardMarkup, Message, Update
from telegram.constants import ChatAction, ParseMode from telegram.constants import ChatAction, ParseMode
@ -169,6 +169,12 @@ class Abyss(Plugin, BasePlugin):
try: try:
images = await self.get_rendered_pic(client, uid, floor, total, previous) images = await self.get_rendered_pic(client, uid, floor, total, previous)
except GenshinException as exc:
if exc.retcode == 1034:
if client.uid != uid:
await message.reply_text("出错了呜呜呜 ~ 请稍后重试")
return
raise exc
except AbyssUnlocked: # 若深渊未解锁 except AbyssUnlocked: # 若深渊未解锁
await reply_message_func("还未解锁深渊哦~") await reply_message_func("还未解锁深渊哦~")
return return

View File

@ -1,7 +1,7 @@
import random import random
from typing import Optional from typing import Optional
from genshin import Client from genshin import Client, GenshinException
from genshin.models import GenshinUserStats from genshin.models import GenshinUserStats
from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup from telegram import Update, InlineKeyboardButton, InlineKeyboardMarkup
from telegram.constants import ChatAction from telegram.constants import ChatAction
@ -66,6 +66,12 @@ class UserStatsPlugins(Plugin, BasePlugin):
else: else:
await message.reply_text("未查询到您所绑定的账号信息,请先绑定账号", reply_markup=InlineKeyboardMarkup(buttons)) await message.reply_text("未查询到您所绑定的账号信息,请先绑定账号", reply_markup=InlineKeyboardMarkup(buttons))
return return
except GenshinException as exc:
if exc.retcode == 1034:
if uid:
await message.reply_text("出错了呜呜呜 ~ 请稍后重试")
return
raise exc
except TooManyRequestPublicCookies: except TooManyRequestPublicCookies:
await message.reply_text("用户查询次数过多 请稍后重试") await message.reply_text("用户查询次数过多 请稍后重试")
return return