Fix a bug

This commit is contained in:
xtaodada 2022-03-25 10:47:26 +08:00
parent 0d03a08374
commit 93479a34c0
Signed by: xtaodada
GPG Key ID: 4CBB3F4FA8C85659
2 changed files with 20 additions and 5 deletions

View File

@ -4,7 +4,6 @@ from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton
from ci import sqlite, me from ci import sqlite, me
from defs.source import from_keyword_to_v from defs.source import from_keyword_to_v
from defs.utils import Vtuber from defs.utils import Vtuber
from plugins.start import not_found_msg
info_help_msg = """ info_help_msg = """
👩🏻💼 » /info <code>space_id|昵称|room_id</code> - 查询模块信息 👩🏻💼 » /info <code>space_id|昵称|room_id</code> - 查询模块信息
@ -23,6 +22,9 @@ vtuber_msg = """
@DD_YTbs_Live_Tracker | @DD_YTbs_Bot @DD_YTbs_Live_Tracker | @DD_YTbs_Bot
""" """
not_found_msg = """
<b>没有找到名为</b> <code>{}</code> <b> Vtuber</b>
"""
def gen_info_button(data: Vtuber) -> InlineKeyboardMarkup: def gen_info_button(data: Vtuber) -> InlineKeyboardMarkup:

View File

@ -1,8 +1,8 @@
from pyrogram import Client, filters from pyrogram import Client, filters
from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton
from ci import me from ci import me
from plugins.info import info_command from plugins.info import vtuber_msg, gen_info_button
from defs.source import from_name_to_v from defs.source import from_name_to_v, from_keyword_to_v
from defs.subs import add_to_subs, remove_from_subs from defs.subs import add_to_subs, remove_from_subs
des = """ des = """
@ -64,8 +64,21 @@ async def start_command(_: Client, message: Message):
else: else:
await message.reply(not_found_msg.format(name), quote=True) await message.reply(not_found_msg.format(name), quote=True)
elif data.startswith("info-"): elif data.startswith("info-"):
message.command = ["info", data[5:]] data = data[5:]
await info_command(_, message) v = from_keyword_to_v(data)
if v:
await message.reply(
vtuber_msg.format(
v.name,
v.follower,
v.timeStr,
v.notice,
),
reply_markup=gen_info_button(v),
quote=True,
)
else:
await message.reply(not_found_msg.format(data), quote=True)
else: else:
# 订阅 # 订阅
name = data name = data