summaryrefslogtreecommitdiff
path: root/src
diff options
context:
space:
mode:
authorAndrea Giove <andreagiove@outlook.com>2016-04-16 22:38:00 +0200
committerAndrea Giove <andreagiove@outlook.com>2016-04-16 22:38:00 +0200
commit730407e8df5031d19a097be4e3e597f2f3b868fd (patch)
tree610cbc5a27b10c0a2152eaaec0210ff2aec161ee /src
parentabbd611b34ccb5f77c1c28160294f1481c9479c2 (diff)
Added sendVoice method and update sendAudio method
Diffstat (limited to 'src')
-rw-r--r--src/Api.cpp54
1 files changed, 52 insertions, 2 deletions
diff --git a/src/Api.cpp b/src/Api.cpp
index 087b742..3ae582c 100644
--- a/src/Api.cpp
+++ b/src/Api.cpp
@@ -106,13 +106,19 @@ Message::Ptr Api::sendPhoto(int64_t chatId, const string& photoId, const string&
return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("sendPhoto", args));
}
-Message::Ptr Api::sendAudio(int64_t chatId, const InputFile::Ptr& audio, int32_t duration, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const {
+Message::Ptr Api::sendAudio(int64_t chatId, const InputFile::Ptr& audio, int32_t duration, const string& performer, const string& title, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const {
vector<HttpReqArg> args;
args.push_back(HttpReqArg("chat_id", chatId));
args.push_back(HttpReqArg("audio", audio->data, true, audio->mimeType, audio->fileName));
if (duration) {
args.push_back(HttpReqArg("duration", duration));
}
+ if (!performer.empty()){
+ args.push_back(HttpReqArg("performer", performer));
+ }
+ if (!title.empty()){
+ args.push_back(HttpReqArg("title", title));
+ }
if (replyToMessageId) {
args.push_back(HttpReqArg("reply_to_message_id", replyToMessageId));
}
@@ -125,13 +131,19 @@ Message::Ptr Api::sendAudio(int64_t chatId, const InputFile::Ptr& audio, int32_t
return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("sendAudio", args));
}
-Message::Ptr Api::sendAudio(int64_t chatId, const string& audioId, int32_t duration, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const {
+Message::Ptr Api::sendAudio(int64_t chatId, const string& audioId, int32_t duration, const string& performer, const string& title, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const {
vector<HttpReqArg> args;
args.push_back(HttpReqArg("chat_id", chatId));
args.push_back(HttpReqArg("audio", audioId));
if (duration) {
args.push_back(HttpReqArg("duration", duration));
}
+ if (!performer.empty()){
+ args.push_back(HttpReqArg("performer", performer));
+ }
+ if (!title.empty()){
+ args.push_back(HttpReqArg("title", title));
+ }
if (replyToMessageId) {
args.push_back(HttpReqArg("reply_to_message_id", replyToMessageId));
}
@@ -240,6 +252,44 @@ Message::Ptr Api::sendVideo(int64_t chatId, const string& videoId, int32_t reply
return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("sendVideo", args));
}
+Message::Ptr Api::sendVoice(int64_t chatId, const InputFile::Ptr& voice, int duration, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const {
+ vector<HttpReqArg> args;
+ args.push_back(HttpReqArg("chat_id", chatId));
+ args.push_back(HttpReqArg("voice", voice->data, true, voice->mimeType, voice->fileName));
+ if (duration){
+ args.push_back(HttpReqArg("duration", duration));
+ }
+ if (replyToMessageId) {
+ args.push_back(HttpReqArg("reply_to_message_id", replyToMessageId));
+ }
+ if (replyMarkup) {
+ args.push_back(HttpReqArg("reply_markup", TgTypeParser::getInstance().parseGenericReply(replyMarkup)));
+ }
+ if (disableNotification){
+ args.push_back(HttpReqArg("disable_notification", disableNotification));
+ }
+ return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("sendVideo", args));
+}
+
+Message::Ptr Api::sendVoice(int64_t chatId, const std::string& voiceId, int duration, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const {
+ vector<HttpReqArg> args;
+ args.push_back(HttpReqArg("chat_id", chatId));
+ args.push_back(HttpReqArg("voice", voiceId));
+ if (duration){
+ args.push_back(HttpReqArg("duration", duration));
+ }
+ if (replyToMessageId) {
+ args.push_back(HttpReqArg("reply_to_message_id", replyToMessageId));
+ }
+ if (replyMarkup) {
+ args.push_back(HttpReqArg("reply_markup", TgTypeParser::getInstance().parseGenericReply(replyMarkup)));
+ }
+ if (disableNotification){
+ args.push_back(HttpReqArg("disable_notification", disableNotification));
+ }
+ return TgTypeParser::getInstance().parseJsonAndGetMessage(sendRequest("sendVideo", args));
+}
+
Message::Ptr Api::sendLocation(int64_t chatId, float latitude, float longitude, int32_t replyToMessageId, const GenericReply::Ptr& replyMarkup, bool disableNotification) const {
vector<HttpReqArg> args;
args.push_back(HttpReqArg("chat_id", chatId));