diff options
author | JellyBrick <shlee1503@naver.com> | 2018-05-28 02:27:25 +0900 |
---|---|---|
committer | JellyBrick <shlee1503@naver.com> | 2018-05-28 02:27:25 +0900 |
commit | b0134ff90ccd4203721fd8d32c1d1bacaea8b47f (patch) | |
tree | a0fc5b5bfd08e9396409cb908818fd79eceec6f2 /src/Api.cpp | |
parent | 6d365b8b555e7d1f6b32ba8b87bea8a593021cc2 (diff) |
Bot API 3.4 update
Diffstat (limited to 'src/Api.cpp')
-rw-r--r-- | src/Api.cpp | 54 |
1 files changed, 53 insertions, 1 deletions
diff --git a/src/Api.cpp b/src/Api.cpp index 91bab0d..cb33058 100644 --- a/src/Api.cpp +++ b/src/Api.cpp @@ -451,11 +451,14 @@ Message::Ptr Api::sendVoice(int64_t chatId, const string& voiceId, const string return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("sendVoice", args)); } -Message::Ptr Api::sendLocation(int64_t chatId, float latitude, float longitude, int32_t replyToMessageId, const GenericReply::Ptr replyMarkup, bool disableNotification) const { +Message::Ptr Api::sendLocation(int64_t chatId, float latitude, float longitude, uint32_t livePeriod, int32_t replyToMessageId, const GenericReply::Ptr replyMarkup, bool disableNotification) const { vector<HttpReqArg> args; args.push_back(HttpReqArg("chat_id", chatId)); args.push_back(HttpReqArg("latitude", latitude)); args.push_back(HttpReqArg("longitude", longitude)); + if (livePeriod) { + args.push_back(HttpReqArg("live_period", livePeriod)); + } if (replyToMessageId) { args.push_back(HttpReqArg("reply_to_message_id", replyToMessageId)); } @@ -468,6 +471,55 @@ Message::Ptr Api::sendLocation(int64_t chatId, float latitude, float longitude, return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("sendLocation", args)); } +Message::Ptr Api::editMessageLiveLocation(float latitude, float longitude, int64_t chatId, int32_t messageId, int32_t inlineMessageId, const InlineKeyboardMarkup::Ptr replyMarkup) const { + vector<HttpReqArg> args; + args.push_back(HttpReqArg("latitude", latitude)); + args.push_back(HttpReqArg("longitude", longitude)); + if (chatId) { + args.push_back(HttpReqArg("chat_id", chatId)); + } + if (messageId) { + args.push_back(HttpReqArg("message_id", messageId)); + } + if (inlineMessageId) { + args.push_back(HttpReqArg("inline_message_id", inlineMessageId)); + } + if (replyMarkup) { + args.push_back(HttpReqArg("reply_markup", TgTypeParser::getInstance().parseInlineKeyboardMarkup(replyMarkup))); + } + return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("editMessageLiveLocation", args)); +} + +Message::Ptr Api::editMessageLiveLocation(int64_t chatId, int32_t messageId, int32_t inlineMessageId, const InlineKeyboardMarkup::Ptr replyMarkup) const { + vector<HttpReqArg> args; + if (chatId) { + args.push_back(HttpReqArg("chat_id", chatId)); + } + if (messageId) { + args.push_back(HttpReqArg("message_id", messageId)); + } + if (inlineMessageId) { + args.push_back(HttpReqArg("inline_message_id", inlineMessageId)); + } + if (replyMarkup) { + args.push_back(HttpReqArg("reply_markup", TgTypeParser::getInstance().parseInlineKeyboardMarkup(replyMarkup))); + } + return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("editMessageLiveLocation", args)); +} + +bool Api::setChatStickerSet(int64_t chatId, const string& stickerSetName) const { + vector<HttpReqArg> args; + args.push_back(HttpReqArg("chat_id", chatId)); + args.push_back(HttpReqArg("sticker_set_name ", stickerSetName)); + return sendRequest("setChatStickerSet", args).get<bool>("", false); +} + +bool Api::deleteChatStickerSet(int64_t chatId) const { + vector<HttpReqArg> args; + args.push_back(HttpReqArg("chat_id", chatId)); + return sendRequest("deleteChatStickerSet", args).get<bool>("", false); +} + Message::Ptr Api::sendVenue(int64_t chatId, float latitude, float longitude, const string& title, const string& address, const string& foursquareId, bool disableNotification, int32_t replyToMessageId, const GenericReply::Ptr replyMarkup) const { vector<HttpReqArg> args; args.push_back(HttpReqArg("chat_id", chatId)); |