Stop opening webbrowser on clicking URL buttons

This commit is contained in:
Lonami Exo 2022-01-09 12:23:06 +01:00
parent 232e76e73a
commit 721c803af9
2 changed files with 7 additions and 1 deletions

View File

@ -701,6 +701,12 @@ CdnDecrypter has been removed
It was not really working and was more intended to be an implementation detail than anything else. It was not really working and was more intended to be an implementation detail than anything else.
URL buttons no longer open the web-browser
------------------------------------------
Now the URL is returned. You can still use ``webbrowser.open`` to get the old behaviour.
--- ---
you can no longer pass an attributes list because the constructor is now nice. you can no longer pass an attributes list because the constructor is now nice.

View File

@ -112,7 +112,7 @@ class MessageButton:
bot=self._bot, peer=self._chat, start_param=self.button.query bot=self._bot, peer=self._chat, start_param=self.button.query
)) ))
elif isinstance(self.button, _tl.KeyboardButtonUrl): elif isinstance(self.button, _tl.KeyboardButtonUrl):
return webbrowser.open(self.button.url) return self.button.url
elif isinstance(self.button, _tl.KeyboardButtonGame): elif isinstance(self.button, _tl.KeyboardButtonGame):
req = _tl.fn.messages.GetBotCallbackAnswer( req = _tl.fn.messages.GetBotCallbackAnswer(
peer=self._chat, msg_id=self._msg_id, game=True peer=self._chat, msg_id=self._msg_id, game=True