summaryrefslogtreecommitdiff
path: root/include/tgbot
diff options
context:
space:
mode:
Diffstat (limited to 'include/tgbot')
-rw-r--r--include/tgbot/Api.h5
-rw-r--r--include/tgbot/TgTypeParser.h22
-rw-r--r--include/tgbot/types/Voice.h6
3 files changed, 27 insertions, 6 deletions
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h
index 84a6c9b..ec9edf8 100644
--- a/include/tgbot/Api.h
+++ b/include/tgbot/Api.h
@@ -251,13 +251,12 @@ public:
* @brief Use this method to add a new sticker to a set created by the bot.
* @param userId User identifier of created sticker set owner.
* @param name Sticker set name.
- * @param title Sticker set title, 1-64 characters.
* @param pngSticker Png image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px.
* @param emojis One or more emoji corresponding to the sticker.
* @param maskPosition Optional. A JSON-serialized object for position where the mask should be placed on faces.
* @return Returns True on success.
*/
- bool addStickerToSet(int32_t userId, const std::string& name, const std::string& title,
+ bool addStickerToSet(int32_t userId, const std::string& name,
boost::variant<InputFile::Ptr, std::string> pngSticker, const std::string& emojis, MaskPosition::Ptr maskPosition = nullptr) const;
/**
@@ -273,7 +272,7 @@ public:
* @param stickers File identifier of the sticker.
* @return Returns True on success.
*/
- bool deleteStickerPositionInSet(const std::string& sticker) const;
+ bool deleteStickerFromSet(const std::string& sticker) const;
/**
* @brief Use this method to send video files, Telegram clients support mp4 videos (other formats may be sent as Document).
diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h
index 06e7890..979ba55 100644
--- a/include/tgbot/TgTypeParser.h
+++ b/include/tgbot/TgTypeParser.h
@@ -38,6 +38,7 @@
#include "tgbot/types/StickerSet.h"
#include "tgbot/types/MaskPosition.h"
#include "tgbot/types/Video.h"
+#include "tgbot/types/Voice.h"
#include "tgbot/types/VideoNote.h"
#include "tgbot/types/Contact.h"
#include "tgbot/types/Location.h"
@@ -147,6 +148,9 @@ public:
Video::Ptr parseJsonAndGetVideo(const boost::property_tree::ptree& data) const;
std::string parseVideo(const Video::Ptr& object) const;
+ Voice::Ptr parseJsonAndGetVoice(const boost::property_tree::ptree& data) const;
+ std::string parseVoice(const Voice::Ptr& object) const;
+
VideoNote::Ptr parseJsonAndGetVideoNote(const boost::property_tree::ptree& data) const;
std::string parseVideoNote(const VideoNote::Ptr& object) const;
@@ -464,6 +468,24 @@ private:
json += ',';
}
+ template<typename T>
+ inline void appendToJsonNumber(std::string& json, const std::string& varName, const T& value) const {
+ json += '"';
+ json += varName;
+ json += R"(":)";
+ json += std::to_string(value);
+ json += ',';
+ }
+ inline void appendToJson(std::string &json, const std::string &varName, const int &value) const { appendToJsonNumber(json, varName, value); }
+ inline void appendToJson(std::string &json, const std::string &varName, const long &value) const { appendToJsonNumber(json, varName, value); }
+ inline void appendToJson(std::string &json, const std::string &varName, const long long &value) const { appendToJsonNumber(json, varName, value); }
+ inline void appendToJson(std::string &json, const std::string &varName, const unsigned &value) const { appendToJsonNumber(json, varName, value); }
+ inline void appendToJson(std::string &json, const std::string &varName, const unsigned long &value) const { appendToJsonNumber(json, varName, value); }
+ inline void appendToJson(std::string &json, const std::string &varName, const unsigned long long &value) const { appendToJsonNumber(json, varName, value); }
+ inline void appendToJson(std::string &json, const std::string &varName, const float &value) const { appendToJsonNumber(json, varName, value); }
+ inline void appendToJson(std::string &json, const std::string &varName, const double &value) const { appendToJsonNumber(json, varName, value); }
+ inline void appendToJson(std::string &json, const std::string &varName, const long double &value) const { appendToJsonNumber(json, varName, value); }
+
inline void appendToJson(std::string& json, const std::string& varName, const bool& value) const {
json += '"';
json += varName;
diff --git a/include/tgbot/types/Voice.h b/include/tgbot/types/Voice.h
index 0957349..d1e1198 100644
--- a/include/tgbot/types/Voice.h
+++ b/include/tgbot/types/Voice.h
@@ -22,7 +22,7 @@ public:
/**
* @brief Unique identifier for this file.
*/
- std::string file_id;
+ std::string fileId;
/**
* @brief Duration of the audio in seconds as defined by sender.
@@ -32,12 +32,12 @@ public:
/**
* @brief Optional. MIME type of the file as defined by sender;
*/
- std::string mime_type;
+ std::string mimeType;
/**
* @brief Optional. File size.
*/
- int32_t file_size;
+ int32_t fileSize;
};
}