From c99bb166196d845ff1d67b1af0114eca4b236213 Mon Sep 17 00:00:00 2001 From: Evgeny Petrov Date: Mon, 21 Nov 2016 09:28:32 +0300 Subject: [PATCH] Updated set_game_score MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit • New field `force` • Changed `edit_message` to `disable_edit_message` --- telebot/apihelper.py | 13 ++++++++----- 1 file changed, 8 insertions(+), 5 deletions(-) diff --git a/telebot/apihelper.py b/telebot/apihelper.py index 3306668..c56b081 100644 --- a/telebot/apihelper.py +++ b/telebot/apihelper.py @@ -443,28 +443,31 @@ def send_game(token, chat_id, game_short_name, disable_notification=None, reply_ # https://core.telegram.org/bots/api#setgamescore -def set_game_score(token, user_id, score, chat_id=None, message_id=None, inline_message_id=None, edit_message=None): +def set_game_score(token, user_id, score, force=None, disable_edit_message=None, chat_id=None, message_id=None, inline_message_id=None): """ 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. :param token: Bot's token (you don't need to fill this) :param user_id: User identifier - :param score: New score, must be positive + :param score: New score, must be non-negative + :param force: (Optional) Pass True, if the high score is allowed to decrease. This can be useful when fixing mistakes or banning cheaters + :param disable_edit_message: (Optional) Pass True, if the game message should not be automatically edited to include the current scoreboard :param chat_id: (Optional, required if inline_message_id is not specified) Unique identifier for the target chat (or username of the target channel in the format @channelusername) :param message_id: (Optional, required if inline_message_id is not specified) Unique identifier of the sent message :param inline_message_id: (Optional, required if chat_id and message_id are not specified) Identifier of the inline message - :param edit_message: (Optional) Pass True, if the game message should be automatically edited to include the current scoreboard :return: """ method_url = r'setGameScore' payload = {'user_id': user_id, 'score': score} + if force: + payload['force'] = force if chat_id: payload['chat_id'] = chat_id if message_id: payload['message_id'] = message_id if inline_message_id: payload['inline_message_id'] = inline_message_id - if edit_message: - payload['edit_message'] = edit_message + if disable_edit_message: + payload['disable_edit_message'] = disable_edit_message return _make_request(token, method_url, params=payload)