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
|
|
|
|
|
|
|
|
|
2023-01-12 13:19:54 +00:00
|
|
|
@Client.on_message(
|
|
|
|
filters.incoming & filters.command(["guess", f"guess@{user_me.username}"])
|
|
|
|
)
|
2022-07-25 10:17:37 +00:00
|
|
|
async def guess_command(_: Client, message: Message):
|
2023-01-12 13:19:54 +00:00
|
|
|
msg = await message.reply("正在查询中...")
|
|
|
|
if len(message.text.split()) == 1:
|
|
|
|
text = ""
|
|
|
|
if reply := message.reply_to_message:
|
|
|
|
text = await guess_str(reply.text)
|
|
|
|
if text == "":
|
|
|
|
text = "没有匹配到拼音首字母缩写"
|
2022-07-25 10:17:37 +00:00
|
|
|
await msg.edit(text)
|
|
|
|
else:
|
2023-01-12 13:19:54 +00:00
|
|
|
rep_text = ""
|
2022-07-25 10:17:37 +00:00
|
|
|
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:
|
2023-01-12 13:19:54 +00:00
|
|
|
await msg.edit("没有匹配到拼音首字母缩写")
|
2022-07-25 10:17:37 +00:00
|
|
|
elif not rep_text:
|
2023-01-12 13:19:54 +00:00
|
|
|
await msg.edit(f"{text}")
|
2022-07-25 10:17:37 +00:00
|
|
|
else:
|
2023-01-12 13:19:54 +00:00
|
|
|
await msg.edit(f"{rep_text}{text}")
|