summaryrefslogtreecommitdiff
path: root/src/Api.cpp
diff options
context:
space:
mode:
authorJellyBrick <shlee1503@naver.com>2018-07-27 17:40:44 +0900
committerJellyBrick <shlee1503@naver.com>2018-07-27 17:40:44 +0900
commit941c97706cb5b81d5a2e44a827e8f6bf76a2c6bd (patch)
treeba87716d560a674d338c5d43f319b749ff4f46c4 /src/Api.cpp
parent6c2dc4d2eb84e7ba98f73332ccf95ffa5a7adf3f (diff)
Bot API 4.0 - Part 2
Diffstat (limited to 'src/Api.cpp')
-rw-r--r--src/Api.cpp28
1 files changed, 27 insertions, 1 deletions
diff --git a/src/Api.cpp b/src/Api.cpp
index 85ba050..bd141d7 100644
--- a/src/Api.cpp
+++ b/src/Api.cpp
@@ -753,7 +753,7 @@ bool Api::deleteChatStickerSet(int64_t chatId) const {
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 {
+Message::Ptr Api::sendVenue(int64_t chatId, float latitude, float longitude, const string& title, const string& address, const string& foursquareId, const string& foursquareType, bool disableNotification, int32_t replyToMessageId, const GenericReply::Ptr replyMarkup) const {
vector<HttpReqArg> args;
args.reserve(10);
args.emplace_back("chat_id", chatId);
@@ -962,6 +962,32 @@ Message::Ptr Api::editMessageReplyMarkup(int64_t chatId, int32_t messageId, cons
}
}
+Message::Ptr Message::Ptr editMessageMedia(InputMedia::Ptr media, int64_t chatId, int32_t messageId, const std::string& inlineMessageId,
+ GenericReply::Ptr replyMarkup) const {
+
+ vector<HttpReqArg> args;
+ args.reserve(5);
+ args.emplace_back("media", _tgTypeParser.parseInputMedia(media));
+ if (chatId) {
+ args.emplace_back("chat_id", chatId);
+ }
+ if (messageId) {
+ args.emplace_back("message_id", messageId);
+ }
+ if (!inlineMessageId.empty()) {
+ args.emplace_back("inline_message_id", inlineMessageId);
+ }
+ if (replyMarkup) {
+ args.emplace_back("reply_markup", _tgTypeParser.parseGenericReply(replyMarkup));
+ }
+ ptree p = sendRequest("editMessageCaption", args);
+ if (p.get_child_optional("message_id")) {
+ return _tgTypeParser.parseJsonAndGetMessage(p);
+ } else {
+ return nullptr;
+ }
+}
+
ChatMember::Ptr Api::getChatMember(int64_t chatId, int32_t userId) const {
vector<HttpReqArg> args;
args.reserve(2);