Skip to content

Commit b5e27d0

Browse files
committed
Add max_connections and allowed_updates to set_webhook.
1 parent 509fae6 commit b5e27d0

2 files changed

Lines changed: 9 additions & 5 deletions

File tree

‎telebot/__init__.py‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -77,8 +77,8 @@ def __init__(self, token, threaded=True, skip_pending=False):
7777
if self.threaded:
7878
self.worker_pool = util.ThreadPool()
7979

80-
def set_webhook(self, url=None, certificate=None):
81-
return apihelper.set_webhook(self.token, url, certificate)
80+
def set_webhook(self, url=None, certificate=None, max_connections=None, allowed_updates=None):
81+
return apihelper.set_webhook(self.token, url, certificate, max_connections, allowed_updates)
8282

8383
def get_webhook_info(self):
8484
result = apihelper.get_webhook_info(self.token)

‎telebot/apihelper.py‎

Lines changed: 7 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -115,15 +115,18 @@ def send_message(token, chat_id, text, disable_web_page_preview=None, reply_to_m
115115
return _make_request(token, method_url, params=payload, method='post')
116116

117117

118-
def set_webhook(token, url=None, certificate=None):
118+
def set_webhook(token, url=None, certificate=None, max_connections=None, allowed_updates=None):
119119
method_url = r'setWebhook'
120120
payload = {
121121
'url': url if url else "",
122122
}
123123
files = None
124124
if certificate:
125125
files = {'certificate': certificate}
126-
126+
if max_connections:
127+
payload['max_connections'] = max_connections
128+
if allowed_updates:
129+
payload['allowed_updates'] = allowed_updates
127130
return _make_request(token, method_url, params=payload, files=files)
128131

129132

@@ -443,7 +446,8 @@ def send_game(token, chat_id, game_short_name, disable_notification=None, reply_
443446

444447

445448
# https://core.telegram.org/bots/api#setgamescore
446-
def set_game_score(token, user_id, score, force=None, disable_edit_message=None, chat_id=None, message_id=None, inline_message_id=None):
449+
def set_game_score(token, user_id, score, force=None, disable_edit_message=None, chat_id=None, message_id=None,
450+
inline_message_id=None):
447451
"""
448452
Use this method to set the score of the specified user in a game. On success, if the message was sent by the bot, returns the edited Message, otherwise returns True. Returns an error, if the new score is not greater than the user's current score in the chat.
449453
:param token: Bot's token (you don't need to fill this)

0 commit comments

Comments
 (0)