Skip to content

Commit cc4a850

Browse files
uaudithdelivrance
andauthored
Make bot_username optional for LoginUrl (pyrogram#817)
* make bot username optional * Update login_url.py * Update login_url.py Co-authored-by: Dan <14043624+delivrance@users.noreply.github.com>
1 parent 419ecb1 commit cc4a850

File tree

2 files changed

+4
-3
lines changed

2 files changed

+4
-3
lines changed

pyrogram/types/bots_and_keyboards/inline_keyboard_button.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -147,7 +147,7 @@ async def write(self, client: "pyrogram.Client"):
147147
if self.login_url is not None:
148148
return self.login_url.write(
149149
text=self.text,
150-
bot=await client.resolve_peer(self.login_url.bot_username)
150+
bot=await client.resolve_peer(self.login_url.bot_username or "self")
151151
)
152152

153153
if self.switch_inline_query is not None:

pyrogram/types/bots_and_keyboards/login_url.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,8 @@ class LoginUrl(Object):
3131
url (``str``):
3232
An HTTP URL to be opened with user authorization data added to the query string when the button is pressed.
3333
If the user refuses to provide authorization data, the original URL without information about the user will
34-
be opened. The data added is the same as described in Receiving authorization data.
34+
be opened. The data added is the same as described in
35+
`Receiving authorization data <https://core.telegram.org/widgets/login#receiving-authorization-data>`.
3536
3637
**NOTE**: You **must** always check the hash of the received data to verify the authentication and the
3738
integrity of the data as described in
@@ -42,7 +43,7 @@ class LoginUrl(Object):
4243
4344
bot_username (``str``, *optional*):
4445
Username of a bot, which will be used for user authorization.
45-
See `Setting up <https://core.telegram.org/widgets/login#setting-up-a-bot>`_ a bot for more details.
46+
See `Setting up a bot <https://core.telegram.org/widgets/login#setting-up-a-bot>`_ for more details.
4647
If not specified, the current bot's username will be assumed. The url's domain must be the same as the
4748
domain linked with the bot.
4849
See `Linking your domain to the bot <https://core.telegram.org/widgets/login#linking-your-domain-to-the-bot>`_

0 commit comments

Comments
 (0)