Now using find_user()

This commit is contained in:
Profitroll 2023-01-04 13:15:08 +01:00
parent 1268c33830
commit 8cb3ef283b

View File

@ -6,7 +6,7 @@ from pyrogram.client import Client
from pyrogram.errors import bad_request_400 from pyrogram.errors import bad_request_400
from pyrogram.enums.chat_action import ChatAction from pyrogram.enums.chat_action import ChatAction
from classes.holo_user import HoloUser, UserNotFoundError, UserInvalidError from classes.holo_user import HoloUser, UserNotFoundError, UserInvalidError
from modules.utils import jsonLoad, should_quote, logWrite, locale, download_tmp, create_tmp from modules.utils import jsonLoad, should_quote, logWrite, locale, download_tmp, create_tmp, find_user
from modules import custom_filters from modules import custom_filters
@app.on_message((custom_filters.enabled_applications | custom_filters.enabled_sponsorships) & ~filters.scheduled & filters.command("identify", prefixes=["/"]) & custom_filters.admin) @app.on_message((custom_filters.enabled_applications | custom_filters.enabled_sponsorships) & ~filters.scheduled & filters.command("identify", prefixes=["/"]) & custom_filters.admin)
@ -20,8 +20,8 @@ async def command_identify(app: Client, msg: Message):
try: try:
holo_user = HoloUser(int(msg.command[1])) holo_user = HoloUser(int(msg.command[1]))
except ValueError: except ValueError:
holo_user = HoloUser(await app.get_users(msg.command[1])) holo_user = HoloUser(await find_user(app, msg.command[1]))
except (UserInvalidError, UserNotFoundError, bad_request_400.UsernameInvalid, bad_request_400.PeerIdInvalid, bad_request_400.UsernameNotOccupied): except (UserInvalidError, UserNotFoundError, bad_request_400.UsernameInvalid, bad_request_400.PeerIdInvalid, bad_request_400.UsernameNotOccupied, TypeError):
await msg.reply_text(locale("identify_not_found", "message", locale=msg.from_user).format(msg.command[1])) await msg.reply_text(locale("identify_not_found", "message", locale=msg.from_user).format(msg.command[1]))
return return