mirror of
https://github.com/Mayuri-Chan/pyrofork.git
synced 2026-01-03 14:04:51 +00:00
Store the "me" user object
This commit is contained in:
parent
6a766faf2f
commit
d71db29a8c
3 changed files with 4 additions and 4 deletions
|
|
@ -270,8 +270,7 @@ class Client(Methods):
|
||||||
|
|
||||||
self.disconnect_handler = None
|
self.disconnect_handler = None
|
||||||
|
|
||||||
# Username used for mentioned bot commands, e.g.: /start@usernamebot
|
self.me: Optional[User] = None
|
||||||
self.username = None
|
|
||||||
|
|
||||||
self.message_cache = Cache(10000)
|
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+)")
|
command_re = re.compile(r"([\"'])(.*?)(?<!\\)\1|(\S+)")
|
||||||
|
|
||||||
async def func(flt, client: pyrogram.Client, message: Message):
|
async def func(flt, client: pyrogram.Client, message: Message):
|
||||||
username = client.username or ""
|
username = client.me.username or ""
|
||||||
text = message.text or message.caption
|
text = message.text or message.caption
|
||||||
message.command = None
|
message.command = None
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -46,5 +46,6 @@ class Initialize:
|
||||||
|
|
||||||
await self.dispatcher.start()
|
await self.dispatcher.start()
|
||||||
|
|
||||||
self.username = (await self.get_me()).username
|
self.me = await self.get_me()
|
||||||
|
|
||||||
self.is_initialized = True
|
self.is_initialized = True
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue