Store the "me" user object

This commit is contained in:
Dan 2022-06-20 10:28:49 +02:00
parent 6a766faf2f
commit d71db29a8c
3 changed files with 4 additions and 4 deletions

View File

@ -270,8 +270,7 @@ class Client(Methods):
self.disconnect_handler = None
# Username used for mentioned bot commands, e.g.: /start@usernamebot
self.username = None
self.me: Optional[User] = None
self.message_cache = Cache(10000)

View File

@ -757,7 +757,7 @@ def command(commands: Union[str, List[str]], prefixes: Union[str, List[str]] = "
command_re = re.compile(r"([\"'])(.*?)(?<!\\)\1|(\S+)")
async def func(flt, client: pyrogram.Client, message: Message):
username = client.username or ""
username = client.me.username or ""
text = message.text or message.caption
message.command = None

View File

@ -46,5 +46,6 @@ class Initialize:
await self.dispatcher.start()
self.username = (await self.get_me()).username
self.me = await self.get_me()
self.is_initialized = True