mirror of
https://github.com/LonamiWebs/Telethon.git
synced 2024-11-21 17:06: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 password as pwd_mod
|
||||
from ...errors import BotResponseTimeoutError
|
||||
import webbrowser
|
||||
try:
|
||||
import webbrowser
|
||||
except ModuleNotFoundError:
|
||||
pass
|
||||
import sys
|
||||
import os
|
||||
|
||||
|
||||
|
@ -112,7 +116,8 @@ class MessageButton:
|
|||
bot=self._bot, peer=self._chat, start_param=self.button.query
|
||||
))
|
||||
elif isinstance(self.button, types.KeyboardButtonUrl):
|
||||
return webbrowser.open(self.button.url)
|
||||
if "webbrowser" in sys.modules:
|
||||
return webbrowser.open(self.button.url)
|
||||
elif isinstance(self.button, types.KeyboardButtonGame):
|
||||
req = functions.messages.GetBotCallbackAnswerRequest(
|
||||
peer=self._chat, msg_id=self._msg_id, game=True
|
||||
|
|
Loading…
Reference in New Issue
Block a user