User search improved

This commit is contained in:
Profitroll 2023-01-05 20:47:02 +01:00
parent 59dafc004d
commit b6d45545fc

View File

@ -2,8 +2,8 @@ from app import app
from pyrogram import filters from pyrogram import filters
from pyrogram.types import Message from pyrogram.types import Message
from pyrogram.client import Client from pyrogram.client import Client
from classes.holo_user import HoloUser from classes.holo_user import HoloUser, UserInvalidError
from modules.utils import logWrite, locale, should_quote from modules.utils import logWrite, locale, should_quote, find_user
from modules import custom_filters from modules import custom_filters
# Message command ============================================================================================================== # Message command ==============================================================================================================
@ -14,8 +14,8 @@ async def cmd_message(app: Client, msg: Message):
try: try:
destination = HoloUser(int(msg.command[1])) destination = HoloUser(int(msg.command[1]))
except ValueError: except (ValueError, UserInvalidError):
destination = HoloUser(msg.command[1]) destination = HoloUser(await find_user(app, query=msg.command[1]))
if ((msg.text is not None) and (len(msg.text.split()) > 2)): 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) 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)