mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-25 18:04:10 +00:00
🐛 Handling AccountNotFound
exception caused by the uid not found
This commit is contained in:
parent
b40a478ca7
commit
5799db53e3
@ -2,7 +2,7 @@ from datetime import datetime
|
|||||||
from typing import Optional, TYPE_CHECKING
|
from typing import Optional, TYPE_CHECKING
|
||||||
|
|
||||||
import genshin
|
import genshin
|
||||||
from genshin import DataNotPublic, GenshinException, types
|
from genshin import DataNotPublic, GenshinException, types, AccountNotFound
|
||||||
from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, TelegramObject
|
from telegram import ReplyKeyboardMarkup, ReplyKeyboardRemove, TelegramObject
|
||||||
from telegram.ext import ConversationHandler, filters
|
from telegram.ext import ConversationHandler, filters
|
||||||
from telegram.helpers import escape_markdown
|
from telegram.helpers import escape_markdown
|
||||||
@ -205,6 +205,10 @@ class BindAccountPlugin(Plugin.Conversation):
|
|||||||
return ConversationHandler.END
|
return ConversationHandler.END
|
||||||
try:
|
try:
|
||||||
player_stats = await client.get_genshin_user(player_id)
|
player_stats = await client.get_genshin_user(player_id)
|
||||||
|
except AccountNotFound:
|
||||||
|
await message.reply_text("找不到用户,uid可能无效", reply_markup=ReplyKeyboardRemove())
|
||||||
|
logger.warning("获取账号信息发生错误 %s 找不到用户 uid可能无效", player_id)
|
||||||
|
return ConversationHandler.END
|
||||||
except DataNotPublic:
|
except DataNotPublic:
|
||||||
await message.reply_text("角色未公开", reply_markup=ReplyKeyboardRemove())
|
await message.reply_text("角色未公开", reply_markup=ReplyKeyboardRemove())
|
||||||
logger.warning("获取账号信息发生错误 %s 账户信息未公开", player_id)
|
logger.warning("获取账号信息发生错误 %s 账户信息未公开", player_id)
|
||||||
|
Loading…
Reference in New Issue
Block a user