From 93479a34c0feb1c15d157bdd26244c48713cdaf3 Mon Sep 17 00:00:00 2001 From: xtaodada Date: Fri, 25 Mar 2022 10:47:26 +0800 Subject: [PATCH] Fix a bug --- plugins/info.py | 4 +++- plugins/start.py | 21 +++++++++++++++++---- 2 files changed, 20 insertions(+), 5 deletions(-) diff --git a/plugins/info.py b/plugins/info.py index 9d99cd4..956ba8a 100644 --- a/plugins/info.py +++ b/plugins/info.py @@ -4,7 +4,6 @@ from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton from ci import sqlite, me from defs.source import from_keyword_to_v from defs.utils import Vtuber -from plugins.start import not_found_msg info_help_msg = """ 👩🏻‍💼 » /info space_id|昵称|room_id - 查询模块信息 @@ -23,6 +22,9 @@ vtuber_msg = """ @DD_YTbs_Live_Tracker | @DD_YTbs_Bot """ +not_found_msg = """ +没有找到名为 {} 的 Vtuber! +""" def gen_info_button(data: Vtuber) -> InlineKeyboardMarkup: diff --git a/plugins/start.py b/plugins/start.py index e0d1da7..c76cd13 100644 --- a/plugins/start.py +++ b/plugins/start.py @@ -1,8 +1,8 @@ from pyrogram import Client, filters from pyrogram.types import Message, InlineKeyboardMarkup, InlineKeyboardButton from ci import me -from plugins.info import info_command -from defs.source import from_name_to_v +from plugins.info import vtuber_msg, gen_info_button +from defs.source import from_name_to_v, from_keyword_to_v from defs.subs import add_to_subs, remove_from_subs des = """ @@ -64,8 +64,21 @@ async def start_command(_: Client, message: Message): else: await message.reply(not_found_msg.format(name), quote=True) elif data.startswith("info-"): - message.command = ["info", data[5:]] - await info_command(_, message) + data = data[5:] + 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: # 订阅 name = data