iShotaBot/modules/guess.py

28 lines
975 B
Python
Raw Normal View History

2022-07-25 10:17:37 +00:00
from pyrogram import Client, filters
from pyrogram.types import Message
from defs.guess import guess_str
from init import user_me
2022-10-02 15:14:06 +00:00
@Client.on_message(filters.incoming &
2022-07-25 10:17:37 +00:00
filters.command(["guess", f"guess@{user_me.username}"]))
async def guess_command(_: Client, message: Message):
msg = await message.reply('正在查询中...')
if str(message.text.split()) == 1:
text = await guess_str(message.reply_to_message.text)
if text == '':
text = '没有匹配到拼音首字母缩写'
await msg.edit(text)
else:
rep_text = ''
if reply := message.reply_to_message:
2022-07-25 10:19:10 +00:00
rep_text += await guess_str(reply.text)
text = await guess_str(message.text[7:])
2022-07-25 10:17:37 +00:00
if not rep_text and not text:
await msg.edit('没有匹配到拼音首字母缩写')
elif not rep_text:
await msg.edit(f'{text}')
else:
await msg.edit(f'{rep_text}{text}')