diff options
author | llnulldisk <48621230+llnulldisk@users.noreply.github.com> | 2022-08-29 18:46:44 +0200 |
---|---|---|
committer | llnulldisk <48621230+llnulldisk@users.noreply.github.com> | 2022-08-29 18:46:44 +0200 |
commit | b729f89033dca0cd2b9606060e735abfaf41c1f4 (patch) | |
tree | bfd8783fd4a7f800377e844a4eca4c01be5c9dd8 /include | |
parent | 336a7c5c4243128afd54133b5e0dfeb9661fb7c2 (diff) |
Update to API 4.5
Diffstat (limited to 'include')
-rw-r--r-- | include/tgbot/Api.h | 21 | ||||
-rw-r--r-- | include/tgbot/types/Animation.h | 36 | ||||
-rw-r--r-- | include/tgbot/types/Audio.h | 24 | ||||
-rw-r--r-- | include/tgbot/types/Chat.h | 48 | ||||
-rw-r--r-- | include/tgbot/types/ChatMember.h | 7 | ||||
-rw-r--r-- | include/tgbot/types/ChatPhoto.h | 24 | ||||
-rw-r--r-- | include/tgbot/types/Document.h | 20 | ||||
-rw-r--r-- | include/tgbot/types/File.h | 10 | ||||
-rw-r--r-- | include/tgbot/types/MessageEntity.h | 4 | ||||
-rw-r--r-- | include/tgbot/types/PhotoSize.h | 16 | ||||
-rw-r--r-- | include/tgbot/types/Sticker.h | 28 | ||||
-rw-r--r-- | include/tgbot/types/Update.h | 10 | ||||
-rw-r--r-- | include/tgbot/types/Video.h | 20 | ||||
-rw-r--r-- | include/tgbot/types/VideoNote.h | 18 | ||||
-rw-r--r-- | include/tgbot/types/Voice.h | 15 |
15 files changed, 214 insertions, 87 deletions
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h index cc18807..f5b325e 100644 --- a/include/tgbot/Api.h +++ b/include/tgbot/Api.h @@ -67,7 +67,7 @@ public: */ Message::Ptr sendMessage(std::int64_t chatId, const std::string& text, bool disableWebPagePreview = false, std::int32_t replyToMessageId = 0, GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), const std::string& parseMode = "", bool disableNotification = false) const; - + Message::Ptr sendMessage(const std::string& chatId, const std::string& text, bool disableWebPagePreview = false, std::int32_t replyToMessageId = 0, GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(), const std::string& parseMode = "", bool disableNotification = false) const; @@ -682,11 +682,20 @@ public: bool canEditMessages = false, bool canDeleteMessages = false, bool canInviteUsers = false, bool canPinMessages = false, bool canPromoteMembers = false) const; /** - * @brief Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members admin rights. Returns True on success. - * @param chatId Unique identifier for the target chat of the target supergroup. - * @param permissions New default chat permissions. - * @return True on success - */ + * @brief Use this method to set a custom title for an administrator in a supergroup promoted by the bot. + * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername) + * @param userId Unique identifier of the target user + * @param customTitle New custom title for the administrator; 0-16 characters, emoji are not allowed + * @return True on success + */ + bool setChatAdministratorCustomTitle(std::int64_t chatId, std::int64_t userId, const std::string& customTitle) const; + + /** + * @brief Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members admin rights. Returns True on success. + * @param chatId Unique identifier for the target chat of the target supergroup. + * @param permissions New default chat permissions. + * @return True on success + */ bool setChatPermissions(std::int64_t chatId, ChatPermissions::Ptr permissions) const; /** diff --git a/include/tgbot/types/Animation.h b/include/tgbot/types/Animation.h index ac54b2c..f1f62af 100644 --- a/include/tgbot/types/Animation.h +++ b/include/tgbot/types/Animation.h @@ -10,9 +10,7 @@ namespace TgBot { /** - * @brief You can provide an animation for your game so that it looks stylish in chats (check out Lumberjack for an example). - * - * This object represents an animation file to be displayed in the message containing a game. + * @brief This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound). * * @ingroup types */ @@ -21,27 +19,49 @@ public: typedef std::shared_ptr<Animation> Ptr; /** - * @brief Unique file identifier. + * @brief Identifier for this file, which can be used to download or reuse the file */ std::string fileId; /** - * @brief Optional. Animation thumbnail as defined by sender. + * @brief Unique identifier for this file, which is supposed to be the same over time and for different bots. + * + * Can't be used to download or reuse the file. + */ + std::string fileUniqueId; + + /** + * @brief Video width as defined by sender + */ + std::int32_t width; + + /** + * @brief Video height as defined by sender + */ + std::int32_t height; + + /** + * @brief Duration of the video in seconds as defined by sender + */ + std::int32_t duration; + + /** + * @brief Optional. Animation thumbnail as defined by sender */ PhotoSize::Ptr thumb; /** - * @brief Optional. Original animation filename as defined by sender. + * @brief Optional. Original animation filename as defined by sender */ std::string fileName; /** - * @brief Optional. MIME type of the file as defined by sender. + * @brief Optional. MIME type of the file as defined by sender */ std::string mimeType; /** - * @brief Optional. File size. + * @brief Optional. File size */ std::int32_t fileSize; }; diff --git a/include/tgbot/types/Audio.h b/include/tgbot/types/Audio.h index dae8729..0db0a36 100644 --- a/include/tgbot/types/Audio.h +++ b/include/tgbot/types/Audio.h @@ -10,7 +10,7 @@ namespace TgBot { /** - * @brief This object represents an audio file (voice note). + * @brief This object represents an audio file to be treated as music by the Telegram clients. * * @ingroup types */ @@ -20,34 +20,39 @@ public: typedef std::shared_ptr<Audio> Ptr; /** - * @brief Unique identifier for this file. + * @brief Identifier for this file, which can be used to download or reuse the file */ std::string fileId; /** - * @brief Duration of the audio in seconds as defined by sender. + * @brief Unique identifier for this file, which is supposed to be the same over time and for different bots. + * + * Can't be used to download or reuse the file. + */ + std::string fileUniqueId; + + /** + * @brief Duration of the audio in seconds as defined by sender */ std::int32_t duration; /** - * @brief Optional. Performer of the audio as defined by sender - * or by audio tags + * @brief Optional. Performer of the audio as defined by sender or by audio tags */ std::string performer; /** - * @brief Optional. Title of the audio as defined by sender or - * by audio tags + * @brief Optional. Title of the audio as defined by sender or by audio tags */ std::string title; /** - * @brief Optional. MIME type of the file as defined by sender. + * @brief Optional. MIME type of the file as defined by sender */ std::string mimeType; /** - * @brief Optional. File size. + * @brief Optional. File size */ std::int32_t fileSize; @@ -56,7 +61,6 @@ public: */ PhotoSize::Ptr thumb; }; - } #endif //TGBOT_CPP_AUDIO_H diff --git a/include/tgbot/types/Chat.h b/include/tgbot/types/Chat.h index 5731abd..4074643 100644 --- a/include/tgbot/types/Chat.h +++ b/include/tgbot/types/Chat.h @@ -12,7 +12,8 @@ namespace TgBot { class Message; /** - * @brief This object represents a Telegram Chat + * @brief This object represents a chat. + * * @ingroup types */ class Chat { @@ -28,87 +29,102 @@ public: }; /** - * @brief Unique identifier for this chat, not exceeding 1e13 by absolute value + * @brief Unique identifier for this chat. + * + * This number may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. + * But it is smaller than 52 bits, so a signed 64 bit integer or double-precision float type are safe for storing this identifier. */ std::int64_t id; /** - * @brief Type of chat: can be either "private", "group", "supergroup, or "channel". + * @brief Type of chat, can be either “private”, “group”, “supergroup” or “channel” */ Type type; /** - * @brief Optional. Title for channels and group chat + * @brief Optional. Title, for supergroups, channels and group chats */ std::string title; /** - * @brief Optional. Username for - * private chats and channels + * @brief Optional. Username, for private chats, supergroups and channels if available */ std::string username; /** - * @brief Optional. First name of the - * other party in private chat + * @brief Optional. First name of the other party in a private chat */ std::string firstName; /** - * @brief Optional. Last name of the - * other party in private chat + * @brief Optional. Last name of the other party in a private chat */ std::string lastName; /** - * @brief Optional. True if a group - * has ‘All Members Are Admins’ enabled. + * @brief Deprecated since API 4.4. New bots should use the permissions field instead. + * + * Optional. True if a group has ‘All Members Are Admins’ enabled. */ bool allMembersAreAdministrators; /** * @brief Optional. Chat photo. + * * Returned only in getChat. */ ChatPhoto::Ptr photo; /** - * @brief Optional. Description, for supergroups and channel chats. + * @brief Optional. Description, for groups, supergroups and channel chats. + * * Returned only in getChat. */ std::string description; /** - * @brief Optional. Chat invite link, for supergroups and channel chats. + * @brief Optional. Chat invite link, for groups, supergroups and channel chats. + * + * Each administrator in a chat generates their own invite links, so the bot must first generate the link using exportChatInviteLink. * Returned only in getChat. */ std::string inviteLink; /** - * @brief Optional. Pinned message, for supergroups and channel chats. + * @brief Optional. Pinned message, for groups, supergroups and channels. + * * Returned only in getChat. */ std::shared_ptr<Message> pinnedMessage; /** * @brief Optional. Default chat member permissions, for groups and supergroups. + * * Returned only in getChat. */ ChatPermissions::Ptr permissions; /** + * @brief Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user. + * + * Returned only in getChat. + */ + std::int32_t slowModeDelay; + + /** * @brief Optional. For supergroups, name of group sticker set. + * * Returned only in getChat. */ std::string stickerSetName; /** * @brief Optional. True, if the bot can change the group sticker set. + * * Returned only in getChat. */ bool canSetStickerSet; }; - } #endif //TGBOT_CPP_CHAT_H diff --git a/include/tgbot/types/ChatMember.h b/include/tgbot/types/ChatMember.h index 47e79a4..99be20a 100644 --- a/include/tgbot/types/ChatMember.h +++ b/include/tgbot/types/ChatMember.h @@ -11,9 +11,11 @@ namespace TgBot { /** * @brief This object contains information about one member of the chat. + * * @ingroup types */ class ChatMember { + public: typedef std::shared_ptr<ChatMember> Ptr; @@ -28,6 +30,11 @@ public: std::string status; /** + * @brief Optional. Owner and administrators only. Custom title for this user + */ + std::string customTitle; + + /** * @brief Optional. Restricted and kicked only. Date when restrictions will be lifted for this user, unix time. */ std::uint64_t untilDate; diff --git a/include/tgbot/types/ChatPhoto.h b/include/tgbot/types/ChatPhoto.h index f41d9b8..92275b2 100644 --- a/include/tgbot/types/ChatPhoto.h +++ b/include/tgbot/types/ChatPhoto.h @@ -8,21 +8,41 @@ namespace TgBot { /** * @brief This object represents a chat photo. + * * @ingroup types */ class ChatPhoto { + public: typedef std::shared_ptr<ChatPhoto> Ptr; /** - * @brief Unique file identifier of small (160x160) chat photo. This file_id can be used only for photo download. + * @brief File identifier of small (160x160) chat photo. + * + * This file_id can be used only for photo download and only for as long as the photo is not changed. */ std::string smallFileId; /** - * @brief Unique file identifier of big (640x640) chat photo. This file_id can be used only for photo download. + * @brief Unique file identifier of small (160x160) chat photo, which is supposed to be the same over time and for different bots. + * + * Can't be used to download or reuse the file. + */ + std::string smallFileUniqueId; + + /** + * @brief File identifier of big (640x640) chat photo. + * + * This file_id can be used only for photo download and only for as long as the photo is not changed. */ std::string bigFileId; + + /** + * @brief Unique file identifier of big (640x640) chat photo, which is supposed to be the same over time and for different bots. + * + * Can't be used to download or reuse the file. + */ + std::string bigFileUniqueId; }; } diff --git a/include/tgbot/types/Document.h b/include/tgbot/types/Document.h index b82895f..128b757 100644 --- a/include/tgbot/types/Document.h +++ b/include/tgbot/types/Document.h @@ -10,7 +10,7 @@ namespace TgBot { /** - * @brief This object represents a general file (as opposed to photos and audio files). + * @brief This object represents a general file (as opposed to photos, voice messages and audio files). * * @ingroup types */ @@ -20,31 +20,37 @@ public: typedef std::shared_ptr<Document> Ptr; /** - * @brief Unique file identifier. + * @brief Identifier for this file, which can be used to download or reuse the file */ std::string fileId; /** - * @brief Optional. Document thumbnail as defined by sender. + * @brief Unique identifier for this file, which is supposed to be the same over time and for different bots. + * + * Can't be used to download or reuse the file. + */ + std::string fileUniqueId; + + /** + * @brief Optional. Document thumbnail as defined by sender */ PhotoSize::Ptr thumb; /** - * @brief Optional. Original filename as defined by sender. + * @brief Optional. Original filename as defined by sender */ std::string fileName; /** - * @brief Optional. MIME type of the file as defined by sender. + * @brief Optional. MIME type of the file as defined by sender */ std::string mimeType; /** - * @brief Optional. File size. + * @brief Optional. File size */ std::int32_t fileSize; }; - } #endif //TGBOT_CPP_DOCUMENT_H diff --git a/include/tgbot/types/File.h b/include/tgbot/types/File.h index 3dee2bc..58aa6af 100644 --- a/include/tgbot/types/File.h +++ b/include/tgbot/types/File.h @@ -23,11 +23,18 @@ public: typedef std::shared_ptr<File> Ptr; /** - * @brief Unique identifier for this file + * @brief Identifier for this file, which can be used to download or reuse the file */ std::string fileId; /** + * @brief Unique identifier for this file, which is supposed to be the same over time and for different bots. + * + * Can't be used to download or reuse the file. + */ + std::string fileUniqueId; + + /** * @brief Optional. File size, if known */ std::int32_t fileSize; @@ -39,7 +46,6 @@ public: */ std::string filePath; }; - } #endif //TGBOT_CPP_FILE_H diff --git a/include/tgbot/types/MessageEntity.h b/include/tgbot/types/MessageEntity.h index f12d2a7..9aa283d 100644 --- a/include/tgbot/types/MessageEntity.h +++ b/include/tgbot/types/MessageEntity.h @@ -21,12 +21,12 @@ public: /** * @brief Type of the entity. * - * Can be mention (@username), hashtag, cashtag, bot_command, url, email, phone_number, bold (bold text), italic (italic text), code (monowidth string), pre (monowidth block), text_link (for clickable text URLs), text_mention (for users without usernames) + * 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), “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. + * @brief Offset in UTF-16 code units to the start of the entity */ std::int32_t offset; diff --git a/include/tgbot/types/PhotoSize.h b/include/tgbot/types/PhotoSize.h index 5d59e8a..a0cb5c5 100644 --- a/include/tgbot/types/PhotoSize.h +++ b/include/tgbot/types/PhotoSize.h @@ -18,26 +18,32 @@ public: typedef std::shared_ptr<PhotoSize> Ptr; /** - * @brief Unique identifier for this file. + * @brief Identifier for this file, which can be used to download or reuse the file */ std::string fileId; /** - * @brief Photo width. + * @brief Unique identifier for this file, which is supposed to be the same over time and for different bots. + * + * Can't be used to download or reuse the file. + */ + std::string fileUniqueId; + + /** + * @brief Photo width */ std::int32_t width; /** - * @brief Photo height. + * @brief Photo height */ std::int32_t height; /** - * @brief Optional. File size. + * @brief Optional. File size */ std::int32_t fileSize; }; - } #endif //TGBOT_CPP_PHOTOSIZE_H diff --git a/include/tgbot/types/Sticker.h b/include/tgbot/types/Sticker.h index b1d5945..4986597 100644 --- a/include/tgbot/types/Sticker.h +++ b/include/tgbot/types/Sticker.h @@ -11,7 +11,7 @@ namespace TgBot { /** - * @brief This object represents a general file (as opposed to photos and audio files). + * @brief This object represents a sticker. * * @ingroup types */ @@ -21,27 +21,34 @@ public: typedef std::shared_ptr<Sticker> Ptr; /** - * @brief Unique file identifier. + * @brief Identifier for this file, which can be used to download or reuse the file */ std::string fileId; /** - * @brief Optional. Sticker width. + * @brief Unique identifier for this file, which is supposed to be the same over time and for different bots. + * + * Can't be used to download or reuse the file. + */ + std::string fileUniqueId; + + /** + * @brief Sticker width */ std::int32_t width; /** - * @brief Optional. Sticker height. + * @brief Sticker height */ std::int32_t height; /** - * @brief True, if the sticker is animated. - */ + * @brief True, if the sticker is animated + */ bool isAnimated = false; /** - * @brief Optional. Optional. Sticker thumbnail in .webp or .jpg format. + * @brief Optional. Sticker thumbnail in the .webp or .jpg format */ PhotoSize::Ptr thumb; @@ -51,21 +58,20 @@ public: std::string emoji; /** - * @brief Optional. Name of the sticker set to which the sticker belongs. + * @brief Optional. Name of the sticker set to which the sticker belongs */ std::string setName; /** - * @brief Optional. For mask stickers, the position where the mask should be placed. + * @brief Optional. For mask stickers, the position where the mask should be placed */ MaskPosition::Ptr maskPosition; /** - * @brief Optional. File size. + * @brief Optional. File size */ std::int32_t fileSize; }; - } #endif //TGBOT_CPP_STICKER_H diff --git a/include/tgbot/types/Update.h b/include/tgbot/types/Update.h index fa5f8f3..328ba2a 100644 --- a/include/tgbot/types/Update.h +++ b/include/tgbot/types/Update.h @@ -7,6 +7,7 @@ #include "tgbot/types/CallbackQuery.h" #include "tgbot/types/ShippingQuery.h" #include "tgbot/types/PreCheckoutQuery.h" +#include "tgbot/types/Poll.h" #include <cstdint> #include <memory> @@ -14,7 +15,7 @@ namespace TgBot { /** - * @brief This object represents an incoming update. + * @brief This object represents an incoming update. At most one of the optional parameters can be present in any given update. * * @ingroup types */ @@ -76,6 +77,13 @@ public: * Contains full information about checkout */ PreCheckoutQuery::Ptr preCheckoutQuery; + + /** + * @brief Optional. New poll state. + * + * Bots receive only updates about stopped polls and polls, which are sent by the bot + */ + Poll::Ptr poll; }; } diff --git a/include/tgbot/types/Video.h b/include/tgbot/types/Video.h index 1702c5b..f305891 100644 --- a/include/tgbot/types/Video.h +++ b/include/tgbot/types/Video.h @@ -20,27 +20,34 @@ public: typedef std::shared_ptr<Video> Ptr; /** - * @brief Unique identifier for this file. + * @brief Identifier for this file, which can be used to download or reuse the file */ std::string fileId; /** - * @brief Video width as defined by sender. + * @brief Unique identifier for this file, which is supposed to be the same over time and for different bots. + * + * Can't be used to download or reuse the file. + */ + std::string fileUniqueId; + + /** + * @brief Video width as defined by sender */ std::int32_t width; /** - * @brief Video height as defined by sender. + * @brief Video height as defined by sender */ std::int32_t height; /** - * @brief Duration of the video in seconds as defined by sender. + * @brief Duration of the video in seconds as defined by sender */ std::int32_t duration; /** - * @brief Optional. Video thumbnail. + * @brief Optional. Video thumbnail */ PhotoSize::Ptr thumb; @@ -50,11 +57,10 @@ public: std::string mimeType; /** - * @brief Optional. File size. + * @brief Optional. File size */ std::int32_t fileSize; }; - } #endif //TGBOT_CPP_VIDEO_H diff --git a/include/tgbot/types/VideoNote.h b/include/tgbot/types/VideoNote.h index ebdf0cb..64684a3 100644 --- a/include/tgbot/types/VideoNote.h +++ b/include/tgbot/types/VideoNote.h @@ -20,31 +20,37 @@ public: typedef std::shared_ptr<VideoNote> Ptr; /** - * @brief Unique identifier for this file. + * @brief Identifier for this file, which can be used to download or reuse the file */ std::string fileId; /** - * @brief Video width and height as defined by sender. + * @brief Unique identifier for this file, which is supposed to be the same over time and for different bots. + * + * Can't be used to download or reuse the file. + */ + std::string fileUniqueId; + + /** + * @brief Video width and height (diameter of the video message) as defined by sender */ std::int32_t length; /** - * @brief Duration of the video in seconds as defined by sender. + * @brief Duration of the video in seconds as defined by sender */ std::int32_t duration; /** - * @brief Optional. Video thumbnail. + * @brief Optional. Video thumbnail */ PhotoSize::Ptr thumb; /** - * @brief Optional. File size. + * @brief Optional. File size */ std::int32_t fileSize; }; - } #endif //TGBOT_CPP_VIDEONOTE_H diff --git a/include/tgbot/types/Voice.h b/include/tgbot/types/Voice.h index 78b7282..34ab016 100644 --- a/include/tgbot/types/Voice.h +++ b/include/tgbot/types/Voice.h @@ -17,22 +17,29 @@ public: typedef std::shared_ptr<Voice> Ptr; /** - * @brief Unique identifier for this file. + * @brief Identifier for this file, which can be used to download or reuse the file */ std::string fileId; /** - * @brief Duration of the audio in seconds as defined by sender. + * @brief Unique identifier for this file, which is supposed to be the same over time and for different bots. + * + * Can't be used to download or reuse the file. + */ + std::string fileUniqueId; + + /** + * @brief Duration of the audio in seconds as defined by sender */ std::int32_t duration; /** - * @brief Optional. MIME type of the file as defined by sender; + * @brief Optional. MIME type of the file as defined by sender */ std::string mimeType; /** - * @brief Optional. File size. + * @brief Optional. File size */ std::int32_t fileSize; }; |