User search improved

This commit is contained in:
Profitroll 2023-01-05 20:47:02 +01:00
parent 59dafc004d
commit b6d45545fc
1 changed files with 4 additions and 4 deletions

View File

@ -2,8 +2,8 @@ from app import app
from pyrogram import filters
from pyrogram.types import Message
from pyrogram.client import Client
from classes.holo_user import HoloUser
from modules.utils import logWrite, locale, should_quote
from classes.holo_user import HoloUser, UserInvalidError
from modules.utils import logWrite, locale, should_quote, find_user
from modules import custom_filters
# Message command ==============================================================================================================
@ -14,8 +14,8 @@ async def cmd_message(app: Client, msg: Message):
try:
destination = HoloUser(int(msg.command[1]))
except ValueError:
destination = HoloUser(msg.command[1])
except (ValueError, UserInvalidError):
destination = HoloUser(await find_user(app, query=msg.command[1]))
if ((msg.text is not None) and (len(msg.text.split()) > 2)):
await destination.message(context=msg, text=" ".join(msg.text.split()[2:]), caption=msg.caption, photo=msg.photo, video=msg.video, file=msg.document, adm_context=True)