diff options
Diffstat (limited to 'include')
32 files changed, 278 insertions, 151 deletions
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h index 2b2b46b..da8b4ed 100644 --- a/include/tgbot/Api.h +++ b/include/tgbot/Api.h @@ -892,13 +892,13 @@ public: * @param canPinMessages Optional. Pass True if the administrator can pin messages, supergroups only * @param canPromoteMembers Optional. Pass True if the administrator can add new administrators with a subset of their own privileges or demote administrators that they have promoted, directly or indirectly (promoted by administrators that were appointed by him) * @param isAnonymous Optional. Pass True if the administrator's presence in the chat is hidden - * @param canManageChat Optional. Pass True if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. Implied by any other administrator privilege + * @param canManageChat Optional. Pass True if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege. * @param canManageVideoChats Optional. Pass True if the administrator can manage video chats * @param canRestrictMembers Optional. Pass True if the administrator can restrict, ban or unban chat members, or access supergroup statistics * @param canManageTopics Optional. Pass True if the user is allowed to create, rename, close, and reopen forum topics, supergroups only - * @param canPostStories Optional. Pass True if the administrator can post stories in the channel; channels only - * @param canEditStories Optional. Pass True if the administrator can edit stories posted by other users; channels only - * @param canDeleteStories Optional. Pass True if the administrator can delete stories posted by other users; channels only + * @param canPostStories Optional. Pass True if the administrator can post stories to the chat + * @param canEditStories Optional. Pass True if the administrator can edit stories posted by other users + * @param canDeleteStories Optional. Pass True if the administrator can delete stories posted by other users * * @return Returns True on success. */ diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h index fc12b22..f79b9c6 100644 --- a/include/tgbot/TgTypeParser.h +++ b/include/tgbot/TgTypeParser.h @@ -36,6 +36,7 @@ #include "tgbot/types/WebAppData.h" #include "tgbot/types/ProximityAlertTriggered.h" #include "tgbot/types/MessageAutoDeleteTimerChanged.h" +#include "tgbot/types/ChatBoostAdded.h" #include "tgbot/types/ForumTopicCreated.h" #include "tgbot/types/ForumTopicClosed.h" #include "tgbot/types/ForumTopicEdited.h" @@ -305,6 +306,9 @@ public: MessageAutoDeleteTimerChanged::Ptr parseJsonAndGetMessageAutoDeleteTimerChanged(const boost::property_tree::ptree& data) const; std::string parseMessageAutoDeleteTimerChanged(const MessageAutoDeleteTimerChanged::Ptr& object) const; + ChatBoostAdded::Ptr parseJsonAndGetChatBoostAdded(const boost::property_tree::ptree& data) const; + std::string parseChatBoostAdded(const ChatBoostAdded::Ptr& object) const; + ForumTopicCreated::Ptr parseJsonAndGetForumTopicCreated(const boost::property_tree::ptree& data) const; std::string parseForumTopicCreated(const ForumTopicCreated::Ptr& object) const; diff --git a/include/tgbot/types/Chat.h b/include/tgbot/types/Chat.h index 70e6ac1..e96009e 100644 --- a/include/tgbot/types/Chat.h +++ b/include/tgbot/types/Chat.h @@ -135,7 +135,7 @@ public: * * Returned only in Api::getChat. */ - std::int64_t emojiStatusExpirationDate; + std::uint32_t emojiStatusExpirationDate; /** * @brief Optional. Bio of the other party in a private chat. @@ -201,13 +201,20 @@ public: ChatPermissions::Ptr permissions; /** - * @brief Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds. + * @brief Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds. * * Returned only in Api::getChat. */ std::int32_t slowModeDelay; /** + * @brief Optional. For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions. + * + * Returned only in Api::getChat. + */ + std::int32_t unrestrictBoostCount; + + /** * @brief Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds. * * Returned only in Api::getChat. @@ -258,6 +265,14 @@ public: bool canSetStickerSet; /** + * @brief Optional. For supergroups, the name of the group's custom emoji sticker set. + * + * Custom emoji from this set can be used by all users and bots in the group. + * Returned only in Api::getChat. + */ + std::string customEmojiStickerSetName; + + /** * @brief Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats. * * This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it. diff --git a/include/tgbot/types/ChatAdministratorRights.h b/include/tgbot/types/ChatAdministratorRights.h index 914e8f3..aba0d90 100644 --- a/include/tgbot/types/ChatAdministratorRights.h +++ b/include/tgbot/types/ChatAdministratorRights.h @@ -21,9 +21,9 @@ public: bool isAnonymous; /** - * @brief True, if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. + * @brief True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. * - * Implied by any other administrator privilege + * Implied by any other administrator privilege. */ bool canManageChat; @@ -58,34 +58,34 @@ public: bool canInviteUsers; /** - * @brief Optional. True, if the administrator can post messages in the channel, or access channel statistics; channels only + * @brief True, if the administrator can post stories to the chat */ - bool canPostMessages; + bool canPostStories; /** - * @brief Optional. True, if the administrator can edit messages of other users and can pin messages; channels only + * @brief True, if the administrator can edit stories posted by other users */ - bool canEditMessages; + bool canEditStories; /** - * @brief Optional. True, if the user is allowed to pin messages; groups and supergroups only + * @brief True, if the administrator can delete stories posted by other users */ - bool canPinMessages; + bool canDeleteStories; /** - * @brief Optional. True, if the administrator can post stories in the channel; channels only + * @brief Optional. True, if the administrator can post messages in the channel, or access channel statistics; channels only */ - bool canPostStories; + bool canPostMessages; /** - * @brief Optional. True, if the administrator can edit stories posted by other users; channels only + * @brief Optional. True, if the administrator can edit messages of other users and can pin messages; channels only */ - bool canEditStories; + bool canEditMessages; /** - * @brief Optional. True, if the administrator can delete stories posted by other users; channels only + * @brief Optional. True, if the user is allowed to pin messages; groups and supergroups only */ - bool canDeleteStories; + bool canPinMessages; /** * @brief Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only diff --git a/include/tgbot/types/ChatBoostAdded.h b/include/tgbot/types/ChatBoostAdded.h new file mode 100644 index 0000000..93a8796 --- /dev/null +++ b/include/tgbot/types/ChatBoostAdded.h @@ -0,0 +1,26 @@ +#ifndef TGBOT_CHATBOOSTADDED_H +#define TGBOT_CHATBOOSTADDED_H + +#include <cstdint> +#include <memory> + +namespace TgBot { + +/** + * @brief This object represents a service message about a user boosting a chat. + * + * @ingroup types + */ +class ChatBoostAdded { + +public: + typedef std::shared_ptr<ChatBoostAdded> Ptr; + + /** + * @brief Number of boosts added by the user + */ + std::int32_t boostCount; +}; +} + +#endif //TGBOT_CHATBOOSTADDED_H diff --git a/include/tgbot/types/ChatBoostUpdated.h b/include/tgbot/types/ChatBoostUpdated.h index 60e49f6..1fe13db 100644 --- a/include/tgbot/types/ChatBoostUpdated.h +++ b/include/tgbot/types/ChatBoostUpdated.h @@ -24,7 +24,7 @@ public: Chat::Ptr chat; /** - * @brief Infomation about the chat boost + * @brief Information about the chat boost */ ChatBoost::Ptr boost; }; diff --git a/include/tgbot/types/ChatMemberAdministrator.h b/include/tgbot/types/ChatMemberAdministrator.h index 8c9d7e1..121c238 100644 --- a/include/tgbot/types/ChatMemberAdministrator.h +++ b/include/tgbot/types/ChatMemberAdministrator.h @@ -35,9 +35,9 @@ public: bool isAnonymous; /** - * @brief True, if the administrator can access the chat event log, boost list in channels, see channel members, report spam messages, see anonymous administrators in supergroups and ignore slow mode. + * @brief True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. * - * Implied by any other administrator privilege + * Implied by any other administrator privilege. */ bool canManageChat; @@ -72,34 +72,34 @@ public: bool canInviteUsers; /** - * @brief Optional. True, if the administrator can post messages in the channel, or access channel statistics; channels only + * @brief True, if the administrator can post stories to the chat */ - bool canPostMessages; + bool canPostStories; /** - * @brief Optional. True, if the administrator can edit messages of other users and can pin messages; channels only + * @brief True, if the administrator can edit stories posted by other users */ - bool canEditMessages; + bool canEditStories; /** - * @brief Optional. True, if the user is allowed to pin messages; groups and supergroups only + * @brief True, if the administrator can delete stories posted by other users */ - bool canPinMessages; + bool canDeleteStories; /** - * @brief Optional. True, if the administrator can post stories in the channel; channels only + * @brief Optional. True, if the administrator can post messages in the channel, or access channel statistics; channels only */ - bool canPostStories; + bool canPostMessages; /** - * @brief Optional. True, if the administrator can edit stories posted by other users; channels only + * @brief Optional. True, if the administrator can edit messages of other users and can pin messages; channels only */ - bool canEditStories; + bool canEditMessages; /** - * @brief Optional. True, if the administrator can delete stories posted by other users; channels only + * @brief Optional. True, if the user is allowed to pin messages; groups and supergroups only */ - bool canDeleteStories; + bool canPinMessages; /** * @brief Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only diff --git a/include/tgbot/types/ChatMemberUpdated.h b/include/tgbot/types/ChatMemberUpdated.h index 1ed4a95..b45efb1 100644 --- a/include/tgbot/types/ChatMemberUpdated.h +++ b/include/tgbot/types/ChatMemberUpdated.h @@ -1,5 +1,5 @@ -#ifndef TGBOT_CPP_CHATMEMBERUPDATED_H -#define TGBOT_CPP_CHATMEMBERUPDATED_H +#ifndef TGBOT_CHATMEMBERUPDATED_H +#define TGBOT_CHATMEMBERUPDATED_H #include "tgbot/types/Chat.h" #include "tgbot/types/User.h" @@ -58,4 +58,4 @@ public: }; } -#endif //TGBOT_CPP_CHATMEMBERUPDATED_H +#endif //TGBOT_CHATMEMBERUPDATED_H diff --git a/include/tgbot/types/ForceReply.h b/include/tgbot/types/ForceReply.h index 234cf20..131e1cb 100644 --- a/include/tgbot/types/ForceReply.h +++ b/include/tgbot/types/ForceReply.h @@ -40,7 +40,7 @@ public: /** * @brief Optional. Use this parameter if you want to force reply from specific users only. * - * Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has replyToMessageId), sender of the original message. + * Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message. */ bool selective; }; diff --git a/include/tgbot/types/GiveawayWinners.h b/include/tgbot/types/GiveawayWinners.h index 0117b88..05d02f1 100644 --- a/include/tgbot/types/GiveawayWinners.h +++ b/include/tgbot/types/GiveawayWinners.h @@ -27,7 +27,7 @@ public: Chat::Ptr chat; /** - * @brief Identifier of the messsage with the giveaway in the chat + * @brief Identifier of the message with the giveaway in the chat */ std::int32_t giveawayMessageId; diff --git a/include/tgbot/types/InlineKeyboardButton.h b/include/tgbot/types/InlineKeyboardButton.h index 3b59ce8..c71b5db 100644 --- a/include/tgbot/types/InlineKeyboardButton.h +++ b/include/tgbot/types/InlineKeyboardButton.h @@ -13,12 +13,13 @@ namespace TgBot { /** * @brief This object represents one button of an inline keyboard. - * + * * You must use exactly one of the optional fields. * * @ingroup types */ class InlineKeyboardButton { + public: typedef std::shared_ptr<InlineKeyboardButton> Ptr; @@ -29,19 +30,19 @@ public: /** * @brief Optional. HTTP or tg:// URL to be opened when the button is pressed. - * - * Links tg://user?id=<user_id> can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings. + * + * Links tg://user?id=<user_id> can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings. */ std::string url; /** - * @brief Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes + * @brief Optional. Data to be sent in a [callback query](https://core.telegram.org/bots/api#callbackquery) to the bot when button is pressed, 1-64 bytes */ std::string callbackData; /** - * @brief Optional. Description of the Web App that will be launched when the user presses the button. - * + * @brief Optional. Description of the [Web App](https://core.telegram.org/bots/webapps) that will be launched when the user presses the button. + * * The Web App will be able to send an arbitrary message on behalf of the user using the method Api::answerWebAppQuery. * Available only in private chats between a user and the bot. */ @@ -49,21 +50,21 @@ public: /** * @brief Optional. An HTTPS URL used to automatically authorize the user. - * - * Can be used as a replacement for the Telegram Login Widget. + * + * Can be used as a replacement for the [Telegram Login Widget](https://core.telegram.org/widgets/login). */ LoginUrl::Ptr loginUrl; /** * @brief Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field. - * + * * May be empty, in which case just the bot's username will be inserted. */ std::string switchInlineQuery; /** * @brief Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field. - * + * * May be empty, in which case only the bot's username will be inserted. * This offers a quick way for the user to open your bot in inline mode in the same chat - good for selecting something from multiple options. */ @@ -82,7 +83,7 @@ public: CallbackGame::Ptr callbackGame; /** - * @brief Optional. Specify True, to send a Pay button. + * @brief Optional. Specify True, to send a [Pay button](https://core.telegram.org/bots/api#payments). * * NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages. */ diff --git a/include/tgbot/types/InlineKeyboardMarkup.h b/include/tgbot/types/InlineKeyboardMarkup.h index 6496aee..13466c5 100644 --- a/include/tgbot/types/InlineKeyboardMarkup.h +++ b/include/tgbot/types/InlineKeyboardMarkup.h @@ -10,16 +10,17 @@ namespace TgBot { /** - * @brief This object represents an inline keyboard that appears right next to the message it belongs to. + * @brief This object represents an [inline keyboard](https://core.telegram.org/bots/features#inline-keyboards) that appears right next to the message it belongs to. * * @ingroup types */ class InlineKeyboardMarkup : public GenericReply { + public: typedef std::shared_ptr<InlineKeyboardMarkup> Ptr; /** - * @brief Array of button rows, each represented by an Array of InlineKeyboardButton objects. + * @brief Array of button rows, each represented by an Array of InlineKeyboardButton objects */ std::vector<std::vector<InlineKeyboardButton::Ptr>> inlineKeyboard; diff --git a/include/tgbot/types/InlineQueryResult.h b/include/tgbot/types/InlineQueryResult.h index dec086e..e204971 100644 --- a/include/tgbot/types/InlineQueryResult.h +++ b/include/tgbot/types/InlineQueryResult.h @@ -9,13 +9,36 @@ namespace TgBot { /** - * @brief This abstract class is base of all inline query results. - * - * This object represents one result of an inline query. + * @brief This object represents one result of an inline query. + * + * Telegram clients currently support results of the following 20 types: + * - InlineQueryResultCachedAudio + * - InlineQueryResultCachedDocument + * - InlineQueryResultCachedGif + * - InlineQueryResultCachedMpeg4Gif + * - InlineQueryResultCachedPhoto + * - InlineQueryResultCachedSticker + * - InlineQueryResultCachedVideo + * - InlineQueryResultCachedVoice + * - InlineQueryResultArticle + * - InlineQueryResultAudio + * - InlineQueryResultContact + * - InlineQueryResultGame + * - InlineQueryResultDocument + * - InlineQueryResultGif + * - InlineQueryResultLocation + * - InlineQueryResultMpeg4Gif + * - InlineQueryResultPhoto + * - InlineQueryResultVenue + * - InlineQueryResultVideo + * - InlineQueryResultVoice + * + * Note: All URLs passed in inline query results will be available to end users and therefore must be assumed to be public. * * @ingroup types */ class InlineQueryResult { + public: typedef std::shared_ptr<InlineQueryResult> Ptr; @@ -34,7 +57,7 @@ public: std::string id; /** - * @brief Optional. Inline keyboard attached to the message + * @brief Optional. [Inline keyboard](https://core.telegram.org/bots/features#inline-keyboards) attached to the message */ InlineKeyboardMarkup::Ptr replyMarkup; }; diff --git a/include/tgbot/types/InlineQueryResultAudio.h b/include/tgbot/types/InlineQueryResultAudio.h index 7925c28..e4324d3 100644 --- a/include/tgbot/types/InlineQueryResultAudio.h +++ b/include/tgbot/types/InlineQueryResultAudio.h @@ -6,19 +6,22 @@ #include "tgbot/types/InputMessageContent.h" #include <cstdint> -#include <string> #include <memory> +#include <string> +#include <vector> namespace TgBot { /** * @brief Represents a link to an MP3 audio file. + * * By default, this audio file will be sent by the user. * Alternatively, you can use inputMessageContent to send a message with the specified content instead of the audio. * * @ingroup types */ class InlineQueryResultAudio : public InlineQueryResult { + public: static const std::string TYPE; @@ -45,7 +48,8 @@ public: /** * @brief Optional. Mode for parsing entities in the audio caption. - * See https://core.telegram.org/bots/api#formatting-options for more details. + * + * See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details. */ std::string parseMode; @@ -55,13 +59,13 @@ public: std::vector<MessageEntity::Ptr> captionEntities; /** - * @brief Optional. Performer - */ + * @brief Optional. Performer + */ std::string performer; /** - * @brief Optional. Audio duration in seconds - */ + * @brief Optional. Audio duration in seconds + */ std::int32_t audioDuration; /** diff --git a/include/tgbot/types/InlineQueryResultCachedAudio.h b/include/tgbot/types/InlineQueryResultCachedAudio.h index d26534b..303f4a0 100644 --- a/include/tgbot/types/InlineQueryResultCachedAudio.h +++ b/include/tgbot/types/InlineQueryResultCachedAudio.h @@ -5,20 +5,22 @@ #include "tgbot/types/MessageEntity.h" #include "tgbot/types/InputMessageContent.h" -#include <string> #include <memory> +#include <string> #include <vector> namespace TgBot { /** * @brief Represents a link to an MP3 audio file stored on the Telegram servers. + * * By default, this audio file will be sent by the user. * Alternatively, you can use inputMessageContent to send a message with the specified content instead of the audio. * * @ingroup types */ class InlineQueryResultCachedAudio : public InlineQueryResult { + public: static const std::string TYPE; @@ -40,7 +42,8 @@ public: /** * @brief Optional. Mode for parsing entities in the audio caption. - * See https://core.telegram.org/bots/api#formatting-options for more details. + * + * See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details. */ std::string parseMode; diff --git a/include/tgbot/types/InlineQueryResultCachedDocument.h b/include/tgbot/types/InlineQueryResultCachedDocument.h index 4b3b42f..950369d 100644 --- a/include/tgbot/types/InlineQueryResultCachedDocument.h +++ b/include/tgbot/types/InlineQueryResultCachedDocument.h @@ -5,20 +5,22 @@ #include "tgbot/types/MessageEntity.h" #include "tgbot/types/InputMessageContent.h" -#include <string> #include <memory> +#include <string> #include <vector> namespace TgBot { /** * @brief Represents a link to a file stored on the Telegram servers. + * * By default, this file will be sent by the user with an optional caption. * Alternatively, you can use inputMessageContent to send a message with the specified content instead of the file. * * @ingroup types */ class InlineQueryResultCachedDocument : public InlineQueryResult { + public: static const std::string TYPE; @@ -50,7 +52,8 @@ public: /** * @brief Optional. Mode for parsing entities in the document caption. - * See https://core.telegram.org/bots/api#formatting-options for more details. + * + * See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details. */ std::string parseMode; diff --git a/include/tgbot/types/InlineQueryResultCachedSticker.h b/include/tgbot/types/InlineQueryResultCachedSticker.h index 40d82f6..d566446 100644 --- a/include/tgbot/types/InlineQueryResultCachedSticker.h +++ b/include/tgbot/types/InlineQueryResultCachedSticker.h @@ -4,19 +4,21 @@ #include "tgbot/types/InlineQueryResult.h" #include "tgbot/types/InputMessageContent.h" -#include <string> #include <memory> +#include <string> namespace TgBot { /** * @brief Represents a link to a sticker stored on the Telegram servers. + * * By default, this sticker will be sent by the user. * Alternatively, you can use inputMessageContent to send a message with the specified content instead of the sticker. * * @ingroup types */ class InlineQueryResultCachedSticker : public InlineQueryResult { + public: static const std::string TYPE; diff --git a/include/tgbot/types/InlineQueryResultCachedVoice.h b/include/tgbot/types/InlineQueryResultCachedVoice.h index ec21f43..1a14df3 100644 --- a/include/tgbot/types/InlineQueryResultCachedVoice.h +++ b/include/tgbot/types/InlineQueryResultCachedVoice.h @@ -5,20 +5,22 @@ #include "tgbot/types/MessageEntity.h" #include "tgbot/types/InputMessageContent.h" -#include <string> #include <memory> +#include <string> #include <vector> namespace TgBot { /** * @brief Represents a link to a voice message stored on the Telegram servers. + * * By default, this voice message will be sent by the user. * Alternatively, you can use inputMessageContent to send a message with the specified content instead of the voice message. * * @ingroup types */ class InlineQueryResultCachedVoice : public InlineQueryResult { + public: static const std::string TYPE; @@ -34,7 +36,7 @@ public: std::string voiceFileId; /** - * @brief Voice message title + * @brief Voice message title */ std::string title; @@ -45,7 +47,8 @@ public: /** * @brief Optional. Mode for parsing entities in the voice message caption. - * See https://core.telegram.org/bots/api#formatting-options for more details. + * + * See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details. */ std::string parseMode; diff --git a/include/tgbot/types/InlineQueryResultContact.h b/include/tgbot/types/InlineQueryResultContact.h index b9cceaa..1773ade 100644 --- a/include/tgbot/types/InlineQueryResultContact.h +++ b/include/tgbot/types/InlineQueryResultContact.h @@ -5,19 +5,21 @@ #include "tgbot/types/InputMessageContent.h" #include <cstdint> -#include <string> #include <memory> +#include <string> namespace TgBot { /** * @brief Represents a contact with a phone number. + * * By default, this contact will be sent by the user. * Alternatively, you can use inputMessageContent to send a message with the specified content instead of the contact. * * @ingroup types */ class InlineQueryResultContact : public InlineQueryResult { + public: static const std::string TYPE; @@ -43,7 +45,7 @@ public: std::string lastName; /** - * @brief Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes + * @brief Optional. Additional data about the contact in the form of a [vCard](https://en.wikipedia.org/wiki/VCard), 0-2048 bytes */ std::string vcard; @@ -53,18 +55,18 @@ public: InputMessageContent::Ptr inputMessageContent; /** - * @brief Optional. Url of the thumbnail for the result - */ + * @brief Optional. Url of the thumbnail for the result + */ std::string thumbnailUrl; /** - * @brief Optional. Thumbnail width - */ + * @brief Optional. Thumbnail width + */ std::int32_t thumbnailWidth; /** - * @brief Optinal. Thumbnail height - */ + * @brief Optional. Thumbnail height + */ std::int32_t thumbnailHeight; }; } diff --git a/include/tgbot/types/InlineQueryResultDocument.h b/include/tgbot/types/InlineQueryResultDocument.h index b86d50e..32f27c4 100644 --- a/include/tgbot/types/InlineQueryResultDocument.h +++ b/include/tgbot/types/InlineQueryResultDocument.h @@ -6,14 +6,15 @@ #include "tgbot/types/InputMessageContent.h" #include <cstdint> -#include <string> #include <memory> +#include <string> #include <vector> namespace TgBot { /** * @brief Represents a link to a file. + * * By default, this file will be sent by the user with an optional caption. * Alternatively, you can use inputMessageContent to send a message with the specified content instead of the file. * Currently, only .PDF and .ZIP files can be sent using this method. @@ -21,6 +22,7 @@ namespace TgBot { * @ingroup types */ class InlineQueryResultDocument : public InlineQueryResult { + public: static const std::string TYPE; @@ -42,7 +44,8 @@ public: /** * @brief Optional. Mode for parsing entities in the document caption. - * See https://core.telegram.org/bots/api#formatting-options for more details. + * + * See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details. */ std::string parseMode; @@ -57,7 +60,7 @@ public: std::string documentUrl; /** - * @brief Mime type of the content of the file, either “application/pdf” or “application/zip” + * @brief MIME type of the content of the file, either “application/pdf” or “application/zip” */ std::string mimeType; @@ -72,18 +75,18 @@ public: InputMessageContent::Ptr inputMessageContent; /** - * @brief Optional. URL of the thumbnail (jpeg only) for the file - */ + * @brief Optional. URL of the thumbnail (JPEG only) for the file + */ std::string thumbnailUrl; /** - * @brief Optional. Thumbnail width - */ + * @brief Optional. Thumbnail width + */ std::int32_t thumbnailWidth; /** - * @brief Optinal. Thumbnail height - */ + * @brief Optional. Thumbnail height + */ std::int32_t thumbnailHeight; }; } diff --git a/include/tgbot/types/InlineQueryResultGame.h b/include/tgbot/types/InlineQueryResultGame.h index 7cee282..0a56c22 100644 --- a/include/tgbot/types/InlineQueryResultGame.h +++ b/include/tgbot/types/InlineQueryResultGame.h @@ -3,8 +3,8 @@ #include "tgbot/types/InlineQueryResult.h" -#include <string> #include <memory> +#include <string> namespace TgBot { @@ -14,6 +14,7 @@ namespace TgBot { * @ingroup types */ class InlineQueryResultGame : public InlineQueryResult { + public: static const std::string TYPE; diff --git a/include/tgbot/types/InlineQueryResultLocation.h b/include/tgbot/types/InlineQueryResultLocation.h index 01b7581..cf2f1e0 100644 --- a/include/tgbot/types/InlineQueryResultLocation.h +++ b/include/tgbot/types/InlineQueryResultLocation.h @@ -5,19 +5,21 @@ #include "tgbot/types/InputMessageContent.h" #include <cstdint> -#include <string> #include <memory> +#include <string> namespace TgBot { /** * @brief Represents a location on a map. + * * By default, the location will be sent by the user. * Alternatively, you can use inputMessageContent to send a message with the specified content instead of the location. * * @ingroup types */ class InlineQueryResultLocation : public InlineQueryResult { + public: static const std::string TYPE; @@ -28,13 +30,13 @@ public: } /** - * @brief Location latitude in degrees - */ + * @brief Location latitude in degrees + */ float latitude; /** - * @brief Location longitude in degrees - */ + * @brief Location longitude in degrees + */ float longitude; /** @@ -43,23 +45,25 @@ public: std::string title; /** - * @brief Optional. The radius of uncertainty for the location, measured in meters; 0-1500 - */ + * @brief Optional. The radius of uncertainty for the location, measured in meters; 0-1500 + */ float horizontalAccuracy; /** - * @brief Optional. Period in seconds for which the location can be updated, should be between 60 and 86400. - */ + * @brief Optional. Period in seconds for which the location can be updated, should be between 60 and 86400. + */ std::int32_t livePeriod; /** * @brief Optional. For live locations, a direction in which the user is moving, in degrees. + * * Must be between 1 and 360 if specified. */ std::int32_t heading; /** * @brief Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters. + * * Must be between 1 and 100000 if specified. */ std::int32_t proximityAlertRadius; @@ -80,7 +84,7 @@ public: std::int32_t thumbnailWidth; /** - * @brief Optinal. Thumbnail height + * @brief Optional. Thumbnail height */ std::int32_t thumbnailHeight; }; diff --git a/include/tgbot/types/InlineQueryResultVenue.h b/include/tgbot/types/InlineQueryResultVenue.h index ff721db..8fc4ef8 100644 --- a/include/tgbot/types/InlineQueryResultVenue.h +++ b/include/tgbot/types/InlineQueryResultVenue.h @@ -5,19 +5,21 @@ #include "tgbot/types/InputMessageContent.h" #include <cstdint> -#include <string> #include <memory> +#include <string> namespace TgBot { /** * @brief Represents a venue. + * * By default, the venue will be sent by the user. * Alternatively, you can use inputMessageContent to send a message with the specified content instead of the venue. * * @ingroup types */ class InlineQueryResultVenue : public InlineQueryResult { + public: static const std::string TYPE; @@ -28,13 +30,13 @@ public: } /** - * @brief Latitude of the venue location in degrees - */ + * @brief Latitude of the venue location in degrees + */ float latitude; /** - * @brief Longitude of the venue location in degrees - */ + * @brief Longitude of the venue location in degrees + */ float longitude; /** @@ -43,29 +45,31 @@ public: std::string title; /** - * @brief Address of the venue - */ + * @brief Address of the venue + */ std::string address; /** - * @brief Optional. Foursquare identifier of the venue if known - */ + * @brief Optional. Foursquare identifier of the venue if known + */ std::string foursquareId; /** * @brief Optional. Foursquare type of the venue, if known. + * * (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) */ std::string foursquareType; /** - * @brief Optional. Google Places identifier of the venue - */ + * @brief Optional. Google Places identifier of the venue + */ std::string googlePlaceId; /** * @brief Optional. Google Places type of the venue. - * (See https://developers.google.com/places/web-service/supported_types.) + * + * (See [supported types](https://developers.google.com/places/web-service/supported_types).) */ std::string googlePlaceType; @@ -85,7 +89,7 @@ public: std::int32_t thumbnailWidth; /** - * @brief Optinal. Thumbnail height + * @brief Optional. Thumbnail height */ std::int32_t thumbnailHeight; }; diff --git a/include/tgbot/types/InlineQueryResultVoice.h b/include/tgbot/types/InlineQueryResultVoice.h index 335c2a7..e64b7fb 100644 --- a/include/tgbot/types/InlineQueryResultVoice.h +++ b/include/tgbot/types/InlineQueryResultVoice.h @@ -14,12 +14,14 @@ namespace TgBot { /** * @brief Represents a link to a voice recording in an .OGG container encoded with OPUS. + * * By default, this voice recording will be sent by the user. * Alternatively, you can use inputMessageContent to send a message with the specified content instead of the the voice message. * * @ingroup types */ class InlineQueryResultVoice : public InlineQueryResult { + public: static const std::string TYPE; @@ -46,7 +48,8 @@ public: /** * @brief Optional. Mode for parsing entities in the voice message caption. - * See https://core.telegram.org/bots/api#formatting-options for more details. + * + * See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details. */ std::string parseMode; diff --git a/include/tgbot/types/KeyboardButton.h b/include/tgbot/types/KeyboardButton.h index 77f4ff1..bf611ef 100644 --- a/include/tgbot/types/KeyboardButton.h +++ b/include/tgbot/types/KeyboardButton.h @@ -17,15 +17,6 @@ namespace TgBot { * For simple text buttons, String can be used instead of this object to specify the button text. * The optional fields KeyboardButton::webApp, KeyboardButton::requestUsers, KeyboardButton::requestChat, KeyboardButton::requestContact, KeyboardButton::requestLocation, and KeyboardButton::requestPoll are mutually exclusive. * - * Note: KeyboardButton::requestContact and KeyboardButton::requestLocation options will only work in Telegram versions released after 9 April, 2016. - * Older clients will display unsupported message. - * - * Note: KeyboardButton::requestPoll option will only work in Telegram versions released after 23 January, 2020. - * Older clients will display unsupported message. - * - * Note: KeyboardButton::webApp option will only work in Telegram versions released after 16 April, 2022. - * Older clients will display unsupported message. - * * Note: KeyboardButton::requestUsers and KeyboardButton::requestChat options will only work in Telegram versions released after 3 February, 2023. * Older clients will display unsupported message. * diff --git a/include/tgbot/types/LinkPreviewOptions.h b/include/tgbot/types/LinkPreviewOptions.h index 1ee44f1..b4c5325 100644 --- a/include/tgbot/types/LinkPreviewOptions.h +++ b/include/tgbot/types/LinkPreviewOptions.h @@ -29,12 +29,12 @@ public: std::string url; /** - * @brief Optional. True, if the media in the link preview is suppposed to be shrunk; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview + * @brief Optional. True, if the media in the link preview is supposed to be shrunk; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview */ bool preferSmallMedia; /** - * @brief Optional. True, if the media in the link preview is suppposed to be enlarged; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview + * @brief Optional. True, if the media in the link preview is supposed to be enlarged; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview */ bool preferLargeMedia; diff --git a/include/tgbot/types/Location.h b/include/tgbot/types/Location.h index 9454272..ea98bbb 100644 --- a/include/tgbot/types/Location.h +++ b/include/tgbot/types/Location.h @@ -1,6 +1,7 @@ -#ifndef TGBOT_CPP_LOCATION_H -#define TGBOT_CPP_LOCATION_H +#ifndef TGBOT_LOCATION_H +#define TGBOT_LOCATION_H +#include <cstdint> #include <memory> namespace TgBot { @@ -16,14 +17,14 @@ public: typedef std::shared_ptr<Location> Ptr; /** - * @brief Longitude as defined by sender + * @brief Latitude as defined by sender */ - float longitude; + float latitude; /** - * @brief Latitude as defined by sender + * @brief Longitude as defined by sender */ - float latitude; + float longitude; /** * @brief Optional. The radius of uncertainty for the location, measured in meters; 0-1500 @@ -31,24 +32,26 @@ public: float horizontalAccuracy; /** - * @brief Optional. Time relative to the message sending date, during which the location can be updated, in seconds. + * @brief Optional. Time relative to the message sending date, during which the location can be updated; in seconds. + * * For active live locations only. */ std::int32_t livePeriod; /** * @brief Optional. The direction in which user is moving, in degrees; 1-360. + * * For active live locations only. */ std::int32_t heading; /** - * @brief Optional. Maximum distance for proximity alerts about approaching another chat member, in meters. + * @brief Optional. The maximum distance for proximity alerts about approaching another chat member, in meters. + * * For sent live locations only. */ std::int32_t proximityAlertRadius; }; - } -#endif //TGBOT_CPP_LOCATION_H +#endif //TGBOT_LOCATION_H diff --git a/include/tgbot/types/Message.h b/include/tgbot/types/Message.h index 0a235e2..a6fb3aa 100644 --- a/include/tgbot/types/Message.h +++ b/include/tgbot/types/Message.h @@ -7,6 +7,7 @@ #include "tgbot/types/Message.h" #include "tgbot/types/ExternalReplyInfo.h" #include "tgbot/types/TextQuote.h" +#include "tgbot/types/Story.h" #include "tgbot/types/MessageEntity.h" #include "tgbot/types/LinkPreviewOptions.h" #include "tgbot/types/Animation.h" @@ -14,7 +15,6 @@ #include "tgbot/types/Document.h" #include "tgbot/types/PhotoSize.h" #include "tgbot/types/Sticker.h" -#include "tgbot/types/Story.h" #include "tgbot/types/Video.h" #include "tgbot/types/VideoNote.h" #include "tgbot/types/Voice.h" @@ -32,6 +32,7 @@ #include "tgbot/types/WriteAccessAllowed.h" #include "tgbot/types/PassportData.h" #include "tgbot/types/ProximityAlertTriggered.h" +#include "tgbot/types/ChatBoostAdded.h" #include "tgbot/types/ForumTopicCreated.h" #include "tgbot/types/ForumTopicEdited.h" #include "tgbot/types/ForumTopicClosed.h" @@ -92,6 +93,11 @@ public: Chat::Ptr senderChat; /** + * @brief Optional. If the sender of the message boosted the chat, the number of boosts added by the user + */ + std::int32_t senderBoostCount; + + /** * @brief Date the message was sent in Unix time. * * It is always a positive number, representing a valid date. @@ -136,6 +142,11 @@ public: TextQuote::Ptr quote; /** + * @brief Optional. For replies to a story, the original story + */ + Story::Ptr replyToStory; + + /** * @brief Optional. Bot through which the message was sent */ User::Ptr viaBot; @@ -341,7 +352,7 @@ public: /** * @brief Optional. Specified message was pinned. * - * Note that the Message object in this field will not contain further replyToMessage fields even if it is itself a reply. + * Note that the Message object in this field will not contain further replyToMessage fields even if it itself is a reply. */ Message::Ptr pinnedMessage; @@ -394,6 +405,11 @@ public: ProximityAlertTriggered::Ptr proximityAlertTriggered; /** + * @brief Optional. Service message: user boosted the chat + */ + ChatBoostAdded::Ptr boostAdded; + + /** * @brief Optional. Service message: forum topic created */ ForumTopicCreated::Ptr forumTopicCreated; diff --git a/include/tgbot/types/ReplyKeyboardMarkup.h b/include/tgbot/types/ReplyKeyboardMarkup.h index d40d767..f70b2fc 100644 --- a/include/tgbot/types/ReplyKeyboardMarkup.h +++ b/include/tgbot/types/ReplyKeyboardMarkup.h @@ -11,7 +11,7 @@ namespace TgBot { /** - * @brief This object represents a custom keyboard with reply options (see https://core.telegram.org/bots/features#keyboards for details and examples). + * @brief This object represents a [custom keyboard](https://core.telegram.org/bots/features#keyboards) with reply options (see [Introduction to bots](https://core.telegram.org/bots/features#keyboards) for details and examples). * * @ingroup types */ @@ -27,21 +27,21 @@ public: /** * @brief Optional. Requests clients to always show the keyboard when the regular keyboard is hidden. - * + * * Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon. */ bool isPersistent; /** * @brief Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons). - * + * * Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard. */ bool resizeKeyboard; /** * @brief Optional. Requests clients to hide the keyboard as soon as it's been used. - * + * * The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat - the user can press a special button in the input field to see the custom keyboard again. * Defaults to false. */ @@ -54,9 +54,8 @@ public: /** * @brief Optional. Use this parameter if you want to show the keyboard to specific users only. - * - * Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has replyToMessageId), sender of the original message. - * + * + * Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message. * Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language. * Other users in the group don't see the keyboard. */ diff --git a/include/tgbot/types/ReplyKeyboardRemove.h b/include/tgbot/types/ReplyKeyboardRemove.h index 7c3aad9..3a2bb94 100644 --- a/include/tgbot/types/ReplyKeyboardRemove.h +++ b/include/tgbot/types/ReplyKeyboardRemove.h @@ -28,7 +28,7 @@ public: /** * @brief Optional. Use this parameter if you want to remove the keyboard for specific users only. * - * Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has replyToMessageId), sender of the original message. + * Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message. * Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet. */ bool selective; diff --git a/include/tgbot/types/Story.h b/include/tgbot/types/Story.h index 98fd701..4ed8c67 100644 --- a/include/tgbot/types/Story.h +++ b/include/tgbot/types/Story.h @@ -1,14 +1,15 @@ #ifndef TGBOT_STORY_H #define TGBOT_STORY_H +#include "tgbot/types/Chat.h" + +#include <cstdint> #include <memory> namespace TgBot { /** - * @brief This object represents a message about a forwarded story in the chat. - * - * Currently holds no information. + * @brief This object represents a story. * * @ingroup types */ @@ -16,6 +17,16 @@ class Story { public: typedef std::shared_ptr<Story> Ptr; + + /** + * @brief Chat that posted the story + */ + Chat::Ptr chat; + + /** + * @brief Unique identifier for the story in the chat + */ + std::int32_t id; }; } diff --git a/include/tgbot/types/Update.h b/include/tgbot/types/Update.h index 920c7c3..3ac17ba 100644 --- a/include/tgbot/types/Update.h +++ b/include/tgbot/types/Update.h @@ -37,7 +37,7 @@ public: * @brief The update's unique identifier. * * Update identifiers start from a certain positive number and increase sequentially. - * This ID becomes especially handy if you're using [webhooks](https://core.telegram.org/bots/api#setwebhook), since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. + * This identifier becomes especially handy if you're using [webhooks](https://core.telegram.org/bots/api#setwebhook), since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order. * If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially. */ std::int32_t updateId; @@ -48,7 +48,9 @@ public: Message::Ptr message; /** - * @brief Optional. New version of a message that is known to the bot and was edited + * @brief Optional. New version of a message that is known to the bot and was edited. + * + * This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot. */ Message::Ptr editedMessage; @@ -58,7 +60,9 @@ public: Message::Ptr channelPost; /** - * @brief Optional. New version of a channel post that is known to the bot and was edited + * @brief Optional. New version of a channel post that is known to the bot and was edited. + * + * This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot. */ Message::Ptr editedChannelPost; @@ -74,6 +78,7 @@ public: * @brief Optional. Reactions to a message with anonymous reactions were changed. * * The bot must be an administrator in the chat and must explicitly specify "message_reaction_count" in the list of allowedUpdates to receive these updates. + * The updates are grouped and can be sent with delay up to a few minutes. */ MessageReactionCountUpdated::Ptr messageReactionCount; @@ -111,7 +116,7 @@ public: /** * @brief Optional. New poll state. * - * Bots receive only updates about stopped polls and polls, which are sent by the bot + * Bots receive only updates about manually stopped polls and polls, which are sent by the bot */ Poll::Ptr poll; |