summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorJellyBrick <shlee1503@naver.com>2018-05-28 02:27:25 +0900
committerJellyBrick <shlee1503@naver.com>2018-05-28 02:27:25 +0900
commitb0134ff90ccd4203721fd8d32c1d1bacaea8b47f (patch)
treea0fc5b5bfd08e9396409cb908818fd79eceec6f2 /src
parent6d365b8b555e7d1f6b32ba8b87bea8a593021cc2 (diff)
Bot API 3.4 update
Diffstat (limited to 'src')
-rw-r--r--src/Api.cpp54
-rw-r--r--src/TgTypeParser.cpp1
2 files changed, 54 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));
diff --git a/src/TgTypeParser.cpp b/src/TgTypeParser.cpp
index 46760fc..702bc71 100644
--- a/src/TgTypeParser.cpp
+++ b/src/TgTypeParser.cpp
@@ -139,6 +139,7 @@ Message::Ptr TgTypeParser::parseJsonAndGetMessage(const ptree& data) const {
result->authorSignature = data.get("author_signature", "");
result->text = data.get("text", "");
result->entities = parseJsonAndGetArray<MessageEntity>(&TgTypeParser::parseJsonAndGetEntity, data, "entities");
+ result->captionEntities = parseJsonAndGetArray<MessageEntity>(&TgTypeParser::parseJsonAndGetEntity, data, "caption_entities");
result->audio = tryParseJson<Audio>(&TgTypeParser::parseJsonAndGetAudio, data, "audio");
result->document = tryParseJson<Document>(&TgTypeParser::parseJsonAndGetDocument, data, "document");
result->photo = parseJsonAndGetArray<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "photo");