2
0
mirror of https://github.com/yagop/node-telegram-bot-api synced 2025-08-28 12:57:38 +00:00

adding getGameHighScores

This commit is contained in:
Jishnu Mohan 2016-10-22 16:01:34 +05:30
parent 00d74d13c8
commit 2fa3f68d61
2 changed files with 26 additions and 0 deletions

View File

@ -95,6 +95,7 @@ TelegramBot
* [.leaveChat(chatId)](#TelegramBot+leaveChat) ⇒ <code>Promise</code>
* [.sendGame(chatId, gameShortName, [options])](#TelegramBot+sendGame) ⇒ <code>Promise</code>
* [.setGameScore(userId, score, [options])](#TelegramBot+setGameScore) ⇒ <code>Promise</code>
* [.getGameHighScores(userId, [options])](#TelegramBot+getGameHighScores) ⇒ <code>Promise</code>
<a name="new_TelegramBot_new"></a>
@ -616,4 +617,17 @@ Use this method to set the score of the specified user in a game.
| score | <code>Number</code> | New score value. |
| [options] | <code>Object</code> | Additional Telegram query options |
<a name="TelegramBot+getGameHighScores"></a>
### telegramBot.getGameHighScores(userId, [options]) ⇒ <code>Promise</code>
Use this method to get data for high score table.
**Kind**: instance method of <code>[TelegramBot](#TelegramBot)</code>
**See**: https://core.telegram.org/bots/api#getgamehighscores
| Param | Type | Description |
| --- | --- | --- |
| userId | <code>String</code> | Unique identifier of the target user |
| [options] | <code>Object</code> | Additional Telegram query options |
* * *

View File

@ -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;