mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-10 19:46:36 +03:00
Conditional webbrowser import (#4261)
This commit is contained in:
parent
cf3bc71e1d
commit
584735afe1
|
@ -1,7 +1,11 @@
|
||||||
from .. import types, functions
|
from .. import types, functions
|
||||||
from ... import password as pwd_mod
|
from ... import password as pwd_mod
|
||||||
from ...errors import BotResponseTimeoutError
|
from ...errors import BotResponseTimeoutError
|
||||||
import webbrowser
|
try:
|
||||||
|
import webbrowser
|
||||||
|
except ModuleNotFoundError:
|
||||||
|
pass
|
||||||
|
import sys
|
||||||
import os
|
import os
|
||||||
|
|
||||||
|
|
||||||
|
@ -112,6 +116,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, types.KeyboardButtonUrl):
|
elif isinstance(self.button, types.KeyboardButtonUrl):
|
||||||
|
if "webbrowser" in sys.modules:
|
||||||
return webbrowser.open(self.button.url)
|
return webbrowser.open(self.button.url)
|
||||||
elif isinstance(self.button, types.KeyboardButtonGame):
|
elif isinstance(self.button, types.KeyboardButtonGame):
|
||||||
req = functions.messages.GetBotCallbackAnswerRequest(
|
req = functions.messages.GetBotCallbackAnswerRequest(
|
||||||
|
|
Loading…
Reference in New Issue
Block a user