diff options
author | llnulldisk <48621230+llnulldisk@users.noreply.github.com> | 2022-09-11 15:13:51 +0200 |
---|---|---|
committer | llnulldisk <48621230+llnulldisk@users.noreply.github.com> | 2022-09-11 15:13:51 +0200 |
commit | 270612dc36df84fe25d7fa5e59ca20647b1e5da9 (patch) | |
tree | a9e6b8b9d653baea4e86d366e38e09f9038a4eda /include | |
parent | 0c3b44cead20fb421bdacaba7613348f7573b282 (diff) |
Update to API 6.2
Diffstat (limited to 'include')
-rw-r--r-- | include/tgbot/Api.h | 17 | ||||
-rw-r--r-- | include/tgbot/TgTypeParser.h | 2 | ||||
-rw-r--r-- | include/tgbot/types/Chat.h | 6 | ||||
-rw-r--r-- | include/tgbot/types/MessageEntity.h | 123 | ||||
-rw-r--r-- | include/tgbot/types/Sticker.h | 20 | ||||
-rw-r--r-- | include/tgbot/types/StickerSet.h | 17 |
6 files changed, 118 insertions, 67 deletions
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h index a3f4b37..78fb4fa 100644 --- a/include/tgbot/Api.h +++ b/include/tgbot/Api.h @@ -1253,6 +1253,15 @@ public: StickerSet::Ptr getStickerSet(const std::string& name) const; /** + * @brief Use this method to get information about custom emoji stickers by their identifiers. + * + * @param customEmojiIds List of custom emoji identifiers. At most 200 custom emoji identifiers can be specified. + * + * @return Returns an Array of Sticker objects. + */ + std::vector<Sticker::Ptr> getCustomEmojiStickers(const std::vector<std::string>& customEmojiIds) const; + + /** * @brief Use this method to upload a .png file with a sticker for later use in createNewStickerSet and addStickerToSet methods (can be used multiple times). * @param userId User identifier of sticker file owner. * @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. @@ -1267,14 +1276,14 @@ public: * You must use exactly one of the fields pngSticker, tgsSticker, or webmSticker. * * @param userId User identifier of created sticker set owner - * @param name Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only english letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in “_by_<bot username>”. <bot_username> is case insensitive. 1-64 characters. + * @param name Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only English letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in "_by_<bot_username>". <bot_username> is case insensitive. 1-64 characters. * @param title Sticker set title, 1-64 characters * @param emojis One or more emoji corresponding to the sticker - * @param containsMasks Optional. Pass True, if a set of mask stickers should be created * @param maskPosition Optional. A JSON-serialized object for position where the mask should be placed on faces * @param pngSticker Optional. 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. Pass a fileId as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. https://core.telegram.org/bots/api#sending-files * @param tgsSticker Optional. TGS animation with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/stickers#animated-sticker-requirements for technical requirements * @param webmSticker Optional. WEBM video with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/stickers#video-sticker-requirements for technical requirements + * @param stickerType Optional. Type of stickers in the set, pass “regular” or “mask”. Custom emoji sticker sets can't be created via the Bot API at the moment. By default, a regular sticker set is created. * * @return Returns True on success. */ @@ -1282,11 +1291,11 @@ public: const std::string& name, const std::string& title, const std::string& emojis, - bool containsMasks = false, MaskPosition::Ptr maskPosition = nullptr, boost::variant<InputFile::Ptr, const std::string&> pngSticker = "", InputFile::Ptr tgsSticker = nullptr, - InputFile::Ptr webmSticker = nullptr) const; + InputFile::Ptr webmSticker = nullptr, + const std::string& stickerType = "") const; /** * @brief Use this method to add a new sticker to a set created by the bot. diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h index db29f3d..cef1b60 100644 --- a/include/tgbot/TgTypeParser.h +++ b/include/tgbot/TgTypeParser.h @@ -727,10 +727,8 @@ private: } } - void appendToJson(std::string& json, const std::string& varName, const std::string& value) const; }; - } #endif //TGBOT_TGTYPEPARSER_H diff --git a/include/tgbot/types/Chat.h b/include/tgbot/types/Chat.h index 931427e..4a3f761 100644 --- a/include/tgbot/types/Chat.h +++ b/include/tgbot/types/Chat.h @@ -82,6 +82,12 @@ public: bool hasPrivateForwards; /** + * @brief Optional. True, if the privacy settings of the other party restrict sending voice and video note messages in the private chat. + * Returned only in Api::getChat. + */ + bool hasRestrictedVoiceAndVideoMessages; + + /** * @brief Optional. True, if users need to join the supergroup before they can send messages. * Returned only in Api::getChat. */ diff --git a/include/tgbot/types/MessageEntity.h b/include/tgbot/types/MessageEntity.h index d1384e7..960e1a7 100644 --- a/include/tgbot/types/MessageEntity.h +++ b/include/tgbot/types/MessageEntity.h @@ -1,55 +1,68 @@ -#ifndef TGBOT_MESSAGEENTITY_H
-#define TGBOT_MESSAGEENTITY_H
-
-#include "tgbot/types/User.h"
-
-#include <cstdint>
-#include <memory>
-#include <string>
-
-namespace TgBot {
-
-/**
- * @brief This object represents one special entity in a text message.
- * For example, hashtags, usernames, URLs, etc.
- *
- * @ingroup types
- */
-class MessageEntity {
-public:
- typedef std::shared_ptr<MessageEntity> Ptr;
-
- /**
- * @brief Type of the entity.
- * Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames)
- */
- std::string type;
-
- /**
- * @brief Offset in UTF-16 code units to the start of the entity
- */
- std::int32_t offset;
-
- /**
- * @brief Length of the entity in UTF-16 code units
- */
- std::int32_t length;
-
- /**
- * @brief Optional. For “text_link” only, url that will be opened after user taps on the text
- */
- std::string url;
-
- /**
- * @brief Optional. For “text_mention” only, the mentioned user
- */
- User::Ptr user;
-
- /**
- * @brief Optional. For “pre” only, the programming language of the entity text
- */
- std::string language;
-};
-}
-
-#endif //TGBOT_MESSAGEENTITY_H
+#ifndef TGBOT_MESSAGEENTITY_H +#define TGBOT_MESSAGEENTITY_H + +#include "tgbot/types/User.h" + +#include <cstdint> +#include <memory> +#include <string> + +namespace TgBot { + +/** + * @brief This object represents one special entity in a text message. + * For example, hashtags, usernames, URLs, etc. + * + * @ingroup types + */ +class MessageEntity { +public: + typedef std::shared_ptr<MessageEntity> Ptr; + + /** + * @brief Enum of possible types. + */ + enum class Type { + Mention, Hashtag, Cashtag, BotCommand, Url, Email, PhoneNumber, Bold, Italic, Underline, Strikethrough, Spoiler, Code, Pre, TextLink, TextMention, CustomEmoji + }; + + /** + * @brief Type of the entity. + * Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers) + */ + Type type; + + /** + * @brief Offset in UTF-16 code units to the start of the entity + */ + std::int32_t offset; + + /** + * @brief Length of the entity in UTF-16 code units + */ + std::int32_t length; + + /** + * @brief Optional. For “text_link” only, URL that will be opened after user taps on the text + */ + std::string url; + + /** + * @brief Optional. For “text_mention” only, the mentioned user + */ + User::Ptr user; + + /** + * @brief Optional. For “pre” only, the programming language of the entity text + */ + std::string language; + + /** + * @brief Optional. For “custom_emoji” only, unique identifier of the custom emoji. + * Use Api::getCustomEmojiStickers to get full information about the sticker + */ + std::string customEmojiId; +}; +} + +#endif //TGBOT_MESSAGEENTITY_H diff --git a/include/tgbot/types/Sticker.h b/include/tgbot/types/Sticker.h index 0d14ba4..7ec0140 100644 --- a/include/tgbot/types/Sticker.h +++ b/include/tgbot/types/Sticker.h @@ -22,6 +22,13 @@ public: typedef std::shared_ptr<Sticker> Ptr; /** + * @brief Enum of possible types of a sticker. + */ + enum class Type { + Regular, Mask, CustomEmoji + }; + + /** * @brief Identifier for this file, which can be used to download or reuse the file */ std::string fileId; @@ -33,6 +40,12 @@ public: std::string fileUniqueId; /** + * @brief Type of the sticker, currently one of “regular”, “mask”, “custom_emoji”. + * The type of the sticker is independent from its format, which is determined by the fields isAnimated and isVideo. + */ + Type type; + + /** * @brief Sticker width */ std::int32_t width; @@ -68,7 +81,7 @@ public: std::string setName; /** - * @brief Optional. Premium animation for the sticker, if the sticker is premium + * @brief Optional. For premium regular stickers, premium animation for the sticker */ File::Ptr premiumAnimation; @@ -78,6 +91,11 @@ public: MaskPosition::Ptr maskPosition; /** + * @brief Optional. For custom emoji stickers, unique identifier of the custom emoji + */ + std::string customEmojiId; + + /** * @brief Optional. File size in bytes */ std::int32_t fileSize; diff --git a/include/tgbot/types/StickerSet.h b/include/tgbot/types/StickerSet.h index 0ef940f..006b1d1 100644 --- a/include/tgbot/types/StickerSet.h +++ b/include/tgbot/types/StickerSet.h @@ -20,6 +20,13 @@ public: typedef std::shared_ptr<StickerSet> Ptr; /** + * @brief Enum of possible types of a sticker. + */ + enum class Type { + Regular, Mask, CustomEmoji + }; + + /** * @brief Sticker set name */ std::string name; @@ -30,6 +37,11 @@ public: std::string title; /** + * @brief Type of stickers in the set, currently one of “regular”, “mask”, “custom_emoji” + */ + Type type; + + /** * @brief True, if the sticker set contains animated stickers */ bool isAnimated; @@ -40,11 +52,6 @@ public: bool isVideo; /** - * @brief True, if the sticker set contains masks - */ - bool containsMasks; - - /** * @brief List of all set stickers */ std::vector<Sticker::Ptr> stickers; |