Make bot_username optional for LoginUrl (#817)

* make bot username optional

* Update login_url.py

* Update login_url.py

Co-authored-by: Dan <14043624+delivrance@users.noreply.github.com>
This commit is contained in:
Udith Amasura 2021-12-23 22:26:22 +05:30 committed by GitHub
parent 419ecb1af5
commit cc4a850134
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 4 additions and 3 deletions

View File

@ -147,7 +147,7 @@ class InlineKeyboardButton(Object):
if self.login_url is not None:
return self.login_url.write(
text=self.text,
bot=await client.resolve_peer(self.login_url.bot_username)
bot=await client.resolve_peer(self.login_url.bot_username or "self")
)
if self.switch_inline_query is not None:

View File

@ -31,7 +31,8 @@ class LoginUrl(Object):
url (``str``):
An HTTP URL to be opened with user authorization data added to the query string when the button is pressed.
If the user refuses to provide authorization data, the original URL without information about the user will
be opened. The data added is the same as described in Receiving authorization data.
be opened. The data added is the same as described in
`Receiving authorization data <https://core.telegram.org/widgets/login#receiving-authorization-data>`.
**NOTE**: You **must** always check the hash of the received data to verify the authentication and the
integrity of the data as described in
@ -42,7 +43,7 @@ class LoginUrl(Object):
bot_username (``str``, *optional*):
Username of a bot, which will be used for user authorization.
See `Setting up <https://core.telegram.org/widgets/login#setting-up-a-bot>`_ a bot for more details.
See `Setting up a bot <https://core.telegram.org/widgets/login#setting-up-a-bot>`_ for more details.
If not specified, the current bot's username will be assumed. The url's domain must be the same as the
domain linked with the bot.
See `Linking your domain to the bot <https://core.telegram.org/widgets/login#linking-your-domain-to-the-bot>`_