From 2fa3f68d6165b634af0312a631bb89f55623ddec Mon Sep 17 00:00:00 2001 From: Jishnu Mohan Date: Sat, 22 Oct 2016 16:01:34 +0530 Subject: [PATCH] adding getGameHighScores --- README.md | 14 ++++++++++++++ src/telegram.js | 12 ++++++++++++ 2 files changed, 26 insertions(+) diff --git a/README.md b/README.md index 06f7c7d..a0e042a 100644 --- a/README.md +++ b/README.md @@ -95,6 +95,7 @@ TelegramBot * [.leaveChat(chatId)](#TelegramBot+leaveChat) ⇒ Promise * [.sendGame(chatId, gameShortName, [options])](#TelegramBot+sendGame) ⇒ Promise * [.setGameScore(userId, score, [options])](#TelegramBot+setGameScore) ⇒ Promise + * [.getGameHighScores(userId, [options])](#TelegramBot+getGameHighScores) ⇒ Promise @@ -616,4 +617,17 @@ Use this method to set the score of the specified user in a game. | score | Number | New score value. | | [options] | Object | Additional Telegram query options | + + +### telegramBot.getGameHighScores(userId, [options]) ⇒ Promise +Use this method to get data for high score table. + +**Kind**: instance method of [TelegramBot](#TelegramBot) +**See**: https://core.telegram.org/bots/api#getgamehighscores + +| Param | Type | Description | +| --- | --- | --- | +| userId | String | Unique identifier of the target user | +| [options] | Object | Additional Telegram query options | + * * * diff --git a/src/telegram.js b/src/telegram.js index 653cb0d..8888fd8 100644 --- a/src/telegram.js +++ b/src/telegram.js @@ -847,6 +847,18 @@ class TelegramBot extends EventEmitter { form.score = score; return this._request('setGameScore', { form }); } + + /** + * Use this method to get data for high score table. + * @param {String} userId Unique identifier of the target user + * @param {Object} [options] Additional Telegram query options + * @return {Promise} + * @see https://core.telegram.org/bots/api#getgamehighscores + */ + getGameHighScores(userId, form = {}) { + form.user_id = userId; + return this._request('getGameHighScores', { form }); + } } module.exports = TelegramBot;