This commit is contained in:
xtaodada 2022-06-04 14:33:19 +08:00
parent b94ddfc17c
commit f701796839
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659

View File

@ -19,9 +19,10 @@ async def answer_callback(_: Client, callback_query: CallbackQuery):
if not data.all_char: if not data.all_char:
return await callback_query.answer("没有可展示的角色,可能是数据未刷新", show_alert=True) return await callback_query.answer("没有可展示的角色,可能是数据未刷新", show_alert=True)
if not char: if not char:
await callback_query.message.edit_media(InputMediaPhoto(media=f"resources{sep}Kitsune.png", return await callback_query.message.edit_media(
caption=f"请选择 {data.name} 的一个角色:")) InputMediaPhoto(media=f"resources{sep}Kitsune.png",
return await callback_query.message.edit_reply_markup(reply_markup=data.gen_keyboard()) caption=f"请选择 {data.name} 的一个角色:"),
reply_markup=data.gen_keyboard())
char_data = None char_data = None
for i in data.all_char: for i in data.all_char:
if i.get("name", "") == char: if i.get("name", "") == char:
@ -29,5 +30,6 @@ async def answer_callback(_: Client, callback_query: CallbackQuery):
break break
if not char_data: if not char_data:
return await callback_query.answer("没有可展示的角色,可能是数据未刷新", show_alert=True) return await callback_query.answer("没有可展示的角色,可能是数据未刷新", show_alert=True)
await callback_query.message.edit_media(InputMediaPhoto(media=char_data["file_id"])) await callback_query.message.edit_media(
await callback_query.message.edit_reply_markup(reply_markup=data.gen_back()) InputMediaPhoto(media=char_data["file_id"]),
reply_markup=data.gen_back())