summaryrefslogtreecommitdiff
path: root/include
diff options
context:
space:
mode:
Diffstat (limited to 'include')
-rw-r--r--include/tgbot/Api.h291
-rw-r--r--include/tgbot/TgTypeParser.h16
-rw-r--r--include/tgbot/types/Chat.h42
-rw-r--r--include/tgbot/types/ChatAdministratorRights.h6
-rw-r--r--include/tgbot/types/ChatMemberAdministrator.h8
-rw-r--r--include/tgbot/types/ChatMemberRestricted.h12
-rw-r--r--include/tgbot/types/ChatPermissions.h100
-rw-r--r--include/tgbot/types/ForumTopic.h41
-rw-r--r--include/tgbot/types/ForumTopicClosed.h21
-rw-r--r--include/tgbot/types/ForumTopicCreated.h36
-rw-r--r--include/tgbot/types/ForumTopicReopened.h21
-rw-r--r--include/tgbot/types/Message.h61
12 files changed, 515 insertions, 140 deletions
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h
index 9dd2f5e..7dceb75 100644
--- a/include/tgbot/Api.h
+++ b/include/tgbot/Api.h
@@ -25,6 +25,7 @@
#include "tgbot/types/LabeledPrice.h"
#include "tgbot/types/ShippingOption.h"
#include "tgbot/types/BotCommand.h"
+#include "tgbot/types/ForumTopic.h"
#include <boost/property_tree/ptree.hpp>
#include <boost/variant.hpp>
@@ -170,6 +171,7 @@ public:
* @param entities Optional. A JSON-serialized list of special entities that appear in message text, which can be specified instead of parseMode
* @param allowSendingWithoutReply Optional. Pass True if the message should be sent even if the specified replied-to message is not found
* @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*
* @return On success, the sent Message is returned.
*/
@@ -183,7 +185,8 @@ public:
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& entities = std::vector<MessageEntity::Ptr>(),
bool allowSendingWithoutReply = false,
- bool protectContent = false) const;
+ bool protectContent = false,
+ std::int32_t messageThreadId = 0) const;
/**
* @brief Use this method to forward messages of any kind.
@@ -195,6 +198,7 @@ public:
* @param messageId Message identifier in the chat specified in fromChatId
* @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
* @param protectContent Optional. Protects the contents of the forwarded message from forwarding and saving
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*
* @return On success, the sent Message is returned.
*/
@@ -202,7 +206,8 @@ public:
boost::variant<std::int64_t, std::string> fromChatId,
std::int32_t messageId,
bool disableNotification = false,
- bool protectContent = false) const;
+ bool protectContent = false,
+ std::int32_t messageThreadId = 0) const;
/**
* @brief Use this method to copy messages of any kind.
@@ -222,6 +227,7 @@ public:
* @param allowSendingWithoutReply Optional. Pass True if the message should be sent even if the specified replied-to message is not found
* @param replyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
* @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*
* @return Returns the MessageId of the sent message on success.
*/
@@ -235,7 +241,8 @@ public:
std::int32_t replyToMessageId = 0,
bool allowSendingWithoutReply = false,
GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
- bool protectContent = false) const;
+ bool protectContent = false,
+ std::int32_t messageThreadId = 0) const;
/**
* @brief Use this method to send photos.
@@ -250,6 +257,7 @@ public:
* @param captionEntities Optional. A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parseMode
* @param allowSendingWithoutReply Optional. Pass True if the message should be sent even if the specified replied-to message is not found
* @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*
* @return On success, the sent Message is returned.
*/
@@ -262,7 +270,8 @@ public:
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
bool allowSendingWithoutReply = false,
- bool protectContent = false) const;
+ bool protectContent = false,
+ std::int32_t messageThreadId = 0) const;
/**
* @brief Use this method to send audio files, if you want Telegram clients to display them in the music player.
@@ -286,6 +295,7 @@ public:
* @param captionEntities Optional. A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parseMode
* @param allowSendingWithoutReply Optional. Pass True if the message should be sent even if the specified replied-to message is not found
* @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*
* @return On success, the sent Message is returned.
*/
@@ -302,7 +312,8 @@ public:
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
bool allowSendingWithoutReply = false,
- bool protectContent = false) const;
+ bool protectContent = false,
+ std::int32_t messageThreadId = 0) const;
/**
* @brief Use this method to send general files.
@@ -321,6 +332,7 @@ public:
* @param disableContentTypeDetection Optional. Disables automatic server-side content type detection for files uploaded using multipart/form-data
* @param allowSendingWithoutReply Optional. Pass True if the message should be sent even if the specified replied-to message is not found
* @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*
* @return On success, the sent Message is returned.
*/
@@ -335,7 +347,8 @@ public:
const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
bool disableContentTypeDetection = false,
bool allowSendingWithoutReply = false,
- bool protectContent = false) const;
+ bool protectContent = false,
+ std::int32_t messageThreadId = 0) const;
/**
* @brief Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document).
@@ -357,6 +370,7 @@ public:
* @param captionEntities Optional. A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parseMode
* @param allowSendingWithoutReply Optional. Pass True if the message should be sent even if the specified replied-to message is not found
* @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*
* @return On success, the sent Message is returned.
*/
@@ -374,7 +388,8 @@ public:
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
bool allowSendingWithoutReply = false,
- bool protectContent = false) const;
+ bool protectContent = false,
+ std::int32_t messageThreadId = 0) const;
/**
* @brief Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
@@ -395,6 +410,7 @@ public:
* @param captionEntities Optional. A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parseMode
* @param allowSendingWithoutReply Optional. Pass True if the message should be sent even if the specified replied-to message is not found
* @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*
* @return On success, the sent Message is returned.
*/
@@ -411,7 +427,8 @@ public:
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
bool allowSendingWithoutReply = false,
- bool protectContent = false) const;
+ bool protectContent = false,
+ std::int32_t messageThreadId = 0) const;
/**
* @brief Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message.
@@ -430,6 +447,7 @@ public:
* @param captionEntities Optional. A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parseMode
* @param allowSendingWithoutReply Optional. Pass True if the message should be sent even if the specified replied-to message is not found
* @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*
* @return On success, the sent Message is returned.
*/
@@ -443,7 +461,8 @@ public:
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
bool allowSendingWithoutReply = false,
- bool protectContent = false) const;
+ bool protectContent = false,
+ std::int32_t messageThreadId = 0) const;
/**
* @brief Use this method to send video messages.
@@ -460,6 +479,7 @@ public:
* @param replyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
* @param allowSendingWithoutReply Optional. Pass True if the message should be sent even if the specified replied-to message is not found
* @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*
* @return On success, the sent Message is returned.
*/
@@ -472,7 +492,8 @@ public:
boost::variant<InputFile::Ptr, std::string> thumb = "",
GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
bool allowSendingWithoutReply = false,
- bool protectContent = false) const;
+ bool protectContent = false,
+ std::int32_t messageThreadId = 0) const;
/**
* @brief Use this method to send a group of photos, videos, documents or audios as an album.
@@ -485,6 +506,7 @@ public:
* @param replyToMessageId Optional. If the messages are a reply, ID of the original message
* @param allowSendingWithoutReply Optional. Pass True if the message should be sent even if the specified replied-to message is not found
* @param protectContent Optional. Protects the contents of the sent messages from forwarding and saving
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*
* @return On success, an array of Messages that were sent is returned.
*/
@@ -493,7 +515,8 @@ public:
bool disableNotification = false,
std::int32_t replyToMessageId = 0,
bool allowSendingWithoutReply = false,
- bool protectContent = false) const;
+ bool protectContent = false,
+ std::int32_t messageThreadId = 0) const;
/**
* @brief Use this method to send point on the map.
@@ -510,6 +533,7 @@ public:
* @param proximityAlertRadius 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.
* @param allowSendingWithoutReply Optional. Pass True if the message should be sent even if the specified replied-to message is not found
* @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*
* @return On success, the sent Message is returned.
*/
@@ -524,7 +548,8 @@ public:
std::int32_t heading = 0,
std::int32_t proximityAlertRadius = 0,
bool allowSendingWithoutReply = false,
- bool protectContent = false) const;
+ bool protectContent = false,
+ std::int32_t messageThreadId = 0) const;
/**
* @brief Use this method to edit live location messages.
@@ -585,6 +610,7 @@ public:
* @param googlePlaceType Optional. Google Places type of the venue. (See https://developers.google.com/places/web-service/supported_types)
* @param allowSendingWithoutReply Optional. Pass True if the message should be sent even if the specified replied-to message is not found
* @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*
* @return On success, the sent Message is returned.
*/
@@ -601,7 +627,8 @@ public:
const std::string& googlePlaceId = "",
const std::string& googlePlaceType = "",
bool allowSendingWithoutReply = false,
- bool protectContent = false) const;
+ bool protectContent = false,
+ std::int32_t messageThreadId = 0) const;
/**
* @brief Use this method to send phone contacts.
@@ -616,6 +643,7 @@ public:
* @param replyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove keyboard or to force a reply from the user.
* @param allowSendingWithoutReply Optional. Pass True if the message should be sent even if the specified replied-to message is not found
* @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*
* @return On success, the sent Message is returned.
*/
@@ -628,7 +656,8 @@ public:
std::int32_t replyToMessageId = 0,
GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
bool allowSendingWithoutReply = false,
- bool protectContent = false) const;
+ bool protectContent = false,
+ std::int32_t messageThreadId = 0) const;
/**
* @brief Use this method to send a native poll.
@@ -651,6 +680,7 @@ public:
* @param isClosed Optional. Pass True, if the poll needs to be immediately closed. This can be useful for poll preview.
* @param allowSendingWithoutReply Optional. Pass True if the message should be sent even if the specified replied-to message is not found
* @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*
* @return On success, the sent Message is returned.
*/
@@ -671,7 +701,8 @@ public:
std::int32_t closeDate = 0,
bool isClosed = false,
bool allowSendingWithoutReply = false,
- bool protectContent = false) const;
+ bool protectContent = false,
+ std::int32_t messageThreadId = 0) const;
/**
* @brief Use this method to send an animated emoji that will display a random value.
@@ -683,6 +714,7 @@ public:
* @param emoji Optional. Emoji on which the dice throw animation is based. Currently, must be one of “🎲”, “🎯”, “🏀”, “⚽”, “🎳”, or “🎰”. Dice can have values 1-6 for “🎲”, “🎯” and “🎳”, values 1-5 for “🏀” and “⚽”, and values 1-64 for “🎰”. Defaults to “🎲”
* @param allowSendingWithoutReply Optional. Pass True if the message should be sent even if the specified replied-to message is not found
* @param protectContent Optional. Protects the contents of the sent message from forwarding
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*
* @return On success, the sent Message is returned.
*/
@@ -692,7 +724,8 @@ public:
GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
const std::string& emoji = "",
bool allowSendingWithoutReply = false,
- bool protectContent = false) const;
+ bool protectContent = false,
+ std::int32_t messageThreadId = 0) const;
/**
* @brief Use this method when you need to tell the user that something is happening on the bot's side.
@@ -805,17 +838,18 @@ public:
*
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param userId Unique identifier of the target user
- * @param canChangeInfo Optional. Pass True, if the administrator can change chat title, photo and other settings
- * @param canPostMessages Optional. Pass True, if the administrator can create channel posts, channels only
- * @param canEditMessages Optional. Pass True, if the administrator can edit messages of other users and can pin messages, channels only
- * @param canDeleteMessages Optional. Pass True, if the administrator can delete messages of other users
- * @param canInviteUsers Optional. Pass True, if the administrator can invite new users to the chat
- * @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 he has 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, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups 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
+ * @param canChangeInfo Optional. Pass True if the administrator can change chat title, photo and other settings
+ * @param canPostMessages Optional. Pass True if the administrator can create channel posts, channels only
+ * @param canEditMessages Optional. Pass True if the administrator can edit messages of other users and can pin messages, channels only
+ * @param canDeleteMessages Optional. Pass True if the administrator can delete messages of other users
+ * @param canInviteUsers Optional. Pass True if the administrator can invite new users to the chat
+ * @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 he has 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, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups 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
+ * @param canManageTopics Optional. Pass True if the user is allowed to create, rename, close, and reopen forum topics, supergroups only
*
* @return Returns True on success.
*/
@@ -831,7 +865,8 @@ public:
bool isAnonymous = false,
bool canManageChat = false,
bool canManageVideoChats = false,
- bool canRestrictMembers = false) const;
+ bool canRestrictMembers = false,
+ bool canManageTopics = false) const;
/**
* @brief Use this method to set a custom title for an administrator in a supergroup promoted by the bot.
@@ -1094,61 +1129,154 @@ public:
Chat::Ptr getChat(boost::variant<std::int64_t, std::string> chatId) const;
/**
- * @brief Use this method to get a list of administrators in a chat, which aren't bots.
- *
- * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
- *
- * @return Returns an Array of ChatMember objects.
- */
+ * @brief Use this method to get a list of administrators in a chat, which aren't bots.
+ *
+ * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
+ *
+ * @return Returns an Array of ChatMember objects.
+ */
std::vector<ChatMember::Ptr> getChatAdministrators(boost::variant<std::int64_t, std::string> chatId) const;
/**
- * @brief Use this method to get the number of members in a chat.
- *
- * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
- *
- * @return Returns Int on success.
- */
+ * @brief Use this method to get the number of members in a chat.
+ *
+ * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
+ *
+ * @return Returns Int on success.
+ */
std::int32_t getChatMemberCount(boost::variant<std::int64_t, std::string> chatId) const;
/**
- * @brief Use this method to get information about a member of a chat.
- *
- * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
- * @param userId Unique identifier of the target user
- *
- * @return Returns a ChatMember object on success.
- */
+ * @brief Use this method to get information about a member of a chat.
+ *
+ * @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
+ * @param userId Unique identifier of the target user
+ *
+ * @return Returns a ChatMember object on success.
+ */
ChatMember::Ptr getChatMember(boost::variant<std::int64_t, std::string> chatId,
std::int64_t userId) const;
/**
- * @brief Use this method to set a new group sticker set for a supergroup.
- *
- * The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
- * Use the field canSetStickerSet optionally returned in Api::getChat requests to check if the bot can use this method.
- *
- * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
- * @param stickerSetName Name of the sticker set to be set as the group sticker set
- *
- * @return Returns True on success.
- */
+ * @brief Use this method to set a new group sticker set for a supergroup.
+ *
+ * The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
+ * Use the field canSetStickerSet optionally returned in Api::getChat requests to check if the bot can use this method.
+ *
+ * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
+ * @param stickerSetName Name of the sticker set to be set as the group sticker set
+ *
+ * @return Returns True on success.
+ */
bool setChatStickerSet(boost::variant<std::int64_t, std::string> chatId,
const std::string& stickerSetName) const;
/**
- * @brief Use this method to delete a group sticker set from a supergroup.
- *
- * The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
- * Use the field canSetSticker_set optionally returned in Api::getChat requests to check if the bot can use this method.
- *
- * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
- *
- * @return Returns True on success.
- */
+ * @brief Use this method to delete a group sticker set from a supergroup.
+ *
+ * The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
+ * Use the field canSetSticker_set optionally returned in Api::getChat requests to check if the bot can use this method.
+ *
+ * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
+ *
+ * @return Returns True on success.
+ */
bool deleteChatStickerSet(boost::variant<std::int64_t, std::string> chatId) const;
/**
+ * @brief Use this method to get custom emoji stickers, which can be used as a forum topic icon by any user.
+ *
+ * @return Returns an Array of Sticker objects.
+ */
+ std::vector<Sticker::Ptr> getForumTopicIconStickers() const;
+
+ /**
+ * @brief Use this method to create a topic in a forum supergroup chat.
+ *
+ * The bot must be an administrator in the chat for this to work and must have the canManageTopics administrator rights.
+ *
+ * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
+ * @param name Topic name, 1-128 characters
+ * @param iconColor Optional. Color of the topic icon in RGB format. Currently, must be one of 0x6FB9F0, 0xFFD67E, 0xCB86DB, 0x8EEE98, 0xFF93B2, or 0xFB6F5F
+ * @param iconCustomEmojiId Optional. Unique identifier of the custom emoji shown as the topic icon. Use Api::getForumTopicIconStickers to get all allowed custom emoji identifiers.
+ *
+ * @return Returns information about the created topic as a ForumTopic object.
+ */
+ ForumTopic::Ptr createForumTopic(boost::variant<std::int64_t, std::string> chatId,
+ const std::string& name,
+ std::int32_t iconColor = 0,
+ const std::string& iconCustomEmojiId = "") const;
+
+ /**
+ * @brief Use this method to edit name and icon of a topic in a forum supergroup chat.
+ *
+ * The bot must be an administrator in the chat for this to work and must have canManageTopics administrator rights, unless it is the creator of the topic.
+ *
+ * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
+ * @param messageThreadId Unique identifier for the target message thread of the forum topic
+ * @param name New topic name, 1-128 characters
+ * @param iconCustomEmojiId New unique identifier of the custom emoji shown as the topic icon. Use Api::getForumTopicIconStickers to get all allowed custom emoji identifiers
+ *
+ * @return Returns True on success.
+ */
+ bool editForumTopic(boost::variant<std::int64_t, std::string> chatId,
+ std::int32_t messageThreadId,
+ const std::string& name,
+ const std::string& iconCustomEmojiId) const;
+
+ /**
+ * @brief Use this method to close an open topic in a forum supergroup chat.
+ *
+ * The bot must be an administrator in the chat for this to work and must have the canManageTopics administrator rights, unless it is the creator of the topic.
+ *
+ * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
+ * @param messageThreadId Unique identifier for the target message thread of the forum topic
+ *
+ * @return Returns True on success.
+ */
+ bool closeForumTopic(boost::variant<std::int64_t, std::string> chatId,
+ std::int32_t messageThreadId) const;
+
+ /**
+ * @brief Use this method to reopen a closed topic in a forum supergroup chat.
+ *
+ * The bot must be an administrator in the chat for this to work and must have the canManageTopics administrator rights, unless it is the creator of the topic.
+ *
+ * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
+ * @param messageThreadId Unique identifier for the target message thread of the forum topic
+ *
+ * @return Returns True on success.
+ */
+ bool reopenForumTopic(boost::variant<std::int64_t, std::string> chatId,
+ std::int32_t messageThreadId) const;
+
+ /**
+ * @brief Use this method to delete a forum topic along with all its messages in a forum supergroup chat.
+ *
+ * The bot must be an administrator in the chat for this to work and must have the canDeleteMessages administrator rights.
+ *
+ * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
+ * @param messageThreadId Unique identifier for the target message thread of the forum topic
+ *
+ * @return Returns True on success.
+ */
+ bool deleteForumTopic(boost::variant<std::int64_t, std::string> chatId,
+ std::int32_t messageThreadId) const;
+
+ /**
+ * @brief Use this method to clear the list of pinned messages in a forum topic.
+ *
+ * The bot must be an administrator in the chat for this to work and must have the canPinMessages administrator right in the supergroup.
+ *
+ * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
+ * @param messageThreadId Unique identifier for the target message thread of the forum topic
+ *
+ * @return Returns True on success.
+ */
+ bool unpinAllForumTopicMessages(boost::variant<std::int64_t, std::string> chatId,
+ std::int32_t messageThreadId) const;
+
+ /**
* @brief Use this method to send answers to callback queries sent from inline keyboards.
*
* The answer will be displayed to the user as a notification at the top of the chat screen or as an alert.
@@ -1317,15 +1445,15 @@ public:
GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>()) const;
/**
- * @brief Use this method to edit only the reply markup of messages.
- *
- * @param chatId Optional. Required if inlineMessageId is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
- * @param messageId Optional. Required if inlineMessageId is not specified. Identifier of the message to edit
- * @param inlineMessageId Optional. Required if chatId and messageId are not specified. Identifier of the inline message
- * @param replyMarkup Optional. A JSON-serialized object for an inline keyboard.
- *
- * @return On success, if the edited message is not an inline message, the edited Message is returned, otherwise nullptr is returned.
- */
+ * @brief Use this method to edit only the reply markup of messages.
+ *
+ * @param chatId Optional. Required if inlineMessageId is not specified. Unique identifier for the target chat or username of the target channel (in the format @channelusername)
+ * @param messageId Optional. Required if inlineMessageId is not specified. Identifier of the message to edit
+ * @param inlineMessageId Optional. Required if chatId and messageId are not specified. Identifier of the inline message
+ * @param replyMarkup Optional. A JSON-serialized object for an inline keyboard.
+ *
+ * @return On success, if the edited message is not an inline message, the edited Message is returned, otherwise nullptr is returned.
+ */
Message::Ptr editMessageReplyMarkup(boost::variant<std::int64_t, std::string> chatId = 0,
std::int32_t messageId = 0,
const std::string& inlineMessageId = "",
@@ -1348,6 +1476,7 @@ public:
* @brief Use this method to delete a message, including service messages, with the following limitations:
*
* - A message can only be deleted if it was sent less than 48 hours ago.
+ * - Service messages about a supergroup, channel, or forum topic creation can't be deleted.
* - A dice message in a private chat can only be deleted if it was sent more than 24 hours ago.
* - Bots can delete outgoing messages in private chats, groups, and supergroups.
* - Bots can delete incoming messages in private chats.
@@ -1373,6 +1502,7 @@ public:
* @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
* @param allowSendingWithoutReply Optional. Pass True if the message should be sent even if the specified replied-to message is not found
* @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*
* @return On success, the sent Message is returned.
*/
@@ -1382,7 +1512,8 @@ public:
GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
bool disableNotification = false,
bool allowSendingWithoutReply = false,
- bool protectContent = false) const;
+ bool protectContent = false,
+ std::int32_t messageThreadId = 0) const;
/**
* @brief Use this method to get a sticker set.
@@ -1567,6 +1698,7 @@ public:
* @param suggestedTipAmounts Optional. A JSON-serialized array of suggested amounts of tips in the smallest units of the currency (integer, not float/double). At most 4 suggested tip amounts can be specified. The suggested tip amounts must be positive, passed in a strictly increased order and must not exceed maxTipAmount.
* @param startParameter Optional. Unique deep-linking parameter. If left empty, forwarded copies of the sent message will have a Pay button, allowing multiple users to pay directly from the forwarded message, using the same invoice. If non-empty, forwarded copies of the sent message will have a URL button with a deep link to the bot (instead of a Pay button), with the value used as the start parameter
* @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*
* @return On success, the sent Message is returned.
*/
@@ -1596,7 +1728,8 @@ public:
std::int32_t maxTipAmount = 0,
const std::vector<std::int32_t>& suggestedTipAmounts = std::vector<std::int32_t>(),
const std::string& startParameter = "",
- bool protectContent = false) const;
+ bool protectContent = false,
+ std::int32_t messageThreadId = 0) const;
/**
* @brief Use this method to create a link for an invoice.
@@ -1704,6 +1837,7 @@ public:
* @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
* @param allowSendingWithoutReply Optional. Pass True if the message should be sent even if the specified replied-to message is not found
* @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
*
* @return On success, the sent Message is returned.
*/
@@ -1713,7 +1847,8 @@ public:
InlineKeyboardMarkup::Ptr replyMarkup = std::make_shared<InlineKeyboardMarkup>(),
bool disableNotification = false,
bool allowSendingWithoutReply = false,
- bool protectContent = false) const;
+ bool protectContent = false,
+ std::int32_t messageThreadId = 0) const;
/**
* @brief Use this method to set the score of the specified user in a game message.
diff --git a/include/tgbot/TgTypeParser.h b/include/tgbot/TgTypeParser.h
index e7f4cd5..b303c47 100644
--- a/include/tgbot/TgTypeParser.h
+++ b/include/tgbot/TgTypeParser.h
@@ -26,6 +26,9 @@
#include "tgbot/types/WebAppData.h"
#include "tgbot/types/ProximityAlertTriggered.h"
#include "tgbot/types/MessageAutoDeleteTimerChanged.h"
+#include "tgbot/types/ForumTopicCreated.h"
+#include "tgbot/types/ForumTopicClosed.h"
+#include "tgbot/types/ForumTopicReopened.h"
#include "tgbot/types/VideoChatScheduled.h"
#include "tgbot/types/VideoChatStarted.h"
#include "tgbot/types/VideoChatEnded.h"
@@ -56,6 +59,7 @@
#include "tgbot/types/ChatJoinRequest.h"
#include "tgbot/types/ChatPermissions.h"
#include "tgbot/types/ChatLocation.h"
+#include "tgbot/types/ForumTopic.h"
#include "tgbot/types/BotCommand.h"
#include "tgbot/types/BotCommandScope.h"
#include "tgbot/types/BotCommandScopeDefault.h"
@@ -226,6 +230,15 @@ public:
MessageAutoDeleteTimerChanged::Ptr parseJsonAndGetMessageAutoDeleteTimerChanged(const boost::property_tree::ptree& data) const;
std::string parseMessageAutoDeleteTimerChanged(const MessageAutoDeleteTimerChanged::Ptr& object) const;
+ ForumTopicCreated::Ptr parseJsonAndGetForumTopicCreated(const boost::property_tree::ptree& data) const;
+ std::string parseForumTopicCreated(const ForumTopicCreated::Ptr& object) const;
+
+ ForumTopicClosed::Ptr parseJsonAndGetForumTopicClosed(const boost::property_tree::ptree& data) const;
+ std::string parseForumTopicClosed(const ForumTopicClosed::Ptr& object) const;
+
+ ForumTopicReopened::Ptr parseJsonAndGetForumTopicReopened(const boost::property_tree::ptree& data) const;
+ std::string parseForumTopicReopened(const ForumTopicReopened::Ptr& object) const;
+
VideoChatScheduled::Ptr parseJsonAndGetVideoChatScheduled(const boost::property_tree::ptree& data) const;
std::string parseVideoChatScheduled(const VideoChatScheduled::Ptr& object) const;
@@ -316,6 +329,9 @@ public:
ChatLocation::Ptr parseJsonAndGetChatLocation(const boost::property_tree::ptree& data) const;
std::string parseChatLocation(const ChatLocation::Ptr& object) const;
+ ForumTopic::Ptr parseJsonAndGetForumTopic(const boost::property_tree::ptree& data) const;
+ std::string parseForumTopic(const ForumTopic::Ptr& object) const;
+
BotCommand::Ptr parseJsonAndGetBotCommand(const boost::property_tree::ptree& data) const;
std::string parseBotCommand(const BotCommand::Ptr& object) const;
diff --git a/include/tgbot/types/Chat.h b/include/tgbot/types/Chat.h
index 4a3f761..2d31289 100644
--- a/include/tgbot/types/Chat.h
+++ b/include/tgbot/types/Chat.h
@@ -8,6 +8,7 @@
#include <cstdint>
#include <memory>
#include <string>
+#include <vector>
namespace TgBot {
@@ -33,8 +34,8 @@ public:
/**
* @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.
+ * This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it.
+ * But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
*/
std::int64_t id;
@@ -64,106 +65,141 @@ public:
std::string lastName;
/**
+ * @brief Optional. True, if the supergroup chat is a forum (has topics enabled)
+ */
+ bool isForum;
+
+ /**
* @brief Optional. Chat photo.
+ *
* Returned only in Api::getChat.
*/
ChatPhoto::Ptr photo;
/**
+ * @brief Optional. If non-empty, the list of all active chat usernames; for private chats, supergroups and channels.
+ *
+ * Returned only in Api::getChat.
+ */
+ std::vector<std::string> activeUsernames;
+
+ /**
+ * @brief Optional. Custom emoji identifier of emoji status of the other party in a private chat.
+ *
+ * Returned only in Api::getChat.
+ */
+ std::string emojiStatusCustomEmojiId;
+
+ /**
* @brief Optional. Bio of the other party in a private chat.
+ *
* Returned only in Api::getChat.
*/
std::string bio;
/**
* @brief Optional. True, if privacy settings of the other party in the private chat allows to use tg://user?id=<user_id> links only in chats with the user.
+ *
* Returned only in Api::getChat.
*/
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.
*/
bool joinToSendMessages;
/**
* @brief Optional. True, if all users directly joining the supergroup need to be approved by supergroup administrators.
+ *
* Returned only in Api::getChat.
*/
bool joinByRequest;
/**
* @brief Optional. Description, for groups, supergroups and channel chats.
+ *
* Returned only in Api::getChat.
*/
std::string description;
/**
* @brief Optional. Primary invite link, for groups, supergroups and channel chats.
+ *
* Returned only in Api::getChat.
*/
std::string inviteLink;
/**
* @brief Optional. The most recent pinned message (by sending date).
+ *
* Returned only in Api::getChat.
*/
std::shared_ptr<Message> pinnedMessage;
/**
* @brief Optional. Default chat member permissions, for groups and supergroups.
+ *
* Returned only in Api::getChat.
*/
ChatPermissions::Ptr permissions;
/**
* @brief Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unpriviledged user; in seconds.
+ *
* Returned only in Api::getChat.
*/
std::int32_t slowModeDelay;
/**
* @brief Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds.
+ *
* Returned only in Api::getChat.
*/
std::int32_t messageAutoDeleteTime;
/**
* @brief Optional. True, if messages from the chat can't be forwarded to other chats.
+ *
* Returned only in Api::getChat.
*/
bool hasProtectedContent;
/**
* @brief Optional. For supergroups, name of group sticker set.
+ *
* Returned only in Api::getChat.
*/
std::string stickerSetName;
/**
* @brief Optional. True, if the bot can change the group sticker set.
+ *
* Returned only in Api::getChat.
*/
bool canSetStickerSet;
/**
* @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.
- * Returned only in Api::getChat.
*
* This identifier 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.
+ * Returned only in Api::getChat.
*/
std::int64_t linkedChatId;
/**
* @brief Optional. For supergroups, the location to which the supergroup is connected.
+ *
* Returned only in Api::getChat.
*/
ChatLocation::Ptr location;
diff --git a/include/tgbot/types/ChatAdministratorRights.h b/include/tgbot/types/ChatAdministratorRights.h
index 52c70ca..8e20b18 100644
--- a/include/tgbot/types/ChatAdministratorRights.h
+++ b/include/tgbot/types/ChatAdministratorRights.h
@@ -21,6 +21,7 @@ public:
/**
* @brief True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode.
+ *
* Implied by any other administrator privilege
*/
bool canManageChat;
@@ -69,6 +70,11 @@ public:
* @brief Optional. True, if the user is allowed to pin messages; groups and supergroups only
*/
bool canPinMessages;
+
+ /**
+ * @brief Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only
+ */
+ bool canManageTopics;
};
}
diff --git a/include/tgbot/types/ChatMemberAdministrator.h b/include/tgbot/types/ChatMemberAdministrator.h
index 02fc6bd..714ed1d 100644
--- a/include/tgbot/types/ChatMemberAdministrator.h
+++ b/include/tgbot/types/ChatMemberAdministrator.h
@@ -35,6 +35,7 @@ public:
/**
* @brief True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode.
+ *
* Implied by any other administrator privilege
*/
bool canManageChat;
@@ -45,7 +46,7 @@ public:
bool canDeleteMessages;
/**
- * @brief rue, if the administrator can manage video chats
+ * @brief True, if the administrator can manage video chats
*/
bool canManageVideoChats;
@@ -85,6 +86,11 @@ public:
bool canPinMessages;
/**
+ * @brief Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only
+ */
+ bool canManageTopics;
+
+ /**
* @brief Optional. Custom title for this user
*/
std::string customTitle;
diff --git a/include/tgbot/types/ChatMemberRestricted.h b/include/tgbot/types/ChatMemberRestricted.h
index d64c849..ab19b03 100644
--- a/include/tgbot/types/ChatMemberRestricted.h
+++ b/include/tgbot/types/ChatMemberRestricted.h
@@ -10,6 +10,7 @@ namespace TgBot {
/**
* @brief Represents a chat member that is under certain restrictions in the chat.
+ *
* Supergroups only.
*
* @ingroup types
@@ -40,11 +41,16 @@ public:
bool canInviteUsers;
/**
- * @brief True, if the user is allowed to pin messages; groups and supergroups only
+ * @brief True, if the user is allowed to pin messages
*/
bool canPinMessages;
/**
+ * @brief True, if the user is allowed to create forum topics
+ */
+ bool canManageTopics;
+
+ /**
* @brief True, if the user is allowed to send text messages, contacts, locations and venues
*/
bool canSendMessages;
@@ -70,7 +76,9 @@ public:
bool canAddWebPagePreviews;
/**
- * @brief Date when restrictions will be lifted for this user; unix time
+ * @brief Date when restrictions will be lifted for this user; unix time.
+ *
+ * If 0, then the user is restricted forever
*/
std::uint32_t untilDate;
};
diff --git a/include/tgbot/types/ChatPermissions.h b/include/tgbot/types/ChatPermissions.h
index e6500db..0d8e056 100644
--- a/include/tgbot/types/ChatPermissions.h
+++ b/include/tgbot/types/ChatPermissions.h
@@ -1,63 +1,71 @@
-#ifndef TGBOT_CPP_CHATPERMISSIONS_H
-#define TGBOT_CPP_CHATPERMISSIONS_H
+#ifndef TGBOT_CHATPERMISSIONS_H
+#define TGBOT_CHATPERMISSIONS_H
#include <memory>
-#include <string>
namespace TgBot {
- /**
- * @brief This object describes actions that a non-administrator user is allowed to take in a chat.
- * @ingroup types
- */
-
- class ChatPermissions {
- public:
- typedef std::shared_ptr<ChatPermissions> Ptr;
+/**
+ * @brief Describes actions that a non-administrator user is allowed to take in a chat.
+ *
+ * @ingroup types
+ */
- /**
- * @brief Optional. True, if the user is allowed to send text messages, contacts, locations and venues.
- */
- bool canSendMessages = false;
+class ChatPermissions {
+public:
+ typedef std::shared_ptr<ChatPermissions> Ptr;
- /**
- * @brief Optional. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies can_send_messages.
- */
- bool canSendMediaMessages = false;
-
- /**
- * @brief Optional. True, if the user is allowed to send polls, implies can_send_messages.
- */
- bool canSendPolls = false;
+ /**
+ * @brief Optional. True, if the user is allowed to send text messages, contacts, locations and venues
+ */
+ bool canSendMessages;
- /**
- * @brief Optional. True, if the user is allowed to send animations, games, stickers and use inline bots, implies can_send_media_messages.
- */
- bool canSendOtherMessages = false;
+ /**
+ * @brief Optional. True, if the user is allowed to send audios, documents, photos, videos, video notes and voice notes, implies canSendMessages
+ */
+ bool canSendMediaMessages;
- /**
- * @brief Optional. True, if the user is allowed to add web page previews to their messages, implies can_send_media_messages.
- */
- bool canAddWebPagePreviews = false;
+ /**
+ * @brief Optional. True, if the user is allowed to send polls, implies canSendMessages
+ */
+ bool canSendPolls;
- /**
- * @brief Optional. True, if the user is allowed to change the chat title, photo and other settings. Ignored in public supergroups.
- */
- bool canChangeInfo = false;
+ /**
+ * @brief Optional. True, if the user is allowed to send animations, games, stickers and use inline bots, implies canSendMediaMessages
+ */
+ bool canSendOtherMessages;
- /**
- * @brief Optional. True, if the user is allowed to invite new users to the chat.
- */
- bool canInviteUsers = false;
+ /**
+ * @brief Optional. True, if the user is allowed to add web page previews to their messages, implies canSendMediaMessages
+ */
+ bool canAddWebPagePreviews;
- /**
- * @brief Optional. True, if the user is allowed to pin messages. Ignored in public supergroups.
- */
- bool canPinMessages = false;
+ /**
+ * @brief Optional. True, if the user is allowed to change the chat title, photo and other settings.
+ *
+ * Ignored in public supergroups
+ */
+ bool canChangeInfo;
+ /**
+ * @brief Optional. True, if the user is allowed to invite new users to the chat
+ */
+ bool canInviteUsers;
+ /**
+ * @brief Optional. True, if the user is allowed to pin messages.
+ *
+ * Ignored in public supergroups
+ */
+ bool canPinMessages;
- };
+ /**
+ * @brief Optional. True, if the user is allowed to create forum topics.
+ *
+ * If omitted defaults to the value of canPinMessages
+ */
+ bool canManageTopics;
+};
}
-#endif //TGBOT_CPP_CHATPERMISSIONS_H
+#endif //TGBOT_CHATPERMISSIONS_H
diff --git a/include/tgbot/types/ForumTopic.h b/include/tgbot/types/ForumTopic.h
new file mode 100644
index 0000000..9821cd1
--- /dev/null
+++ b/include/tgbot/types/ForumTopic.h
@@ -0,0 +1,41 @@
+#ifndef TGBOT_FORUMTOPIC_H
+#define TGBOT_FORUMTOPIC_H
+
+#include <cstdint>
+#include <string>
+#include <memory>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents a forum topic.
+ *
+ * @ingroup types
+ */
+class ForumTopic {
+public:
+ typedef std::shared_ptr<ForumTopic> Ptr;
+
+ /**
+ * @brief Unique identifier of the forum topic
+ */
+ std::int32_t messageThreadId;
+
+ /**
+ * @brief Name of the topic
+ */
+ std::string name;
+
+ /**
+ * @brief Color of the topic icon in RGB format
+ */
+ std::int32_t iconColor;
+
+ /**
+ * @brief Optional. Unique identifier of the custom emoji shown as the topic icon
+ */
+ std::string iconCustomEmojiId;
+};
+}
+
+#endif //TGBOT_FORUMTOPIC_H
diff --git a/include/tgbot/types/ForumTopicClosed.h b/include/tgbot/types/ForumTopicClosed.h
new file mode 100644
index 0000000..7e71a09
--- /dev/null
+++ b/include/tgbot/types/ForumTopicClosed.h
@@ -0,0 +1,21 @@
+#ifndef TGBOT_FORUMTOPICCLOSED_H
+#define TGBOT_FORUMTOPICCLOSED_H
+
+#include <memory>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents a service message about a forum topic closed in the chat.
+ *
+ * Currently holds no information.
+ *
+ * @ingroup types
+ */
+class ForumTopicClosed {
+public:
+ typedef std::shared_ptr<ForumTopicClosed> Ptr;
+};
+}
+
+#endif //TGBOT_FORUMTOPICCLOSED_H
diff --git a/include/tgbot/types/ForumTopicCreated.h b/include/tgbot/types/ForumTopicCreated.h
new file mode 100644
index 0000000..58bbf20
--- /dev/null
+++ b/include/tgbot/types/ForumTopicCreated.h
@@ -0,0 +1,36 @@
+#ifndef TGBOT_FORUMTOPICCREATED_H
+#define TGBOT_FORUMTOPICCREATED_H
+
+#include <cstdint>
+#include <string>
+#include <memory>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents a service message about a new forum topic created in the chat.
+ *
+ * @ingroup types
+ */
+class ForumTopicCreated {
+public:
+ typedef std::shared_ptr<ForumTopicCreated> Ptr;
+
+ /**
+ * @brief Name of the topic
+ */
+ std::string name;
+
+ /**
+ * @brief Color of the topic icon in RGB format
+ */
+ std::int32_t iconColor;
+
+ /**
+ * @brief Optional. Unique identifier of the custom emoji shown as the topic icon
+ */
+ std::string iconCustomEmojiId;
+};
+}
+
+#endif //TGBOT_FORUMTOPICCREATED_H
diff --git a/include/tgbot/types/ForumTopicReopened.h b/include/tgbot/types/ForumTopicReopened.h
new file mode 100644
index 0000000..64f5d39
--- /dev/null
+++ b/include/tgbot/types/ForumTopicReopened.h
@@ -0,0 +1,21 @@
+#ifndef TGBOT_FORUMTOPICREOPENED_H
+#define TGBOT_FORUMTOPICREOPENED_H
+
+#include <memory>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents a service message about a forum topic reopened in the chat.
+ *
+ * Currently holds no information.
+ *
+ * @ingroup types
+ */
+class ForumTopicReopened {
+public:
+ typedef std::shared_ptr<ForumTopicReopened> Ptr;
+};
+}
+
+#endif //TGBOT_FORUMTOPICREOPENED_H
diff --git a/include/tgbot/types/Message.h b/include/tgbot/types/Message.h
index 2c7915a..4d1ea7b 100644
--- a/include/tgbot/types/Message.h
+++ b/include/tgbot/types/Message.h
@@ -24,6 +24,9 @@
#include "tgbot/types/SuccessfulPayment.h"
#include "tgbot/types/PassportData.h"
#include "tgbot/types/ProximityAlertTriggered.h"
+#include "tgbot/types/ForumTopicCreated.h"
+#include "tgbot/types/ForumTopicClosed.h"
+#include "tgbot/types/ForumTopicReopened.h"
#include "tgbot/types/VideoChatScheduled.h"
#include "tgbot/types/VideoChatStarted.h"
#include "tgbot/types/VideoChatEnded.h"
@@ -53,13 +56,20 @@ public:
std::int32_t messageId;
/**
+ * @brief Optional. Unique identifier of a message thread to which the message belongs; for supergroups only
+ */
+ std::int32_t messageThreadId;
+
+ /**
* @brief Optional. Sender of the message; empty for messages sent to channels.
+ *
* For backward compatibility, the field contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.
*/
User::Ptr from;
/**
* @brief Optional. Sender of the message, sent on behalf of a chat.
+ *
* For example, the channel itself for channel posts, the supergroup itself for messages from anonymous group administrators, the linked channel for messages automatically forwarded to the discussion group.
* For backward compatibility, the field from contains a fake sender user in non-channel chats, if the message was sent on behalf of a chat.
*/
@@ -91,7 +101,7 @@ public:
std::int32_t forwardFromMessageId;
/**
- * @brief Optional. For messages forwarded from channels, signature of the post author if present
+ * @brief Optional. For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present
*/
std::string forwardSignature;
@@ -106,12 +116,18 @@ public:
std::int32_t forwardDate;
/**
+ * @brief Optional. True, if the message is sent to a forum topic
+ */
+ bool isTopicMessage;
+
+ /**
* @brief Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group
*/
bool isAutomaticForward;
/**
* @brief Optional. For replies, the original message.
+ *
* Note that the Message object in this field will not contain further replyToMessage fields even if it itself is a reply.
*/
Message::Ptr replyToMessage;
@@ -142,7 +158,7 @@ public:
std::string authorSignature;
/**
- * @brief Optional. For text messages, the actual UTF-8 text of the message, 0-4096 characters
+ * @brief Optional. For text messages, the actual UTF-8 text of the message
*/
std::string text;
@@ -153,6 +169,7 @@ public:
/**
* @brief Optional. Message is an animation, information about the animation.
+ *
* For backward compatibility, when this field is set, the document field will also be set
*/
Animation::Ptr animation;
@@ -193,7 +210,7 @@ public:
Voice::Ptr voice;
/**
- * @brief Optional. Caption for the animation, audio, document, photo, video or voice, 0-1024 characters
+ * @brief Optional. Caption for the animation, audio, document, photo, video or voice
*/
std::string caption;
@@ -213,7 +230,7 @@ public:
Dice::Ptr dice;
/**
- * @brief Optional. Message is a game, information about the game
+ * @brief Optional. Message is a game, information about the game. https://core.telegram.org/bots/api#games
*/
Game::Ptr game;
@@ -224,6 +241,7 @@ public:
/**
* @brief Optional. Message is a venue, information about the venue.
+ *
* For backward compatibility, when this field is set, the location field will also be set
*/
Venue::Ptr venue;
@@ -234,7 +252,7 @@ public:
Location::Ptr location;
/**
- * @brief Optional. Optional. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)
+ * @brief Optional. New members that were added to the group or supergroup and information about them (the bot itself may be one of these members)
*/
std::vector<User::Ptr> newChatMembers;
@@ -265,6 +283,7 @@ public:
/**
* @brief Optional. Service message: the supergroup has been created.
+ *
* This field can't be received in a message coming through updates, because bot can't be a member of a supergroup when it is created.
* It can only be found in replyToMessage if someone replies to a very first message in a directly created supergroup.
*/
@@ -272,6 +291,7 @@ public:
/**
* @brief Optional. Service message: the channel has been created.
+ *
* This field can't be received in a message coming through updates, because bot can't be a member of a channel when it is created.
* It can only be found in replyToMessage if someone replies to a very first message in a channel.
*/
@@ -285,39 +305,43 @@ public:
/**
* @brief Optional. The group has been migrated to a supergroup with the specified identifier.
*
- * 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.
+ * This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it.
+ * But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
*/
std::int64_t migrateToChatId;
/**
* @brief Optional. The supergroup has been migrated from a group with the specified identifier.
*
- * 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.
+ * This number may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting it.
+ * But it has at most 52 significant bits, so a signed 64-bit integer or double-precision float type are safe for storing this identifier.
*/
std::int64_t migrateFromChatId;
/**
* @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.
*/
Message::Ptr pinnedMessage;
/**
* @brief Optional. Message is an invoice for a payment, information about the invoice.
+ *
* https://core.telegram.org/bots/api#payments
*/
Invoice::Ptr invoice;
/**
- * @brief Optional. Message is a service message about a successful payment, information about the payment
+ * @brief Optional. Message is a service message about a successful payment, information about the payment.
+ *
* https://core.telegram.org/bots/api#payments
*/
SuccessfulPayment::Ptr successfulPayment;
/**
* @brief Optional. The domain name of the website on which the user has logged in.
+ *
* https://core.telegram.org/widgets/login
*/
std::string connectedWebsite;
@@ -329,11 +353,27 @@ public:
/**
* @brief Optional. Service message.
+ *
* A user in the chat triggered another user's proximity alert while sharing Live Location.
*/
ProximityAlertTriggered::Ptr proximityAlertTriggered;
/**
+ * @brief Optional. Service message: forum topic created
+ */
+ ForumTopicCreated::Ptr forumTopicCreated;
+
+ /**
+ * @brief Optional. Service message: forum topic closed
+ */
+ ForumTopicClosed::Ptr forumTopicClosed;
+
+ /**
+ * @brief Optional. Service message: forum topic reopened
+ */
+ ForumTopicReopened::Ptr forumTopicReopened;
+
+ /**
* @brief Optional. Service message: video chat scheduled
*/
VideoChatScheduled::Ptr videoChatScheduled;
@@ -360,6 +400,7 @@ public:
/**
* @brief Optional. Inline keyboard attached to the message.
+ *
* loginUrl buttons are represented as ordinary url buttons.
*/
InlineKeyboardMarkup::Ptr replyMarkup;