X Tutup
Skip to content

Commit 34c62a6

Browse files
committed
Add url to answerCallbackQuery
1 parent 868d921 commit 34c62a6

File tree

1 file changed

+11
-3
lines changed

1 file changed

+11
-3
lines changed

telegram/bot.py

Lines changed: 11 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -980,7 +980,12 @@ def unbanChatMember(self, chat_id, user_id, **kwargs):
980980
return result
981981

982982
@log
983-
def answerCallbackQuery(self, callback_query_id, text=None, show_alert=False, **kwargs):
983+
def answerCallbackQuery(self,
984+
callback_query_id,
985+
text=None,
986+
show_alert=False,
987+
url=None,
988+
**kwargs):
984989
"""Use this method to send answers to callback queries sent from
985990
inline keyboards. The answer will be displayed to the user as a
986991
notification at the top of the chat screen or as an alert.
@@ -993,6 +998,7 @@ def answerCallbackQuery(self, callback_query_id, text=None, show_alert=False, **
993998
show_alert (Optional[bool]): If `True`, an alert will be shown
994999
by the client instead of a notification at the top of the chat
9951000
screen. Defaults to `False`.
1001+
url (Optional[str]): URL that will be opened by the user's client.
9961002
9971003
Keyword Args:
9981004
timeout (Optional[float]): If this value is specified, use it as
@@ -1010,16 +1016,18 @@ def answerCallbackQuery(self, callback_query_id, text=None, show_alert=False, **
10101016
10111017
"""
10121018

1013-
url = '{0}/answerCallbackQuery'.format(self.base_url)
1019+
url_ = '{0}/answerCallbackQuery'.format(self.base_url)
10141020

10151021
data = {'callback_query_id': callback_query_id}
10161022

10171023
if text:
10181024
data['text'] = text
10191025
if show_alert:
10201026
data['show_alert'] = show_alert
1027+
if url:
1028+
data['show_alert'] = url
10211029

1022-
result = self._request.post(url, data, timeout=kwargs.get('timeout'))
1030+
result = self._request.post(url_, data, timeout=kwargs.get('timeout'))
10231031

10241032
return result
10251033

0 commit comments

Comments
 (0)
X Tutup