From d5c1431398beddd2dec9a44f270e00c3792f372f Mon Sep 17 00:00:00 2001 From: AEIMS <66196824+aeims@users.noreply.github.com> Date: Sun, 4 May 2025 19:13:49 +0330 Subject: [PATCH] adding open_url argument for Message.Button Class adding necessary changes so it works with changes made in telethon.tl.Message.Button open_url is a bool arg defualt to None (False) so clicking a url inline button will actually return the URL for further proccessing in code instead of returning True and opening it in browser. (sorry for two pull requests I didn't notice patch numbers) --- telethon/tl/custom/message.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/telethon/tl/custom/message.py b/telethon/tl/custom/message.py index 2c572f3e..1e94a1f0 100644 --- a/telethon/tl/custom/message.py +++ b/telethon/tl/custom/message.py @@ -871,7 +871,7 @@ class Message(ChatGetter, SenderGetter, TLObject): async def click(self, i=None, j=None, *, text=None, filter=None, data=None, share_phone=None, - share_geo=None, password=None): + share_geo=None, password=None, open_url=None): """ Calls :tl:`SendVote` with the specified poll option or `button.click ` @@ -985,7 +985,7 @@ class Message(ChatGetter, SenderGetter, TLObject): but = types.KeyboardButtonCallback('', data) return await MessageButton(self._client, but, chat, None, self.id).click( - share_phone=share_phone, share_geo=share_geo, password=password) + share_phone=share_phone, share_geo=share_geo, password=password, open_url=open_url) if sum(int(x is not None) for x in (i, text, filter)) >= 2: raise ValueError('You can only set either of i, text or filter') @@ -1058,7 +1058,7 @@ class Message(ChatGetter, SenderGetter, TLObject): button = find_button() if button: return await button.click( - share_phone=share_phone, share_geo=share_geo, password=password) + share_phone=share_phone, share_geo=share_geo, password=password, open_url=open_url) async def mark_read(self): """