Lawnmower/plugins/find.py

23 lines
790 B
Python
Raw Permalink Normal View History

2022-04-23 16:18:35 +00:00
from pyrogram import Client, filters
from pyrogram.types import Message
from defs.find import find
from ci import me
@Client.on_message(filters.incoming &
filters.command(["find", f"find@{me.username}"]))
async def find_thing(_: Client, message: Message):
if len(message.command) == 1:
await message.reply_text(
2022-04-30 14:47:55 +00:00
"❌ 请指定要查找的内容"
2022-04-23 16:18:35 +00:00
)
else:
data = find(message.command[1:])
if data:
text = f"关键词 <b>{' '.join(message.command[1:])}</b> 搜索到了:\n"
for i in data:
text += f" - <code>{i.uid}</code> - <b>{i.name}</b>\n"
await message.reply_text(text)
else:
await message.reply_text("此关键词没有搜索到结果。")