mirror of
https://github.com/TeamPGM/pyrogram.git
synced 2024-11-16 12:51:18 +00:00
Store the "me" user object
This commit is contained in:
parent
6a766faf2f
commit
d71db29a8c
@ -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)
|
||||
|
||||
|
@ -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
|
||||
|
||||
|
@ -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
|
||||
|
Loading…
Reference in New Issue
Block a user