mirror of
https://github.com/PaiGramTeam/PaiGram.git
synced 2024-11-16 04:35:49 +00:00
修复 gacha
特殊情况下默认无输出的问题
This commit is contained in:
parent
03758998e3
commit
f79d8f7ce0
@ -40,7 +40,7 @@ class Gacha(BasePlugins):
|
||||
@conversation_error_handler
|
||||
@restricts(filters.ChatType.GROUPS, restricts_time=20, try_delete_message=True)
|
||||
@restricts(filters.ChatType.PRIVATE)
|
||||
async def command_start(self, update: Update, context: PaimonContext) -> None:
|
||||
async def command_start(self, update: Update, context: PaimonContext) -> int:
|
||||
message = update.message
|
||||
user = update.effective_user
|
||||
args = context.args
|
||||
@ -60,11 +60,8 @@ class Gacha(BasePlugins):
|
||||
if key == gacha_name:
|
||||
gacha_name = value
|
||||
break
|
||||
else:
|
||||
await message.reply_text(f"没有找到名为 {gacha_name} 的卡池")
|
||||
return ConversationHandler.END
|
||||
Log.info(f"用户 {user.full_name}[{user.id}] 抽卡模拟器命令请求 || 参数 {gacha_name}")
|
||||
gacha_info = await service.gacha.gacha_info(gacha_name)
|
||||
gacha_info = await service.gacha.gacha_info(gacha_name, default=False if len(args) >= 1 else True)
|
||||
# 用户数据储存和处理
|
||||
if gacha_info.get("gacha_id") is None:
|
||||
await message.reply_text(f"没有找到名为 {gacha_name} 的卡池")
|
||||
|
@ -9,11 +9,11 @@ class GachaService:
|
||||
self.cache = cache
|
||||
self.gacha = GachaInfo()
|
||||
|
||||
async def gacha_info(self, gacha_name: str = "角色活动"):
|
||||
async def gacha_info(self, gacha_name: str = "角色活动", default: bool = False):
|
||||
gacha_list_info = await self.gacha.get_gacha_list_info()
|
||||
gacha_id = ""
|
||||
for gacha in gacha_list_info.data["list"]:
|
||||
if gacha["gacha_name"] == gacha_name:
|
||||
if gacha["gacha_name"] == gacha_name or default:
|
||||
gacha_id = gacha["gacha_id"]
|
||||
if gacha_id == "":
|
||||
return {}
|
||||
|
Loading…
Reference in New Issue
Block a user