summaryrefslogtreecommitdiff
path: root/include/tgbot/Api.h
diff options
context:
space:
mode:
authorJellyBrick <shlee1503@naver.com>2018-05-29 21:55:25 +0900
committerJellyBrick <shlee1503@naver.com>2018-05-29 21:55:25 +0900
commitad8ca77ece2b3185ca546f120dc4f7a13e602aa2 (patch)
tree5e10d871a3223690a23874d29826939dceaff4e5 /include/tgbot/Api.h
parent1107db6e8890774fc55fa43160b0afa442443056 (diff)
Bot API 2.2 (Game) update
Diffstat (limited to 'include/tgbot/Api.h')
-rw-r--r--include/tgbot/Api.h44
1 files changed, 44 insertions, 0 deletions
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h
index f3b4957..cb07aac 100644
--- a/include/tgbot/Api.h
+++ b/include/tgbot/Api.h
@@ -42,6 +42,7 @@
#include "tgbot/types/StickerSet.h"
#include "tgbot/types/File.h"
#include "tgbot/types/InputMedia.h"
+#include "tgbot/types/GameHighScore.h"
namespace TgBot {
@@ -397,6 +398,18 @@ public:
const GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), const std::string& parseMode = "", bool disableNotification = false) const;
/**
+ * @brief Use this method to send a game.
+ * @param chatId Unique identifier for the target chat.
+ * @param gameShortName Short name of the game, serves as the unique identifier for the game. Set up your games via Botfather.
+ * @param replyToMessageId Optional. If the message is a reply, ID of the original message.
+ * @param replyMarkup Optional. A JSON-serialized object for an inline keyboard. If empty, one ‘Play game_title’ button will be shown. If not empty, the first button must launch the game.
+ * @param disableNotification Optional. Sends the message silenty.
+ * @return On success, the sent message is returned.
+ */
+ Message::Ptr sendGame(int64_t chatId, const std::string& gameShortName, int32_t replyToMessageId = 0,
+ const InlineKeyboardMarkup::Ptr replyMarkup = std::make_shared<InlineKeyboardMarkup>(), bool disableNotification = false) const;
+
+ /**
* @brief Use this method to send point on the map.
* @param chatId Unique identifier for the target chat.
* @param latitude Latitude of location.
@@ -770,6 +783,37 @@ public:
*/
bool unpinChatMessage(int64_t chatId) const;
+ /**
+ * @brief Use this method to set the score of the specified user in a game.
+ *
+ * Returns an error, if the new score is not greater than the user's current score in the chat and force is False.
+ *
+ * @param userId User identifier.
+ * @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 disableEditMessage Optional. Pass True, if the game message should not be automatically edited to include the current scoreboard.
+ * @param chatId Optional. Required if inlineMessageId is not specified. Unique identifier for the target chat
+ * @param messageId Optional. Required if inlineMessageId is not specified. Identifier of the sent message
+ * @param inlineMessageId Optional. Required if chatId and messageId are not specified. Identifier of the inline message
+ * @return On success, if the message was sent by the bot, returns the edited Message, otherwise returns nullptr.
+ */
+ Message::Ptr setGameScore(int32_t userId, int32_t score, bool force = false, bool disableEditMessage = false,
+ int64_t chatId = 0, int32_t messageId = 0, const std::string& inlineMessageId = "") const;
+
+ /**
+ * @brief Use this method to get data for high score tables.
+ *
+ * Will return the score of the specified user and several of his neighbors in a game.
+ *
+ * @param userId User identifier.
+ * @param chatId Optional. Required if inlineMessageId is not specified. Unique identifier for the target chat
+ * @param messageId Optional. Required if inlineMessageId is not specified. Identifier of the sent message
+ * @param inlineMessageId Optional. Required if chatId and messageId are not specified. Identifier of the inline message
+ * @return On success, returns an Array of GameHighScore objects.
+ */
+ std::vector<GameHighScore::Ptr> getGameHighScores(int32_t userId, int32_t score, bool force = false,
+ bool disableEditMessage = false, int64_t chatId = 0, int32_t messageId = 0, const std::string& inlineMessageId = "") const;
+
/**
* @brief Downloads file from Telegram and saves it in memory.