summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--README.md5
-rw-r--r--include/tgbot/Api.h470
-rw-r--r--include/tgbot/TgTypeParser.h138
-rw-r--r--include/tgbot/types/Chat.h101
-rw-r--r--include/tgbot/types/ChatAdministratorRights.h9
-rw-r--r--include/tgbot/types/ChatBoost.h44
-rw-r--r--include/tgbot/types/ChatBoostRemoved.h45
-rw-r--r--include/tgbot/types/ChatBoostSource.h42
-rw-r--r--include/tgbot/types/ChatBoostSourceGiftCode.h30
-rw-r--r--include/tgbot/types/ChatBoostSourceGiveaway.h43
-rw-r--r--include/tgbot/types/ChatBoostSourcePremium.h28
-rw-r--r--include/tgbot/types/ChatBoostUpdated.h33
-rw-r--r--include/tgbot/types/ChatJoinRequest.h5
-rw-r--r--include/tgbot/types/ChatMemberAdministrator.h11
-rw-r--r--include/tgbot/types/ChatMemberRestricted.h9
-rw-r--r--include/tgbot/types/ChatPermissions.h18
-rw-r--r--include/tgbot/types/ExternalReplyInfo.h167
-rw-r--r--include/tgbot/types/ForceReply.h27
-rw-r--r--include/tgbot/types/Giveaway.h68
-rw-r--r--include/tgbot/types/GiveawayCompleted.h38
-rw-r--r--include/tgbot/types/GiveawayCreated.h22
-rw-r--r--include/tgbot/types/GiveawayWinners.h81
-rw-r--r--include/tgbot/types/InaccessibleMessage.h40
-rw-r--r--include/tgbot/types/InputTextMessageContent.h13
-rw-r--r--include/tgbot/types/KeyboardButton.h41
-rw-r--r--include/tgbot/types/KeyboardButtonRequestUser.h45
-rw-r--r--include/tgbot/types/KeyboardButtonRequestUsers.h52
-rw-r--r--include/tgbot/types/LinkPreviewOptions.h48
-rw-r--r--include/tgbot/types/Message.h137
-rw-r--r--include/tgbot/types/MessageEntity.h21
-rw-r--r--include/tgbot/types/MessageOrigin.h42
-rw-r--r--include/tgbot/types/MessageOriginChannel.h46
-rw-r--r--include/tgbot/types/MessageOriginChat.h40
-rw-r--r--include/tgbot/types/MessageOriginHiddenUser.h34
-rw-r--r--include/tgbot/types/MessageOriginUser.h34
-rw-r--r--include/tgbot/types/MessageReactionCountUpdated.h45
-rw-r--r--include/tgbot/types/MessageReactionUpdated.h61
-rw-r--r--include/tgbot/types/ReactionCount.h33
-rw-r--r--include/tgbot/types/ReactionType.h34
-rw-r--r--include/tgbot/types/ReactionTypeCustomEmoji.h34
-rw-r--r--include/tgbot/types/ReactionTypeEmoji.h38
-rw-r--r--include/tgbot/types/ReplyKeyboardRemove.h22
-rw-r--r--include/tgbot/types/ReplyParameters.h67
-rw-r--r--include/tgbot/types/ShippingAddress.h17
-rw-r--r--include/tgbot/types/TextQuote.h49
-rw-r--r--include/tgbot/types/Update.h77
-rw-r--r--include/tgbot/types/UserChatBoosts.h28
-rw-r--r--include/tgbot/types/UserShared.h36
-rw-r--r--include/tgbot/types/UsersShared.h36
-rw-r--r--src/Api.cpp401
-rw-r--r--src/TgTypeParser.cpp898
-rw-r--r--src/types/ChatBoostSource.cpp11
-rw-r--r--src/types/MessageOrigin.cpp13
-rw-r--r--src/types/ReactionType.cpp9
54 files changed, 3202 insertions, 734 deletions
diff --git a/README.md b/README.md
index e79b244..e4005c5 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,10 @@ Documentation is located [here](http://reo7sp.github.io/tgbot-cpp).
## State
-- [x] Telegram Bot API 6.9
+- [x] Telegram Bot API 7.0
+- [ ] [MaybeInaccessibleMessage](https://core.telegram.org/bots/api#maybeinaccessiblemessage)
+- [ ] [Message->pinnedMessage](https://core.telegram.org/bots/api#message)
+- [ ] [CallbackQuery->message](https://core.telegram.org/bots/api#callbackquery)
- [ ] [Deep Linking](https://core.telegram.org/bots/features#deep-linking)
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h
index 9078da5..2b2b46b 100644
--- a/include/tgbot/Api.h
+++ b/include/tgbot/Api.h
@@ -55,16 +55,17 @@ public:
Api(std::string token, const HttpClient& httpClient, const std::string& url);
/**
- * @brief Use this method to receive incoming updates using long polling (https://en.wikipedia.org/wiki/Push_technology#Long_polling).
+ * @brief Use this method to receive incoming updates using long polling ([wiki](https://en.wikipedia.org/wiki/Push_technology#Long_polling)).
*
- * This method will not work if an outgoing webhook is set up.
- * In order to avoid getting duplicate updates, recalculate offset after each server response.
+ * Notes
+ * - This method will not work if an outgoing webhook is set up.
+ * - In order to avoid getting duplicate updates, recalculate offset after each server response.
*
- * @param offset Optional. Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as Api::getUpdates is called with an offset higher than its updateId. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will forgotten.
+ * @param offset Optional. Identifier of the first update to be returned. Must be greater by one than the highest among the identifiers of previously received updates. By default, updates starting with the earliest unconfirmed update are returned. An update is considered confirmed as soon as Api::getUpdates is called with an offset higher than its updateId. The negative offset can be specified to retrieve updates starting from -offset update from the end of the updates queue. All previous updates will be forgotten.
* @param limit Optional. Limits the number of updates to be retrieved. Values between 1-100 are accepted. Defaults to 100.
* @param timeout Optional. Timeout in seconds for long polling. Defaults to 0, i.e. usual short polling. Should be positive, short polling should be used for testing purposes only.
- * @param allowedUpdates Optional. A JSON-serialized list of the update types you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chatMember (default). If not specified, the previous setting will be used. Please note that this parameter doesn't affect updates created before the call to the Api::getUpdates, so unwanted updates may be received for a short period of time.
- *
+ * @param allowedUpdates Optional. A JSON-serialized list of the update types you want your bot to receive. For example, specify ["message", "edited_channel_post", "callback_query"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used. Please note that this parameter doesn't affect updates created before the call to the getUpdates, so unwanted updates may be received for a short period of time.
+ *
* @return Returns an Array of Update objects.
*/
std::vector<Update::Ptr> getUpdates(std::int32_t offset = 0,
@@ -74,30 +75,28 @@ public:
/**
* @brief Use this method to specify a URL and receive incoming updates via an outgoing webhook.
- *
+ *
* Whenever there is an update for the bot, we will send an HTTPS POST request to the specified URL, containing a JSON-serialized Update.
* In case of an unsuccessful request, we will give up after a reasonable amount of attempts.
*
* If you'd like to make sure that the webhook was set by you, you can specify secret data in the parameter secretToken.
* If specified, the request will contain a header “X-Telegram-Bot-Api-Secret-Token” with the secret token as content.
- *
- * You will not be able to receive updates using Api::getUpdates for as long as an outgoing webhook is set up.
- *
- * To use a self-signed certificate, you need to upload your public key certificate using certificate parameter.
- * Please upload as InputFile, sending a String will not work.
- *
- * Ports currently supported for webhooks: 443, 80, 88, 8443.
- *
- * If you're having any trouble setting up webhooks, please check out https://core.telegram.org/bots/webhooks.
+ *
+ * Notes
+ * - You will not be able to receive updates using Api::getUpdates for as long as an outgoing webhook is set up.
+ * - To use a self-signed certificate, you need to upload your [public key certificate](https://core.telegram.org/bots/self-signed) using certificate parameter. Please upload as InputFile, sending a String will not work.
+ * - Ports currently supported for webhooks: 443, 80, 88, 8443.
+ *
+ * If you're having any trouble setting up webhooks, please check out [this amazing guide to webhooks](https://core.telegram.org/bots/webhooks).
*
* @param url HTTPS URL to send updates to. Use an empty string to remove webhook integration
- * @param certificate Optional. Upload your public key certificate so that the root certificate in use can be checked. See https://core.telegram.org/bots/self-signed for details.
+ * @param certificate Optional. Upload your public key certificate so that the root certificate in use can be checked. See our [self-signed guide](https://core.telegram.org/bots/self-signed) for details.
* @param maxConnections Optional. The maximum allowed number of simultaneous HTTPS connections to the webhook for update delivery, 1-100. Defaults to 40. Use lower values to limit the load on your bot's server, and higher values to increase your bot's throughput.
- * @param allowedUpdates Optional. A JSON-serialized list of the update types you want your bot to receive. For example, specify [“message”, “edited_channel_post”, “callback_query”] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chatMember (default). If not specified, the previous setting will be used. Please note that this parameter doesn't affect updates created before the call to the Api::setWebhook, so unwanted updates may be received for a short period of time.
+ * @param allowedUpdates Optional. A JSON-serialized list of the update types you want your bot to receive. For example, specify ["message", "edited_channel_post", "callback_query"] to only receive updates of these types. See Update for a complete list of available update types. Specify an empty list to receive all update types except chat_member, message_reaction, and message_reaction_count (default). If not specified, the previous setting will be used. Please note that this parameter doesn't affect updates created before the call to the setWebhook, so unwanted updates may be received for a short period of time.
* @param ipAddress Optional. The fixed IP address which will be used to send webhook requests instead of the IP address resolved through DNS
* @param dropPendingUpdates Optional. Pass True to drop all pending updates
* @param secretToken Optional. A secret token to be sent in a header “X-Telegram-Bot-Api-Secret-Token” in every webhook request, 1-256 characters. Only characters A-Z, a-z, 0-9, _ and - are allowed. The header is useful to ensure that the request comes from a webhook set by you.
- *
+ *
* @return Returns True on success.
*/
bool setWebhook(const std::string& url,
@@ -163,43 +162,40 @@ public:
*
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param text Text of the message to be sent, 1-4096 characters after entities parsing
- * @param disableWebPagePreview Optional. Disables link previews for links in this message
- * @param replyToMessageId Optional. If the message is a reply, ID of the original message
- * @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 parseMode Optional. Mode for parsing entities in the message text. See https://core.telegram.org/bots/api#formatting-options for more details.
- * @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
+ * @param linkPreviewOptions Optional. Link preview generation options for the message
+ * @param replyParameters Optional. Description of the message to reply to
+ * @param replyMarkup Optional. Additional interface options. A JSON-serialized object for an [inline keyboard](https://core.telegram.org/bots/features#inline-keyboards), [custom reply keyboard](https://core.telegram.org/bots/features#keyboards), instructions to remove reply keyboard or to force a reply from the user.
+ * @param parseMode Optional. Mode for parsing entities in the message text. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
+ * @param disableNotification Optional. Sends the message [silently](https://telegram.org/blog/channels-2-0#silent-messages). Users will receive a notification with no sound.
* @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
- *
+ * @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ *
* @return On success, the sent Message is returned.
*/
-
Message::Ptr sendMessage(boost::variant<std::int64_t, std::string> chatId,
const std::string& text,
- bool disableWebPagePreview = false,
- std::int32_t replyToMessageId = 0,
+ LinkPreviewOptions::Ptr linkPreviewOptions = nullptr,
+ ReplyParameters::Ptr replyParameters = nullptr,
GenericReply::Ptr replyMarkup = nullptr,
const std::string& parseMode = "",
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& entities = std::vector<MessageEntity::Ptr>(),
- bool allowSendingWithoutReply = false,
- bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ std::int32_t messageThreadId = 0,
+ bool protectContent = false) const;
/**
* @brief Use this method to forward messages of any kind.
- *
- * Service messages can't be forwarded.
- *
+ *
+ * Service messages and messages with protected content can't be forwarded.
+ *
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param fromChatId Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
* @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 disableNotification Optional. Sends the message [silently](https://telegram.org/blog/channels-2-0#silent-messages). 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.
*/
Message::Ptr forwardMessage(boost::variant<std::int64_t, std::string> chatId,
@@ -210,25 +206,47 @@ public:
std::int32_t messageThreadId = 0) const;
/**
+ * @brief Use this method to forward multiple messages of any kind.
+ *
+ * If some of the specified messages can't be found or forwarded, they are skipped.
+ * Service messages and messages with protected content can't be forwarded.
+ * Album grouping is kept for forwarded messages.
+ *
+ * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
+ * @param fromChatId Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)
+ * @param messageIds Identifiers of 1-100 messages in the chat fromChatId to forward. The identifiers must be specified in a strictly increasing order.
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+ * @param disableNotification Optional. Sends the messages [silently](https://telegram.org/blog/channels-2-0#silent-messages). Users will receive a notification with no sound.
+ * @param protectContent Optional. Protects the contents of the forwarded message from forwarding and saving
+ *
+ * @return On success, an array of MessageId of the sent messages is returned.
+ */
+ std::vector<MessageId::Ptr> forwardMessages(boost::variant<std::int64_t, std::string> chatId,
+ boost::variant<std::int64_t, std::string> fromChatId,
+ const std::vector<std::int32_t>& messageIds,
+ std::int32_t messageThreadId = 0,
+ bool disableNotification = false,
+ bool protectContent = false) const;
+
+ /**
* @brief Use this method to copy messages of any kind.
- *
- * Service messages and invoice messages can't be copied.
- * A quiz poll can be copied only if the value of the field correctOptionId is known to the bot.
+ *
+ * Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied.
+ * A quiz Poll can be copied only if the value of the field correctOptionId is known to the bot.
* The method is analogous to the method Api::forwardMessage, but the copied message doesn't have a link to the original message.
- *
+ *
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param fromChatId Unique identifier for the chat where the original message was sent (or channel username in the format @channelusername)
* @param messageId Message identifier in the chat specified in fromChatId
* @param caption Optional. New caption for media, 0-1024 characters after entities parsing. If not specified, the original caption is kept
- * @param parseMode Optional. Mode for parsing entities in the new caption. See https://core.telegram.org/bots/api#formatting-options for more details.
+ * @param parseMode Optional. Mode for parsing entities in the new caption. See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
* @param captionEntities Optional. A JSON-serialized list of special entities that appear in the new caption, which can be specified instead of parseMode
- * @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
- * @param replyToMessageId Optional. If the message is 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 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 disableNotification Optional. Sends the message [silently](https://telegram.org/blog/channels-2-0#silent-messages). Users will receive a notification with no sound.
+ * @param replyParameters Optional. Description of the message to reply to
+ * @param replyMarkup Optional. Additional interface options. A JSON-serialized object for an [inline keyboard](https://core.telegram.org/bots/features#inline-keyboards), [custom reply keyboard](https://core.telegram.org/bots/features#keyboards), 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.
*/
MessageId::Ptr copyMessage(boost::variant<std::int64_t, std::string> chatId,
@@ -238,51 +256,75 @@ public:
const std::string& parseMode = "",
const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
bool disableNotification = false,
- std::int32_t replyToMessageId = 0,
- bool allowSendingWithoutReply = false,
+ ReplyParameters::Ptr replyParameters = nullptr,
GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
bool protectContent = false,
std::int32_t messageThreadId = 0) const;
/**
+ * @brief Use this method to copy messages of any kind.
+ *
+ * If some of the specified messages can't be found or copied, they are skipped.
+ * Service messages, giveaway messages, giveaway winners messages, and invoice messages can't be copied.
+ * A quiz Poll can be copied only if the value of the field correctOptionId is known to the bot.
+ * The method is analogous to the method Api::forwardMessages, but the copied messages don't have a link to the original message.
+ * Album grouping is kept for copied messages.
+ *
+ * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
+ * @param fromChatId Unique identifier for the chat where the original messages were sent (or channel username in the format @channelusername)
+ * @param messageIds Identifiers of 1-100 messages in the chat fromChatId to copy. The identifiers must be specified in a strictly increasing order.
+ * @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
+ * @param disableNotification Optional. Sends the messages [silently](https://telegram.org/blog/channels-2-0#silent-messages). Users will receive a notification with no sound.
+ * @param protectContent Optional. Protects the contents of the sent messages from forwarding and saving
+ * @param removeCaption Optional. Pass True to copy the messages without their captions
+ *
+ * @return On success, an array of MessageId of the sent messages is returned.
+ */
+ std::vector<MessageId::Ptr> copyMessages(boost::variant<std::int64_t, std::string> chatId,
+ boost::variant<std::int64_t, std::string> fromChatId,
+ const std::vector<std::int32_t>& messageIds,
+ std::int32_t messageThreadId = 0,
+ bool disableNotification = false,
+ bool protectContent = false,
+ bool removeCaption = false) const;
+
+ /**
* @brief Use this method to send photos.
- *
+ *
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param photo Photo to send. Pass a fileId as String to send a photo that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a photo from the Internet, or upload a new photo using multipart/form-data. The photo must be at most 10 MB in size. The photo's width and height must not exceed 10000 in total. Width and height ratio must be at most 20. https://core.telegram.org/bots/api#sending-files
* @param caption Optional. Photo caption (may also be used when resending photos by fileId), 0-1024 characters after entities parsing
- * @param replyToMessageId Optional. If the message is a reply, ID of the original message
+ * @param replyParameters Optional. Description of the message to reply to
* @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 parseMode Optional. Mode for parsing entities in the photo caption. See https://core.telegram.org/bots/api#formatting-options for more details.
* @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
* @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
+ * @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
* @param hasSpoiler Optional. Pass True if the photo needs to be covered with a spoiler animation
- *
+ *
* @return On success, the sent Message is returned.
*/
Message::Ptr sendPhoto(boost::variant<std::int64_t, std::string> chatId,
boost::variant<InputFile::Ptr, std::string> photo,
const std::string& caption = "",
- std::int32_t replyToMessageId = 0,
+ ReplyParameters::Ptr replyParameters = nullptr,
GenericReply::Ptr replyMarkup = nullptr,
const std::string& parseMode = "",
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
- bool allowSendingWithoutReply = false,
- bool protectContent = false,
std::int32_t messageThreadId = 0,
+ bool protectContent = false,
bool hasSpoiler = false) const;
/**
* @brief Use this method to send audio files, if you want Telegram clients to display them in the music player.
- *
+ *
* Your audio must be in the .MP3 or .M4A format.
* Bots can currently send audio files of up to 50 MB in size, this limit may be changed in the future.
- *
+ *
* For sending voice messages, use the Api::sendVoice method instead.
- *
+ *
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param audio Audio file to send. Pass a fileId as String to send an audio file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get an audio file from the Internet, or upload a new one using multipart/form-data. https://core.telegram.org/bots/api#sending-files
* @param caption Optional. Audio caption, 0-1024 characters after entities parsing
@@ -290,15 +332,14 @@ public:
* @param performer Optional. Performer
* @param title Optional. Track name
* @param thumbnail Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. https://core.telegram.org/bots/api#sending-files
- * @param replyToMessageId Optional. If the message is a reply, ID of the original message
+ * @param replyParameters Optional. Description of the message to reply to
* @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 parseMode Optional. Mode for parsing entities in the audio caption. See https://core.telegram.org/bots/api#formatting-options for more details.
* @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
* @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
- *
+ * @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ *
* @return On success, the sent Message is returned.
*/
Message::Ptr sendAudio(boost::variant<std::int64_t, std::string> chatId,
@@ -308,55 +349,52 @@ public:
const std::string& performer = "",
const std::string& title = "",
boost::variant<InputFile::Ptr, std::string> thumbnail = "",
- std::int32_t replyToMessageId = 0,
+ ReplyParameters::Ptr replyParameters = nullptr,
GenericReply::Ptr replyMarkup = nullptr,
const std::string& parseMode = "",
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
- bool allowSendingWithoutReply = false,
- bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ std::int32_t messageThreadId = 0,
+ bool protectContent = false) const;
/**
* @brief Use this method to send general files.
- *
+ *
* Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
- *
+ *
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param document File to send. Pass a fileId as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. https://core.telegram.org/bots/api#sending-files
* @param thumbnail Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. https://core.telegram.org/bots/api#sending-files
* @param caption Optional. Document caption (may also be used when resending documents by fileId), 0-1024 characters after entities parsing
- * @param replyToMessageId Optional. If the message is a reply, ID of the original message
+ * @param replyParameters Optional. Description of the message to reply to
* @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 parseMode Optional. Mode for parsing entities in the document caption. See https://core.telegram.org/bots/api#formatting-options for more details.
* @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
* @param captionEntities Optional. A JSON-serialized list of special entities that appear in the caption, which can be specified instead of parseMode
* @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
- *
+ * @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ *
* @return On success, the sent Message is returned.
*/
Message::Ptr sendDocument(boost::variant<std::int64_t, std::string> chatId,
boost::variant<InputFile::Ptr, std::string> document,
boost::variant<InputFile::Ptr, std::string> thumbnail = "",
const std::string& caption = "",
- std::int32_t replyToMessageId = 0,
+ ReplyParameters::Ptr replyParameters = nullptr,
GenericReply::Ptr replyMarkup = nullptr,
const std::string& parseMode = "",
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
bool disableContentTypeDetection = false,
- bool allowSendingWithoutReply = false,
- bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ std::int32_t messageThreadId = 0,
+ bool protectContent = false) const;
/**
* @brief Use this method to send video files, Telegram clients support MPEG4 videos (other formats may be sent as Document).
- *
+ *
* Bots can currently send video files of up to 50 MB in size, this limit may be changed in the future.
- *
+ *
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param video Video to send. Pass a fileId as String to send a video that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a video from the Internet, or upload a new video using multipart/form-data. https://core.telegram.org/bots/api#sending-files
* @param supportsStreaming Optional. Pass True if the uploaded video is suitable for streaming
@@ -365,16 +403,15 @@ public:
* @param height Optional. Video height
* @param thumbnail Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. https://core.telegram.org/bots/api#sending-files
* @param caption Optional. Video caption (may also be used when resending videos by fileId), 0-1024 characters after entities parsing
- * @param replyToMessageId Optional. If the message is a reply, ID of the original message
+ * @param replyParameters Optional. Description of the message to reply to
* @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 parseMode Optional. Mode for parsing entities in the video caption. See https://core.telegram.org/bots/api#formatting-options for more details.
* @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
* @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
+ * @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
* @param hasSpoiler Optional. Pass True if the video needs to be covered with a spoiler animation
- *
+ *
* @return On success, the sent Message is returned.
*/
Message::Ptr sendVideo(boost::variant<std::int64_t, std::string> chatId,
@@ -385,19 +422,18 @@ public:
std::int32_t height = 0,
boost::variant<InputFile::Ptr, std::string> thumbnail = "",
const std::string& caption = "",
- std::int32_t replyToMessageId = 0,
+ ReplyParameters::Ptr replyParameters = nullptr,
GenericReply::Ptr replyMarkup = nullptr,
const std::string& parseMode = "",
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
- bool allowSendingWithoutReply = false,
- bool protectContent = false,
std::int32_t messageThreadId = 0,
+ bool protectContent = false,
bool hasSpoiler = false) const;
/**
* @brief Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
- *
+ *
* Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
*
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
@@ -407,16 +443,15 @@ public:
* @param height Optional. Animation height
* @param thumbnail Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. https://core.telegram.org/bots/api#sending-files
* @param caption Optional. Animation caption (may also be used when resending animation by fileId), 0-1024 characters after entities parsing
- * @param replyToMessageId Optional. If the message is a reply, ID of the original message
+ * @param replyParameters Optional. Description of the message to reply to
* @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 parseMode Optional. Mode for parsing entities in the animation caption. See https://core.telegram.org/bots/api#formatting-options for more details.
* @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
* @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
+ * @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
* @param hasSpoiler Optional. Pass True if the animation needs to be covered with a spoiler animation
- *
+ *
* @return On success, the sent Message is returned.
*/
Message::Ptr sendAnimation(boost::variant<std::int64_t, std::string> chatId,
@@ -426,136 +461,127 @@ public:
std::int32_t height = 0,
boost::variant<InputFile::Ptr, std::string> thumbnail = "",
const std::string& caption = "",
- std::int32_t replyToMessageId = 0,
+ ReplyParameters::Ptr replyParameters = nullptr,
GenericReply::Ptr replyMarkup = nullptr,
const std::string& parseMode = "",
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
- bool allowSendingWithoutReply = false,
- bool protectContent = false,
std::int32_t messageThreadId = 0,
+ bool protectContent = false,
bool hasSpoiler = false) const;
/**
* @brief Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message.
- *
+ *
* For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document).
* Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
- *
+ *
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param voice Audio file to send. Pass a fileId as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. https://core.telegram.org/bots/api#sending-files
* @param caption Optional. Voice message caption, 0-1024 characters after entities parsing
* @param duration Optional. Duration of the voice message in seconds
- * @param replyToMessageId Optional. If the message is a reply, ID of the original message
+ * @param replyParameters Optional. Description of the message to reply to
* @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 parseMode Optional. Mode for parsing entities in the voice message caption. See https://core.telegram.org/bots/api#formatting-options for more details.
* @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
* @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
- *
+ * @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ *
* @return On success, the sent Message is returned.
*/
Message::Ptr sendVoice(boost::variant<std::int64_t, std::string> chatId,
boost::variant<InputFile::Ptr, std::string> voice,
const std::string& caption = "",
std::int32_t duration = 0,
- std::int32_t replyToMessageId = 0,
+ ReplyParameters::Ptr replyParameters = nullptr,
GenericReply::Ptr replyMarkup = nullptr,
const std::string& parseMode = "",
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
- bool allowSendingWithoutReply = false,
- bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ std::int32_t messageThreadId = 0,
+ bool protectContent = false) const;
/**
* @brief Use this method to send video messages.
- *
+ *
* As of v.4.0, Telegram clients support rounded square MPEG4 videos of up to 1 minute long.
- *
+ *
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param videoNote Video note to send. Pass a fileId as String to send a video note that exists on the Telegram servers (recommended) or upload a new video using multipart/form-data. https://core.telegram.org/bots/api#sending-files. Sending video notes by a URL is currently unsupported
- * @param replyToMessageId Optional. If the message is a reply, ID of the original message
+ * @param replyParameters Optional. Description of the message to reply to
* @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
* @param duration Optional. Duration of sent video in seconds
* @param length Optional. Video width and height, i.e. diameter of the video message
* @param thumbnail Optional. Thumbnail of the file sent; can be ignored if thumbnail generation for the file is supported server-side. The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail's width and height should not exceed 320. Ignored if the file is not uploaded using multipart/form-data. Thumbnails can't be reused and can be only uploaded as a new file, so you can pass “attach://<file_attach_name>” if the thumbnail was uploaded using multipart/form-data under <file_attach_name>. https://core.telegram.org/bots/api#sending-files
* @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
- *
+ * @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ *
* @return On success, the sent Message is returned.
*/
Message::Ptr sendVideoNote(boost::variant<std::int64_t, std::string> chatId,
boost::variant<InputFile::Ptr, std::string> videoNote,
- std::int64_t replyToMessageId = 0,
+ ReplyParameters::Ptr replyParameters = nullptr,
bool disableNotification = false,
std::int32_t duration = 0,
std::int32_t length = 0,
boost::variant<InputFile::Ptr, std::string> thumbnail = "",
GenericReply::Ptr replyMarkup = nullptr,
- bool allowSendingWithoutReply = false,
- bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ std::int32_t messageThreadId = 0,
+ bool protectContent = false) const;
/**
* @brief Use this method to send a group of photos, videos, documents or audios as an album.
- *
+ *
* Documents and audio files can be only grouped in an album with messages of the same type.
- *
+ *
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param media A JSON-serialized array describing messages to be sent, must include 2-10 items
* @param disableNotification Optional. Sends messages silently. Users will receive a notification with no sound.
- * @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 replyParameters Optional. Description of the message to reply to
* @param messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
- *
+ * @param protectContent Optional. Protects the contents of the sent messages from forwarding and saving
+ *
* @return On success, an array of Messages that were sent is returned.
*/
std::vector<Message::Ptr> sendMediaGroup(boost::variant<std::int64_t, std::string> chatId,
const std::vector<InputMedia::Ptr>& media,
bool disableNotification = false,
- std::int32_t replyToMessageId = 0,
- bool allowSendingWithoutReply = false,
- bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ ReplyParameters::Ptr replyParameters = nullptr,
+ std::int32_t messageThreadId = 0,
+ bool protectContent = false) const;
/**
* @brief Use this method to send point on the map.
- *
+ *
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param latitude Latitude of the location
* @param longitude Longitude of the location
* @param livePeriod Optional. Period in seconds for which the location will be updated (see https://telegram.org/blog/live-locations, should be between 60 and 86400.
- * @param replyToMessageId Optional. If the message is a reply, ID of the original message
+ * @param replyParameters Optional. Description of the message to reply to
* @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 disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
* @param horizontalAccuracy Optional. The radius of uncertainty for the location, measured in meters; 0-1500
* @param heading Optional. For live locations, a direction in which the user is moving, in degrees. Must be between 1 and 360 if specified.
* @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
- *
+ * @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ *
* @return On success, the sent Message is returned.
*/
Message::Ptr sendLocation(boost::variant<std::int64_t, std::string> chatId,
float latitude,
float longitude,
std::int32_t livePeriod = 0,
- std::int32_t replyToMessageId = 0,
+ ReplyParameters::Ptr replyParameters = nullptr,
GenericReply::Ptr replyMarkup = nullptr,
bool disableNotification = false,
float horizontalAccuracy = 0,
std::int32_t heading = 0,
std::int32_t proximityAlertRadius = 0,
- bool allowSendingWithoutReply = false,
- bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ std::int32_t messageThreadId = 0,
+ bool protectContent = false) const;
/**
* @brief Use this method to edit live location messages.
@@ -601,7 +627,7 @@ public:
/**
* @brief Use this method to send information about a venue.
- *
+ *
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param latitude Latitude of the venue
* @param longitude Longitude of the venue
@@ -610,14 +636,13 @@ public:
* @param foursquareId Optional. Foursquare identifier of the venue
* @param foursquareType Optional. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
* @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
- * @param replyToMessageId Optional. If the message is a reply, ID of the original message
+ * @param replyParameters Optional. Description of the message to reply to
* @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 googlePlaceId Optional. Google Places identifier of the venue
* @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
- *
+ * @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ *
* @return On success, the sent Message is returned.
*/
Message::Ptr sendVenue(boost::variant<std::int64_t, std::string> chatId,
@@ -628,29 +653,27 @@ public:
const std::string& foursquareId = "",
const std::string& foursquareType = "",
bool disableNotification = false,
- std::int32_t replyToMessageId = 0,
+ ReplyParameters::Ptr replyParameters = nullptr,
GenericReply::Ptr replyMarkup = nullptr,
const std::string& googlePlaceId = "",
const std::string& googlePlaceType = "",
- bool allowSendingWithoutReply = false,
- bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ std::int32_t messageThreadId = 0,
+ bool protectContent = false) const;
/**
* @brief Use this method to send phone contacts.
- *
+ *
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param phoneNumber Contact's phone number
* @param firstName Contact's first name
* @param lastName Optional. Contact's last name
* @param vcard Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes
* @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
- * @param replyToMessageId Optional. If the message is a reply, ID of the original message
+ * @param replyParameters Optional. Description of the message to reply to
* @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
- *
+ * @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ *
* @return On success, the sent Message is returned.
*/
Message::Ptr sendContact(boost::variant<std::int64_t, std::string> chatId,
@@ -659,11 +682,10 @@ public:
const std::string& lastName = "",
const std::string& vcard = "",
bool disableNotification = false,
- std::int32_t replyToMessageId = 0,
+ ReplyParameters::Ptr replyParameters = nullptr,
GenericReply::Ptr replyMarkup = nullptr,
- bool allowSendingWithoutReply = false,
- bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ std::int32_t messageThreadId = 0,
+ bool protectContent = false) const;
/**
* @brief Use this method to send a native poll.
@@ -672,7 +694,7 @@ public:
* @param question Poll question, 1-300 characters
* @param options A JSON-serialized list of answer options, 2-10 strings 1-100 characters each
* @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
- * @param replyToMessageId Optional. If the message is a reply, ID of the original message
+ * @param replyParameters Optional. Description of the message to reply to
* @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 isAnonymous Optional. True, if the poll needs to be anonymous, defaults to True
* @param type Optional. Poll type, “quiz” or “regular”, defaults to “regular”
@@ -684,9 +706,8 @@ public:
* @param openPeriod Optional. Amount of time in seconds the poll will be active after creation, 5-600. Can't be used together with closeDate.
* @param closeDate Optional. Point in time (Unix timestamp) when the poll will be automatically closed. Must be at least 5 and no more than 600 seconds in the future. Can't be used together with openPeriod.
* @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
+ * @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
*
* @return On success, the sent Message is returned.
*/
@@ -694,7 +715,7 @@ public:
const std::string& question,
const std::vector<std::string>& options,
bool disableNotification = false,
- std::int32_t replyToMessageId = 0,
+ ReplyParameters::Ptr replyParameters = nullptr,
GenericReply::Ptr replyMarkup = nullptr,
bool isAnonymous = true,
const std::string& type = "",
@@ -706,32 +727,47 @@ public:
std::int32_t openPeriod = 0,
std::int32_t closeDate = 0,
bool isClosed = false,
- bool allowSendingWithoutReply = false,
- bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ std::int32_t messageThreadId = 0,
+ bool protectContent = false) const;
/**
* @brief Use this method to send an animated emoji that will display a random value.
*
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
- * @param replyToMessageId Optional. If the message is a reply, ID of the original message
+ * @param replyParameters Optional. Description of the message to reply to
* @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 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
+ * @param protectContent Optional. Protects the contents of the sent message from forwarding
*
* @return On success, the sent Message is returned.
*/
Message::Ptr sendDice(boost::variant<std::int64_t, std::string> chatId,
bool disableNotification = false,
- std::int32_t replyToMessageId = 0,
+ ReplyParameters::Ptr replyParameters = nullptr,
GenericReply::Ptr replyMarkup = nullptr,
const std::string& emoji = "",
- bool allowSendingWithoutReply = false,
- bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ std::int32_t messageThreadId = 0,
+ bool protectContent = false) const;
+
+ /**
+ * @brief Use this method to change the chosen reactions on a message.
+ *
+ * Service messages can't be reacted to.
+ * Automatically forwarded messages from a channel to its discussion group have the same available reactions as messages in the channel.
+ *
+ * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
+ * @param messageId Identifier of the target message. If the message belongs to a media group, the reaction is set to the first non-deleted message in the group instead.
+ * @param reaction Optional. New list of reaction types to set on the message. Currently, as non-premium users, bots can set up to one reaction per message. A custom emoji reaction can be used if it is either already present on the message or explicitly allowed by chat administrators.
+ * @param isBig Optional. Pass True to set the reaction with a big animation
+ *
+ * @return Returns True on success.
+ */
+ bool setMessageReaction(boost::variant<std::int64_t, std::string> chatId,
+ std::int32_t messageId = 0,
+ const std::vector<ReactionType::Ptr>& reaction = std::vector<ReactionType::Ptr>(),
+ bool isBig = false) const;
/**
* @brief Use this method when you need to tell the user that something is happening on the bot's side.
@@ -842,28 +878,28 @@ public:
/**
* @brief Use this method to promote or demote a user in a supergroup or a channel.
- *
+ *
* The bot must be an administrator in the chat for this to work and must have the appropriate administrator rights.
* Pass False for all boolean parameters to demote a user.
- *
+ *
* @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 post messages in the channel; channels only
+ * @param canPostMessages Optional. Pass True if the administrator can post messages in the channel, or access channel statistics; 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 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, chat statistics, boost list in channels, message statistics in channels, see channel members, 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, 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 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 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
- *
+ *
* @return Returns True on success.
*/
bool promoteChatMember(boost::variant<std::int64_t, std::string> chatId,
@@ -1138,10 +1174,10 @@ public:
bool leaveChat(boost::variant<std::int64_t, std::string> chatId) const;
/**
- * @brief Use this method to get up to date information about the chat (current name of the user for one-on-one conversations, current username of a user, group or channel, etc.).
- *
+ * @brief Use this method to get up to date information about the chat.
+ *
* @param chatId Unique identifier for the target chat or username of the target supergroup or channel (in the format @channelusername)
- *
+ *
* @return Returns a Chat object on success.
*/
Chat::Ptr getChat(boost::variant<std::int64_t, std::string> chatId) const;
@@ -1390,6 +1426,19 @@ public:
std::int32_t cacheTime = 0) const;
/**
+ * @brief Use this method to get the list of boosts added to a chat by a user.
+ *
+ * Requires administrator rights in the chat.
+ *
+ * @param chatId Unique identifier for the chat or username of the channel (in the format @channelusername)
+ * @param userId Unique identifier of the target user
+ *
+ * @return Returns a UserChatBoosts object.
+ */
+ UserChatBoosts::Ptr getUserChatBoosts(boost::variant<std::int64_t, std::string> chatId,
+ std::int32_t userId) const;
+
+ /**
* @brief Use this method to change the list of the bot's commands.
*
* See https://core.telegram.org/bots#commands for more details about bot commands.
@@ -1531,17 +1580,17 @@ public:
ChatAdministratorRights::Ptr getMyDefaultAdministratorRights(bool forChannels = false) const;
/**
- * @brief Use this method to edit text and game messages.
- *
+ * @brief Use this method to edit text and [game](https://core.telegram.org/bots/api#games) messages.
+ *
* @param text New text of the message, 1-4096 characters after entities parsing
* @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 parseMode Optional. Mode for parsing entities in the message text. See https://core.telegram.org/bots/api#formatting-options for more details.
- * @param disableWebPagePreview Optional. Disables link previews for links in this message
+ * @param linkPreviewOptions Optional. Link preview generation options for the message
* @param replyMarkup Optional. A JSON-serialized object for an inline keyboard.
* @param entities Optional. List of special entities that appear in message text, which can be specified instead of parseMode
- *
+ *
* @return On success, if the edited message is not an inline message, the edited Message is returned, otherwise nullptr is returned.
*/
Message::Ptr editMessageText(const std::string& text,
@@ -1549,7 +1598,7 @@ public:
std::int32_t messageId = 0,
const std::string& inlineMessageId = "",
const std::string& parseMode = "",
- bool disableWebPagePreview = false,
+ LinkPreviewOptions::Ptr linkPreviewOptions = nullptr,
InlineKeyboardMarkup::Ptr replyMarkup = nullptr,
const std::vector<MessageEntity::Ptr>& entities = std::vector<MessageEntity::Ptr>()) const;
@@ -1643,28 +1692,39 @@ public:
std::int32_t messageId) const;
/**
- * @brief Use this method to send static .WEBP, animated .TGS, or video .WEBM stickers.
+ * @brief Use this method to delete multiple messages simultaneously.
+ *
+ * If some of the specified messages can't be found, they are skipped.
+ *
+ * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
+ * @param messageIds Identifiers of 1-100 messages to delete. See Api::deleteMessage for limitations on which messages can be deleted
*
+ * @return Returns True on success.
+ */
+ bool deleteMessages(boost::variant<std::int64_t, std::string> chatId,
+ const std::vector<std::int32_t>& messageIds) const;
+
+ /**
+ * @brief Use this method to send static .WEBP, [animated](https://telegram.org/blog/animated-stickers) .TGS, or [video](https://telegram.org/blog/video-stickers-better-reactions) .WEBM stickers.
+ *
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param sticker Sticker to send. Pass a fileId as String to send a file that exists on the Telegram servers (recommended), pass an HTTP URL as a String for Telegram to get a .WEBP sticker from the Internet, or upload a new .WEBP or .TGS sticker using multipart/form-data. https://core.telegram.org/bots/api#sending-files. Video stickers can only be sent by a fileId. Animated stickers can't be sent via an HTTP URL.
- * @param replyToMessageId Optional. If the message is a reply, ID of the original message
+ * @param replyParameters Optional. Description of the message to reply to
* @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 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
+ * @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
* @param emoji Optional. Emoji associated with the sticker; only for just uploaded stickers
- *
+ *
* @return On success, the sent Message is returned.
*/
Message::Ptr sendSticker(boost::variant<std::int64_t, std::string> chatId,
boost::variant<InputFile::Ptr, std::string> sticker,
- std::int32_t replyToMessageId = 0,
+ ReplyParameters::Ptr replyParameters = nullptr,
GenericReply::Ptr replyMarkup = nullptr,
bool disableNotification = false,
- bool allowSendingWithoutReply = false,
- bool protectContent = false,
std::int32_t messageThreadId = 0,
+ bool protectContent = false,
const std::string& emoji = "") const;
/**
@@ -1878,7 +1938,7 @@ public:
/**
* @brief Use this method to send invoices.
- *
+ *
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param title Product name, 1-32 characters
* @param description Product description, 1-255 characters
@@ -1898,16 +1958,15 @@ public:
* @param sendPhoneNumberToProvider Optional. Pass True, if user's phone number should be sent to provider
* @param sendEmailToProvider Optional. Pass True, if user's email address should be sent to provider
* @param isFlexible Optional. Pass True, if the final price depends on the shipping method
- * @param replyToMessageId Optional. If the message is a reply, ID of the original message
+ * @param replyParameters Optional. Description of the message to reply to
* @param replyMarkup Optional. A JSON-serialized object for an inline keyboard. If empty, one 'Pay total price' button will be shown. If not empty, the first button must be a Pay button.
* @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 messageThreadId Optional. Unique identifier for the target message thread (topic) of the forum; for forum supergroups only
* @param maxTipAmount Optional. The maximum accepted amount for tips in the smallest units of the currency (integer, not float/double). For example, for a maximum tip of US$ 1.45 pass max_tip_amount = 145. See the exp parameter in https://core.telegram.org/bots/payments/currencies.json, it shows the number of digits past the decimal point for each currency (2 for the majority of currencies). Defaults to 0
* @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.
*/
Message::Ptr sendInvoice(boost::variant<std::int64_t, std::string> chatId,
@@ -1929,15 +1988,14 @@ public:
bool sendPhoneNumberToProvider = false,
bool sendEmailToProvider = false,
bool isFlexible = false,
- std::int32_t replyToMessageId = 0,
+ ReplyParameters::Ptr replyParameters = nullptr,
GenericReply::Ptr replyMarkup = nullptr,
bool disableNotification = false,
- bool allowSendingWithoutReply = false,
+ std::int32_t messageThreadId = 0,
std::int32_t maxTipAmount = 0,
const std::vector<std::int32_t>& suggestedTipAmounts = std::vector<std::int32_t>(),
const std::string& startParameter = "",
- bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ bool protectContent = false) const;
/**
* @brief Use this method to create a link for an invoice.
@@ -2037,26 +2095,24 @@ public:
/**
* @brief Use this method to send a game.
- *
+ *
* @param chatId Unique identifier for the target chat
* @param gameShortName Short name of the game, serves as the unique identifier for the game. Set up your games via @BotFather.
- * @param replyToMessageId Optional. If the message is a reply, ID of the original message
+ * @param replyParameters Optional. Description of the message to reply to
* @param replyMarkup Optional. A JSON-serialized object for an inline keyboard. If empty, one 'Play gameTitle' button will be shown. If not empty, the first button must launch the game.
* @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
- *
+ * @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
+ *
* @return On success, the sent Message is returned.
*/
Message::Ptr sendGame(std::int64_t chatId,
const std::string& gameShortName,
- std::int32_t replyToMessageId = 0,
+ ReplyParameters::Ptr replyParameters = nullptr,
InlineKeyboardMarkup::Ptr replyMarkup = std::make_shared<InlineKeyboardMarkup>(),
bool disableNotification = false,
- bool allowSendingWithoutReply = false,
- bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ std::int32_t messageThreadId = 0,
+ bool protectContent = false) 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 ad610df..fc12b22 100644
--- a/include/tgbot/TgTypeParser.h
+++ b/include/tgbot/TgTypeParser.h
@@ -8,7 +8,16 @@
#include "tgbot/types/Chat.h"
#include "tgbot/types/Message.h"
#include "tgbot/types/MessageId.h"
+#include "tgbot/types/InaccessibleMessage.h"
#include "tgbot/types/MessageEntity.h"
+#include "tgbot/types/TextQuote.h"
+#include "tgbot/types/ExternalReplyInfo.h"
+#include "tgbot/types/ReplyParameters.h"
+#include "tgbot/types/MessageOrigin.h"
+#include "tgbot/types/MessageOriginUser.h"
+#include "tgbot/types/MessageOriginHiddenUser.h"
+#include "tgbot/types/MessageOriginChat.h"
+#include "tgbot/types/MessageOriginChannel.h"
#include "tgbot/types/PhotoSize.h"
#include "tgbot/types/Animation.h"
#include "tgbot/types/Audio.h"
@@ -33,19 +42,24 @@
#include "tgbot/types/ForumTopicReopened.h"
#include "tgbot/types/GeneralForumTopicHidden.h"
#include "tgbot/types/GeneralForumTopicUnhidden.h"
-#include "tgbot/types/UserShared.h"
+#include "tgbot/types/UsersShared.h"
#include "tgbot/types/ChatShared.h"
#include "tgbot/types/WriteAccessAllowed.h"
#include "tgbot/types/VideoChatScheduled.h"
#include "tgbot/types/VideoChatStarted.h"
#include "tgbot/types/VideoChatEnded.h"
#include "tgbot/types/VideoChatParticipantsInvited.h"
+#include "tgbot/types/GiveawayCreated.h"
+#include "tgbot/types/Giveaway.h"
+#include "tgbot/types/GiveawayWinners.h"
+#include "tgbot/types/GiveawayCompleted.h"
+#include "tgbot/types/LinkPreviewOptions.h"
#include "tgbot/types/UserProfilePhotos.h"
#include "tgbot/types/File.h"
#include "tgbot/types/WebAppInfo.h"
#include "tgbot/types/ReplyKeyboardMarkup.h"
#include "tgbot/types/KeyboardButton.h"
-#include "tgbot/types/KeyboardButtonRequestUser.h"
+#include "tgbot/types/KeyboardButtonRequestUsers.h"
#include "tgbot/types/KeyboardButtonRequestChat.h"
#include "tgbot/types/KeyboardButtonPollType.h"
#include "tgbot/types/ReplyKeyboardRemove.h"
@@ -58,6 +72,7 @@
#include "tgbot/types/ChatPhoto.h"
#include "tgbot/types/ChatInviteLink.h"
#include "tgbot/types/ChatAdministratorRights.h"
+#include "tgbot/types/ChatMemberUpdated.h"
#include "tgbot/types/ChatMember.h"
#include "tgbot/types/ChatMemberOwner.h"
#include "tgbot/types/ChatMemberAdministrator.h"
@@ -65,10 +80,15 @@
#include "tgbot/types/ChatMemberRestricted.h"
#include "tgbot/types/ChatMemberLeft.h"
#include "tgbot/types/ChatMemberBanned.h"
-#include "tgbot/types/ChatMemberUpdated.h"
#include "tgbot/types/ChatJoinRequest.h"
#include "tgbot/types/ChatPermissions.h"
#include "tgbot/types/ChatLocation.h"
+#include "tgbot/types/ReactionType.h"
+#include "tgbot/types/ReactionTypeEmoji.h"
+#include "tgbot/types/ReactionTypeCustomEmoji.h"
+#include "tgbot/types/ReactionCount.h"
+#include "tgbot/types/MessageReactionUpdated.h"
+#include "tgbot/types/MessageReactionCountUpdated.h"
#include "tgbot/types/ForumTopic.h"
#include "tgbot/types/BotCommand.h"
#include "tgbot/types/BotCommandScope.h"
@@ -86,6 +106,14 @@
#include "tgbot/types/MenuButtonCommands.h"
#include "tgbot/types/MenuButtonWebApp.h"
#include "tgbot/types/MenuButtonDefault.h"
+#include "tgbot/types/ChatBoostSource.h"
+#include "tgbot/types/ChatBoostSourcePremium.h"
+#include "tgbot/types/ChatBoostSourceGiftCode.h"
+#include "tgbot/types/ChatBoostSourceGiveaway.h"
+#include "tgbot/types/ChatBoost.h"
+#include "tgbot/types/ChatBoostUpdated.h"
+#include "tgbot/types/ChatBoostRemoved.h"
+#include "tgbot/types/UserChatBoosts.h"
#include "tgbot/types/ResponseParameters.h"
#include "tgbot/types/InputMedia.h"
#include "tgbot/types/InputMediaPhoto.h"
@@ -138,6 +166,8 @@
#include "tgbot/types/PreCheckoutQuery.h"
#include "tgbot/types/PassportData.h"
#include "tgbot/types/PassportFile.h"
+#include "tgbot/types/EncryptedPassportElement.h"
+#include "tgbot/types/EncryptedCredentials.h"
#include "tgbot/types/PassportElementError.h"
#include "tgbot/types/PassportElementErrorDataField.h"
#include "tgbot/types/PassportElementErrorFrontSide.h"
@@ -191,9 +221,36 @@ public:
MessageId::Ptr parseJsonAndGetMessageId(const boost::property_tree::ptree& data) const;
std::string parseMessageId(const MessageId::Ptr& object) const;
+ InaccessibleMessage::Ptr parseJsonAndGetInaccessibleMessage(const boost::property_tree::ptree& data) const;
+ std::string parseInaccessibleMessage(const InaccessibleMessage::Ptr& object) const;
+
MessageEntity::Ptr parseJsonAndGetMessageEntity(const boost::property_tree::ptree& data) const;
std::string parseMessageEntity(const MessageEntity::Ptr& object) const;
+ TextQuote::Ptr parseJsonAndGetTextQuote(const boost::property_tree::ptree& data) const;
+ std::string parseTextQuote(const TextQuote::Ptr& object) const;
+
+ ExternalReplyInfo::Ptr parseJsonAndGetExternalReplyInfo(const boost::property_tree::ptree& data) const;
+ std::string parseExternalReplyInfo(const ExternalReplyInfo::Ptr& object) const;
+
+ ReplyParameters::Ptr parseJsonAndGetReplyParameters(const boost::property_tree::ptree& data) const;
+ std::string parseReplyParameters(const ReplyParameters::Ptr& object) const;
+
+ MessageOrigin::Ptr parseJsonAndGetMessageOrigin(const boost::property_tree::ptree& data) const;
+ std::string parseMessageOrigin(const MessageOrigin::Ptr& object) const;
+
+ MessageOriginUser::Ptr parseJsonAndGetMessageOriginUser(const boost::property_tree::ptree& data) const;
+ std::string parseMessageOriginUser(const MessageOriginUser::Ptr& object) const;
+
+ MessageOriginHiddenUser::Ptr parseJsonAndGetMessageOriginHiddenUser(const boost::property_tree::ptree& data) const;
+ std::string parseMessageOriginHiddenUser(const MessageOriginHiddenUser::Ptr& object) const;
+
+ MessageOriginChat::Ptr parseJsonAndGetMessageOriginChat(const boost::property_tree::ptree& data) const;
+ std::string parseMessageOriginChat(const MessageOriginChat::Ptr& object) const;
+
+ MessageOriginChannel::Ptr parseJsonAndGetMessageOriginChannel(const boost::property_tree::ptree& data) const;
+ std::string parseMessageOriginChannel(const MessageOriginChannel::Ptr& object) const;
+
PhotoSize::Ptr parseJsonAndGetPhotoSize(const boost::property_tree::ptree& data) const;
std::string parsePhotoSize(const PhotoSize::Ptr& object) const;
@@ -266,8 +323,8 @@ public:
GeneralForumTopicUnhidden::Ptr parseJsonAndGetGeneralForumTopicUnhidden(const boost::property_tree::ptree& data) const;
std::string parseGeneralForumTopicUnhidden(const GeneralForumTopicUnhidden::Ptr& object) const;
- UserShared::Ptr parseJsonAndGetUserShared(const boost::property_tree::ptree& data) const;
- std::string parseUserShared(const UserShared::Ptr& object) const;
+ UsersShared::Ptr parseJsonAndGetUsersShared(const boost::property_tree::ptree& data) const;
+ std::string parseUsersShared(const UsersShared::Ptr& object) const;
ChatShared::Ptr parseJsonAndGetChatShared(const boost::property_tree::ptree& data) const;
std::string parseChatShared(const ChatShared::Ptr& object) const;
@@ -287,6 +344,21 @@ public:
VideoChatParticipantsInvited::Ptr parseJsonAndGetVideoChatParticipantsInvited(const boost::property_tree::ptree& data) const;
std::string parseVideoChatParticipantsInvited(const VideoChatParticipantsInvited::Ptr& object) const;
+ GiveawayCreated::Ptr parseJsonAndGetGiveawayCreated(const boost::property_tree::ptree& data) const;
+ std::string parseGiveawayCreated(const GiveawayCreated::Ptr& object) const;
+
+ Giveaway::Ptr parseJsonAndGetGiveaway(const boost::property_tree::ptree& data) const;
+ std::string parseGiveaway(const Giveaway::Ptr& object) const;
+
+ GiveawayWinners::Ptr parseJsonAndGetGiveawayWinners(const boost::property_tree::ptree& data) const;
+ std::string parseGiveawayWinners(const GiveawayWinners::Ptr& object) const;
+
+ GiveawayCompleted::Ptr parseJsonAndGetGiveawayCompleted(const boost::property_tree::ptree& data) const;
+ std::string parseGiveawayCompleted(const GiveawayCompleted::Ptr& object) const;
+
+ LinkPreviewOptions::Ptr parseJsonAndGetLinkPreviewOptions(const boost::property_tree::ptree& data) const;
+ std::string parseLinkPreviewOptions(const LinkPreviewOptions::Ptr& object) const;
+
UserProfilePhotos::Ptr parseJsonAndGetUserProfilePhotos(const boost::property_tree::ptree& data) const;
std::string parseUserProfilePhotos(const UserProfilePhotos::Ptr& object) const;
@@ -302,8 +374,8 @@ public:
KeyboardButton::Ptr parseJsonAndGetKeyboardButton(const boost::property_tree::ptree& data) const;
std::string parseKeyboardButton(const KeyboardButton::Ptr& object) const;
- KeyboardButtonRequestUser::Ptr parseJsonAndGetKeyboardButtonRequestUser(const boost::property_tree::ptree& data) const;
- std::string parseKeyboardButtonRequestUser(const KeyboardButtonRequestUser::Ptr& object) const;
+ KeyboardButtonRequestUsers::Ptr parseJsonAndGetKeyboardButtonRequestUsers(const boost::property_tree::ptree& data) const;
+ std::string parseKeyboardButtonRequestUsers(const KeyboardButtonRequestUsers::Ptr& object) const;
KeyboardButtonRequestChat::Ptr parseJsonAndGetKeyboardButtonRequestChat(const boost::property_tree::ptree& data) const;
std::string parseKeyboardButtonRequestChat(const KeyboardButtonRequestChat::Ptr& object) const;
@@ -341,6 +413,9 @@ public:
ChatAdministratorRights::Ptr parseJsonAndGetChatAdministratorRights(const boost::property_tree::ptree& data) const;
std::string parseChatAdministratorRights(const ChatAdministratorRights::Ptr& object) const;
+ ChatMemberUpdated::Ptr parseJsonAndGetChatMemberUpdated(const boost::property_tree::ptree& data) const;
+ std::string parseChatMemberUpdated(const ChatMemberUpdated::Ptr& object) const;
+
ChatMember::Ptr parseJsonAndGetChatMember(const boost::property_tree::ptree& data) const;
std::string parseChatMember(const ChatMember::Ptr& object) const;
@@ -362,9 +437,6 @@ public:
ChatMemberBanned::Ptr parseJsonAndGetChatMemberBanned(const boost::property_tree::ptree& data) const;
std::string parseChatMemberBanned(const ChatMemberBanned::Ptr& object) const;
- ChatMemberUpdated::Ptr parseJsonAndGetChatMemberUpdated(const boost::property_tree::ptree& data) const;
- std::string parseChatMemberUpdated(const ChatMemberUpdated::Ptr& object) const;
-
ChatJoinRequest::Ptr parseJsonAndGetChatJoinRequest(const boost::property_tree::ptree& data) const;
std::string parseChatJoinRequest(const ChatJoinRequest::Ptr& object) const;
@@ -374,6 +446,24 @@ public:
ChatLocation::Ptr parseJsonAndGetChatLocation(const boost::property_tree::ptree& data) const;
std::string parseChatLocation(const ChatLocation::Ptr& object) const;
+ ReactionType::Ptr parseJsonAndGetReactionType(const boost::property_tree::ptree& data) const;
+ std::string parseReactionType(const ReactionType::Ptr& object) const;
+
+ ReactionTypeEmoji::Ptr parseJsonAndGetReactionTypeEmoji(const boost::property_tree::ptree& data) const;
+ std::string parseReactionTypeEmoji(const ReactionTypeEmoji::Ptr& object) const;
+
+ ReactionTypeCustomEmoji::Ptr parseJsonAndGetReactionTypeCustomEmoji(const boost::property_tree::ptree& data) const;
+ std::string parseReactionTypeCustomEmoji(const ReactionTypeCustomEmoji::Ptr& object) const;
+
+ ReactionCount::Ptr parseJsonAndGetReactionCount(const boost::property_tree::ptree& data) const;
+ std::string parseReactionCount(const ReactionCount::Ptr& object) const;
+
+ MessageReactionUpdated::Ptr parseJsonAndGetMessageReactionUpdated(const boost::property_tree::ptree& data) const;
+ std::string parseMessageReactionUpdated(const MessageReactionUpdated::Ptr& object) const;
+
+ MessageReactionCountUpdated::Ptr parseJsonAndGetMessageReactionCountUpdated(const boost::property_tree::ptree& data) const;
+ std::string parseMessageReactionCountUpdated(const MessageReactionCountUpdated::Ptr& object) const;
+
ForumTopic::Ptr parseJsonAndGetForumTopic(const boost::property_tree::ptree& data) const;
std::string parseForumTopic(const ForumTopic::Ptr& object) const;
@@ -425,6 +515,30 @@ public:
MenuButtonDefault::Ptr parseJsonAndGetMenuButtonDefault(const boost::property_tree::ptree& data) const;
std::string parseMenuButtonDefault(const MenuButtonDefault::Ptr& object) const;
+ ChatBoostSource::Ptr parseJsonAndGetChatBoostSource(const boost::property_tree::ptree& data) const;
+ std::string parseChatBoostSource(const ChatBoostSource::Ptr& object) const;
+
+ ChatBoostSourcePremium::Ptr parseJsonAndGetChatBoostSourcePremium(const boost::property_tree::ptree& data) const;
+ std::string parseChatBoostSourcePremium(const ChatBoostSourcePremium::Ptr& object) const;
+
+ ChatBoostSourceGiftCode::Ptr parseJsonAndGetChatBoostSourceGiftCode(const boost::property_tree::ptree& data) const;
+ std::string parseChatBoostSourceGiftCode(const ChatBoostSourceGiftCode::Ptr& object) const;
+
+ ChatBoostSourceGiveaway::Ptr parseJsonAndGetChatBoostSourceGiveaway(const boost::property_tree::ptree& data) const;
+ std::string parseChatBoostSourceGiveaway(const ChatBoostSourceGiveaway::Ptr& object) const;
+
+ ChatBoost::Ptr parseJsonAndGetChatBoost(const boost::property_tree::ptree& data) const;
+ std::string parseChatBoost(const ChatBoost::Ptr& object) const;
+
+ ChatBoostUpdated::Ptr parseJsonAndGetChatBoostUpdated(const boost::property_tree::ptree& data) const;
+ std::string parseChatBoostUpdated(const ChatBoostUpdated::Ptr& object) const;
+
+ ChatBoostRemoved::Ptr parseJsonAndGetChatBoostRemoved(const boost::property_tree::ptree& data) const;
+ std::string parseChatBoostRemoved(const ChatBoostRemoved::Ptr& object) const;
+
+ UserChatBoosts::Ptr parseJsonAndGetUserChatBoosts(const boost::property_tree::ptree& data) const;
+ std::string parseUserChatBoosts(const UserChatBoosts::Ptr& object) const;
+
ResponseParameters::Ptr parseJsonAndGetResponseParameters(const boost::property_tree::ptree& data) const;
std::string parseResponseParameters(const ResponseParameters::Ptr& object) const;
@@ -625,10 +739,10 @@ public:
GameHighScore::Ptr parseJsonAndGetGameHighScore(const boost::property_tree::ptree& data) const;
std::string parseGameHighScore(const GameHighScore::Ptr& object) const;
-
+
GenericReply::Ptr parseJsonAndGetGenericReply(const boost::property_tree::ptree& data) const;
std::string parseGenericReply(const GenericReply::Ptr& object) const;
-
+
inline boost::property_tree::ptree parseJson(const std::string& json) const {
boost::property_tree::ptree tree;
std::istringstream input(json);
diff --git a/include/tgbot/types/Chat.h b/include/tgbot/types/Chat.h
index 95aa482..70e6ac1 100644
--- a/include/tgbot/types/Chat.h
+++ b/include/tgbot/types/Chat.h
@@ -2,6 +2,7 @@
#define TGBOT_CHAT_H
#include "tgbot/types/ChatPhoto.h"
+#include "tgbot/types/ReactionType.h"
#include "tgbot/types/ChatPermissions.h"
#include "tgbot/types/ChatLocation.h"
@@ -33,7 +34,7 @@ public:
/**
* @brief Unique identifier for this chat.
- *
+ *
* 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.
*/
@@ -65,118 +66,157 @@ public:
std::string lastName;
/**
- * @brief Optional. True, if the supergroup chat is a forum (has topics enabled)
+ * @brief Optional. True, if the supergroup chat is a forum (has [topics](https://telegram.org/blog/topics-in-groups-collectible-usernames#topics-in-groups) 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.
- *
+ * @brief Optional. If non-empty, the list of all [active chat usernames](https://telegram.org/blog/topics-in-groups-collectible-usernames#collectible-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.
- *
+ * @brief Optional. List of available reactions allowed in the chat.
+ *
+ * If omitted, then all [emoji reactions](https://core.telegram.org/bots/api#reactiontypeemoji) are allowed.
+ * Returned only in Api::getChat.
+ */
+ std::vector<ReactionType::Ptr> availableReactions;
+
+ /**
+ * @brief Optional. Identifier of the accent color for the chat name and backgrounds of the chat photo, reply header, and link preview.
+ *
+ * See [accent colors](https://core.telegram.org/bots/api#accent-colors) for more details.
+ * Returned only in Api::getChat.
+ * Always returned in Api::getChat.
+ */
+ std::int32_t accentColorId;
+
+ /**
+ * @brief Optional. Custom emoji identifier of emoji chosen by the chat for the reply header and link preview background.
+ *
+ * Returned only in Api::getChat.
+ */
+ std::string backgroundCustomEmojiId;
+
+ /**
+ * @brief Optional. Identifier of the accent color for the chat's profile background.
+ *
+ * See [profile accent colors](https://core.telegram.org/bots/api#profile-accent-colors) for more details.
+ * Returned only in Api::getChat.
+ */
+ std::int32_t profileAccentColorId;
+
+ /**
+ * @brief Optional. Custom emoji identifier of the emoji chosen by the chat for its profile background.
+ *
+ * Returned only in Api::getChat.
+ */
+ std::string profileBackgroundCustomEmojiId;
+
+ /**
+ * @brief Optional. Custom emoji identifier of the emoji status of the chat or the other party in a private chat.
+ *
* Returned only in Api::getChat.
*/
std::string emojiStatusCustomEmojiId;
/**
- * @brief Optional. Expiration date of the emoji status of the other party in a private chat in Unix time, if any.
- *
+ * @brief Optional. Expiration date of the emoji status of the chat or the other party in a private chat, in Unix time, if any.
+ *
* Returned only in Api::getChat.
*/
std::int64_t emojiStatusExpirationDate;
/**
* @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 aggressive anti-spam checks are enabled in the supergroup.
- *
+ *
* The field is only available to chat administrators.
* Returned only in Api::getChat.
*/
@@ -184,35 +224,42 @@ public:
/**
* @brief Optional. True, if non-administrators can only get the list of bots and administrators in the chat.
- *
+ *
* Returned only in Api::getChat.
*/
bool hasHiddenMembers;
/**
* @brief Optional. True, if messages from the chat can't be forwarded to other chats.
- *
+ *
* Returned only in Api::getChat.
*/
bool hasProtectedContent;
/**
+ * @brief Optional. True, if new chat members will have access to old messages; available only to chat administrators.
+ *
+ * Returned only in Api::getChat.
+ */
+ bool hasVisibleHistory;
+
+ /**
* @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.
- *
+ *
* 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.
@@ -221,7 +268,7 @@ public:
/**
* @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 dcd441f..914e8f3 100644
--- a/include/tgbot/types/ChatAdministratorRights.h
+++ b/include/tgbot/types/ChatAdministratorRights.h
@@ -11,6 +11,7 @@ namespace TgBot {
* @ingroup types
*/
class ChatAdministratorRights {
+
public:
typedef std::shared_ptr<ChatAdministratorRights> Ptr;
@@ -20,8 +21,8 @@ public:
bool isAnonymous;
/**
- * @brief True, if the administrator can access the chat event log, chat statistics, boost list in channels, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode.
- *
+ * @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.
+ *
* Implied by any other administrator privilege
*/
bool canManageChat;
@@ -37,7 +38,7 @@ public:
bool canManageVideoChats;
/**
- * @brief True, if the administrator can restrict, ban or unban chat members
+ * @brief True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics
*/
bool canRestrictMembers;
@@ -57,7 +58,7 @@ public:
bool canInviteUsers;
/**
- * @brief Optional. True, if the administrator can post messages in the channel; channels only
+ * @brief Optional. True, if the administrator can post messages in the channel, or access channel statistics; channels only
*/
bool canPostMessages;
diff --git a/include/tgbot/types/ChatBoost.h b/include/tgbot/types/ChatBoost.h
new file mode 100644
index 0000000..bd68944
--- /dev/null
+++ b/include/tgbot/types/ChatBoost.h
@@ -0,0 +1,44 @@
+#ifndef TGBOT_CHATBOOST_H
+#define TGBOT_CHATBOOST_H
+
+#include "tgbot/types/ChatBoostSource.h"
+
+#include <cstdint>
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * @brief This object contains information about a chat boost.
+ *
+ * @ingroup types
+ */
+class ChatBoost {
+
+public:
+ typedef std::shared_ptr<ChatBoost> Ptr;
+
+ /**
+ * @brief Unique identifier of the boost
+ */
+ std::string boostId;
+
+ /**
+ * @brief Point in time (Unix timestamp) when the chat was boosted
+ */
+ std::uint32_t addDate;
+
+ /**
+ * @brief Point in time (Unix timestamp) when the boost will automatically expire, unless the booster's Telegram Premium subscription is prolonged
+ */
+ std::uint32_t expirationDate;
+
+ /**
+ * @brief Source of the added boost
+ */
+ ChatBoostSource::Ptr source;
+};
+}
+
+#endif //TGBOT_CHATBOOST_H
diff --git a/include/tgbot/types/ChatBoostRemoved.h b/include/tgbot/types/ChatBoostRemoved.h
new file mode 100644
index 0000000..be5381e
--- /dev/null
+++ b/include/tgbot/types/ChatBoostRemoved.h
@@ -0,0 +1,45 @@
+#ifndef TGBOT_CHATBOOSTREMOVED_H
+#define TGBOT_CHATBOOSTREMOVED_H
+
+#include "tgbot/types/Chat.h"
+#include "tgbot/types/ChatBoostSource.h"
+
+#include <cstdint>
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents a boost removed from a chat.
+ *
+ * @ingroup types
+ */
+class ChatBoostRemoved {
+
+public:
+ typedef std::shared_ptr<ChatBoostRemoved> Ptr;
+
+ /**
+ * @brief Chat which was boosted
+ */
+ Chat::Ptr chat;
+
+ /**
+ * @brief Unique identifier of the boost
+ */
+ std::string boostId;
+
+ /**
+ * @brief Point in time (Unix timestamp) when the boost was removed
+ */
+ std::uint32_t removeDate;
+
+ /**
+ * @brief Source of the removed boost
+ */
+ ChatBoostSource::Ptr source;
+};
+}
+
+#endif //TGBOT_CHATBOOSTREMOVED_H
diff --git a/include/tgbot/types/ChatBoostSource.h b/include/tgbot/types/ChatBoostSource.h
new file mode 100644
index 0000000..e531b58
--- /dev/null
+++ b/include/tgbot/types/ChatBoostSource.h
@@ -0,0 +1,42 @@
+#ifndef TGBOT_CHATBOOSTSOURCE_H
+#define TGBOT_CHATBOOSTSOURCE_H
+
+#include "tgbot/types/User.h"
+
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * @brief This object describes the source of a chat boost.
+ *
+ * It can be one of
+ * - ChatBoostSourcePremium
+ * - ChatBoostSourceGiftCode
+ * - ChatBoostSourceGiveaway
+ *
+ * @ingroup types
+ */
+class ChatBoostSource {
+
+public:
+ typedef std::shared_ptr<ChatBoostSource> Ptr;
+
+ ChatBoostSource() {}
+
+ virtual ~ChatBoostSource() {}
+
+ /**
+ * @brief Source of the boost
+ */
+ std::string source;
+
+ /**
+ * @brief User
+ */
+ User::Ptr user;
+};
+}
+
+#endif //TGBOT_CHATBOOSTSOURCE_H
diff --git a/include/tgbot/types/ChatBoostSourceGiftCode.h b/include/tgbot/types/ChatBoostSourceGiftCode.h
new file mode 100644
index 0000000..42bb83b
--- /dev/null
+++ b/include/tgbot/types/ChatBoostSourceGiftCode.h
@@ -0,0 +1,30 @@
+#ifndef TGBOT_CHATBOOSTSOURCEGIFTCODE_H
+#define TGBOT_CHATBOOSTSOURCEGIFTCODE_H
+
+#include "tgbot/types/ChatBoostSource.h"
+
+#include <memory>
+
+namespace TgBot {
+
+/**
+ * @brief The boost was obtained by the creation of Telegram Premium gift codes to boost a chat.
+ *
+ * Each such code boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.
+ *
+ * @ingroup types
+ */
+class ChatBoostSourceGiftCode : public ChatBoostSource {
+
+public:
+ static const std::string SOURCE;
+
+ typedef std::shared_ptr<ChatBoostSourceGiftCode> Ptr;
+
+ ChatBoostSourceGiftCode() {
+ this->source = SOURCE;
+ }
+};
+}
+
+#endif //TGBOT_CHATBOOSTSOURCEGIFTCODE_H
diff --git a/include/tgbot/types/ChatBoostSourceGiveaway.h b/include/tgbot/types/ChatBoostSourceGiveaway.h
new file mode 100644
index 0000000..8f86ab7
--- /dev/null
+++ b/include/tgbot/types/ChatBoostSourceGiveaway.h
@@ -0,0 +1,43 @@
+#ifndef TGBOT_CHATBOOSTSOURCEGIVEAWAY_H
+#define TGBOT_CHATBOOSTSOURCEGIVEAWAY_H
+
+#include "tgbot/types/ChatBoostSource.h"
+
+#include <cstdint>
+#include <memory>
+
+namespace TgBot {
+
+/**
+ * @brief The boost was obtained by the creation of a Telegram Premium giveaway.
+ *
+ * This boosts the chat 4 times for the duration of the corresponding Telegram Premium subscription.
+ *
+ * @ingroup types
+ */
+class ChatBoostSourceGiveaway : public ChatBoostSource {
+
+public:
+ static const std::string SOURCE;
+
+ typedef std::shared_ptr<ChatBoostSourceGiveaway> Ptr;
+
+ ChatBoostSourceGiveaway() {
+ this->source = SOURCE;
+ }
+
+ /**
+ * @brief Identifier of a message in the chat with the giveaway; the message could have been deleted already.
+ *
+ * May be 0 if the message isn't sent yet.
+ */
+ std::int32_t giveawayMessageId;
+
+ /**
+ * @brief Optional. True, if the giveaway was completed, but there was no user to win the prize
+ */
+ bool isUnclaimed;
+};
+}
+
+#endif //TGBOT_CHATBOOSTSOURCEGIVEAWAY_H
diff --git a/include/tgbot/types/ChatBoostSourcePremium.h b/include/tgbot/types/ChatBoostSourcePremium.h
new file mode 100644
index 0000000..21fda26
--- /dev/null
+++ b/include/tgbot/types/ChatBoostSourcePremium.h
@@ -0,0 +1,28 @@
+#ifndef TGBOT_CHATBOOSTSOURCEPREMIUM_H
+#define TGBOT_CHATBOOSTSOURCEPREMIUM_H
+
+#include "tgbot/types/ChatBoostSource.h"
+
+#include <memory>
+
+namespace TgBot {
+
+/**
+ * @brief The boost was obtained by subscribing to Telegram Premium or by gifting a Telegram Premium subscription to another user.
+ *
+ * @ingroup types
+ */
+class ChatBoostSourcePremium : public ChatBoostSource {
+
+public:
+ static const std::string SOURCE;
+
+ typedef std::shared_ptr<ChatBoostSourcePremium> Ptr;
+
+ ChatBoostSourcePremium() {
+ this->source = SOURCE;
+ }
+};
+}
+
+#endif //TGBOT_CHATBOOSTSOURCEPREMIUM_H
diff --git a/include/tgbot/types/ChatBoostUpdated.h b/include/tgbot/types/ChatBoostUpdated.h
new file mode 100644
index 0000000..60e49f6
--- /dev/null
+++ b/include/tgbot/types/ChatBoostUpdated.h
@@ -0,0 +1,33 @@
+#ifndef TGBOT_CHATBOOSTUPDATED_H
+#define TGBOT_CHATBOOSTUPDATED_H
+
+#include "tgbot/types/Chat.h"
+#include "tgbot/types/ChatBoost.h"
+
+#include <memory>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents a boost added to a chat or changed.
+ *
+ * @ingroup types
+ */
+class ChatBoostUpdated {
+
+public:
+ typedef std::shared_ptr<ChatBoostUpdated> Ptr;
+
+ /**
+ * @brief Chat which was boosted
+ */
+ Chat::Ptr chat;
+
+ /**
+ * @brief Infomation about the chat boost
+ */
+ ChatBoost::Ptr boost;
+};
+}
+
+#endif //TGBOT_CHATBOOSTUPDATED_H
diff --git a/include/tgbot/types/ChatJoinRequest.h b/include/tgbot/types/ChatJoinRequest.h
index dbcbd8b..301cf6f 100644
--- a/include/tgbot/types/ChatJoinRequest.h
+++ b/include/tgbot/types/ChatJoinRequest.h
@@ -33,11 +33,10 @@ public:
/**
* @brief Identifier of a private chat with the user who sent the join request.
- *
- * The bot can use this identifier for 24 hours to send messages until the join request is processed, assuming no other administrator contacted the user.
- *
+ *
* 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 64-bit integer or double-precision float type are safe for storing this identifier.
+ * The bot can use this identifier for 5 minutes to send messages until the join request is processed, assuming no other administrator contacted the user.
*/
std::int64_t userChatId;
diff --git a/include/tgbot/types/ChatMemberAdministrator.h b/include/tgbot/types/ChatMemberAdministrator.h
index af94650..8c9d7e1 100644
--- a/include/tgbot/types/ChatMemberAdministrator.h
+++ b/include/tgbot/types/ChatMemberAdministrator.h
@@ -9,11 +9,12 @@
namespace TgBot {
/**
- * @brief Represents a chat member that has some additional privileges.
+ * @brief Represents a [chat member](https://core.telegram.org/bots/api#chatmember) that has some additional privileges.
*
* @ingroup types
*/
class ChatMemberAdministrator : public ChatMember {
+
public:
static const std::string STATUS;
@@ -34,8 +35,8 @@ public:
bool isAnonymous;
/**
- * @brief True, if the administrator can access the chat event log, chat statistics, boost list in channels, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode.
- *
+ * @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.
+ *
* Implied by any other administrator privilege
*/
bool canManageChat;
@@ -51,7 +52,7 @@ public:
bool canManageVideoChats;
/**
- * @brief True, if the administrator can restrict, ban or unban chat members
+ * @brief True, if the administrator can restrict, ban or unban chat members, or access supergroup statistics
*/
bool canRestrictMembers;
@@ -71,7 +72,7 @@ public:
bool canInviteUsers;
/**
- * @brief Optional. True, if the administrator can post messages in the channel; channels only
+ * @brief Optional. True, if the administrator can post messages in the channel, or access channel statistics; channels only
*/
bool canPostMessages;
diff --git a/include/tgbot/types/ChatMemberRestricted.h b/include/tgbot/types/ChatMemberRestricted.h
index e1eb919..b02edb3 100644
--- a/include/tgbot/types/ChatMemberRestricted.h
+++ b/include/tgbot/types/ChatMemberRestricted.h
@@ -9,13 +9,14 @@
namespace TgBot {
/**
- * @brief Represents a chat member that is under certain restrictions in the chat.
- *
+ * @brief Represents a [chat member](https://core.telegram.org/bots/api#chatmember) that is under certain restrictions in the chat.
+ *
* Supergroups only.
*
* @ingroup types
*/
class ChatMemberRestricted : public ChatMember {
+
public:
static const std::string STATUS;
@@ -31,7 +32,7 @@ public:
bool isMember;
/**
- * @brief True, if the user is allowed to send text messages, contacts, invoices, locations and venues
+ * @brief True, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues
*/
bool canSendMessages;
@@ -102,7 +103,7 @@ public:
/**
* @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 20390d6..4315861 100644
--- a/include/tgbot/types/ChatPermissions.h
+++ b/include/tgbot/types/ChatPermissions.h
@@ -7,16 +7,16 @@ namespace TgBot {
/**
* @brief 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 Optional. True, if the user is allowed to send text messages, contacts, invoices, locations and venues
+ * @brief Optional. True, if the user is allowed to send text messages, contacts, giveaways, giveaway winners, invoices, locations and venues
*/
bool canSendMessages;
@@ -51,23 +51,23 @@ public:
bool canSendVoiceNotes;
/**
- * @brief Optional. True, if the user is allowed to send polls, implies canSendMessages
+ * @brief Optional. True, if the user is allowed to send polls
*/
bool canSendPolls;
/**
- * @brief Optional. True, if the user is allowed to send animations, games, stickers and use inline bots, implies canSendMediaMessages
+ * @brief Optional. True, if the user is allowed to send animations, games, stickers and use inline bots
*/
bool canSendOtherMessages;
/**
- * @brief Optional. True, if the user is allowed to add web page previews to their messages, implies canSendMediaMessages
+ * @brief Optional. True, if the user is allowed to add web page previews to their messages
*/
bool canAddWebPagePreviews;
/**
* @brief Optional. True, if the user is allowed to change the chat title, photo and other settings.
- *
+ *
* Ignored in public supergroups
*/
bool canChangeInfo;
@@ -79,14 +79,14 @@ public:
/**
* @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;
diff --git a/include/tgbot/types/ExternalReplyInfo.h b/include/tgbot/types/ExternalReplyInfo.h
new file mode 100644
index 0000000..d2d40f9
--- /dev/null
+++ b/include/tgbot/types/ExternalReplyInfo.h
@@ -0,0 +1,167 @@
+#ifndef TGBOT_EXTERNALREPLYINFO_H
+#define TGBOT_EXTERNALREPLYINFO_H
+
+#include "tgbot/types/MessageOrigin.h"
+#include "tgbot/types/Chat.h"
+#include "tgbot/types/LinkPreviewOptions.h"
+#include "tgbot/types/Animation.h"
+#include "tgbot/types/Audio.h"
+#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"
+#include "tgbot/types/Contact.h"
+#include "tgbot/types/Dice.h"
+#include "tgbot/types/Game.h"
+#include "tgbot/types/Giveaway.h"
+#include "tgbot/types/GiveawayWinners.h"
+#include "tgbot/types/Invoice.h"
+#include "tgbot/types/Location.h"
+#include "tgbot/types/Poll.h"
+#include "tgbot/types/Venue.h"
+
+#include <cstdint>
+#include <memory>
+#include <vector>
+
+namespace TgBot {
+
+/**
+ * @brief This object contains information about a message that is being replied to, which may come from another chat or forum topic.
+ *
+ * @ingroup types
+ */
+class ExternalReplyInfo {
+
+public:
+ typedef std::shared_ptr<ExternalReplyInfo> Ptr;
+
+ /**
+ * @brief Origin of the message replied to by the given message
+ */
+ MessageOrigin::Ptr origin;
+
+ /**
+ * @brief Optional. Chat the original message belongs to.
+ *
+ * Available only if the chat is a supergroup or a channel.
+ */
+ Chat::Ptr chat;
+
+ /**
+ * @brief Optional. Unique message identifier inside the original chat.
+ *
+ * Available only if the original chat is a supergroup or a channel.
+ */
+ std::int32_t messageId;
+
+ /**
+ * @brief Optional. Options used for link preview generation for the original message, if it is a text message
+ */
+ LinkPreviewOptions::Ptr linkPreviewOptions;
+
+ /**
+ * @brief Optional. Message is an animation, information about the animation
+ */
+ Animation::Ptr animation;
+
+ /**
+ * @brief Optional. Message is an audio file, information about the file
+ */
+ Audio::Ptr audio;
+
+ /**
+ * @brief Optional. Message is a general file, information about the file
+ */
+ Document::Ptr document;
+
+ /**
+ * @brief Optional. Message is a photo, available sizes of the photo
+ */
+ std::vector<PhotoSize::Ptr> photo;
+
+ /**
+ * @brief Optional. Message is a sticker, information about the sticker
+ */
+ Sticker::Ptr sticker;
+
+ /**
+ * @brief Optional. Message is a forwarded story
+ */
+ Story::Ptr story;
+
+ /**
+ * @brief Optional. Message is a video, information about the video
+ */
+ Video::Ptr video;
+
+ /**
+ * @brief Optional. Message is a [video note](https://telegram.org/blog/video-messages-and-telescope), information about the video message
+ */
+ VideoNote::Ptr videoNote;
+
+ /**
+ * @brief Optional. Message is a voice message, information about the file
+ */
+ Voice::Ptr voice;
+
+ /**
+ * @brief Optional. True, if the message media is covered by a spoiler animation
+ */
+ bool hasMediaSpoiler;
+
+ /**
+ * @brief Optional. Message is a shared contact, information about the contact
+ */
+ Contact::Ptr contact;
+
+ /**
+ * @brief Optional. Message is a dice with random value
+ */
+ Dice::Ptr dice;
+
+ /**
+ * @brief Optional. Message is a game, information about the game.
+ *
+ * [More about games »](https://core.telegram.org/bots/api#games)
+ */
+ Game::Ptr game;
+
+ /**
+ * @brief Optional. Message is a scheduled giveaway, information about the giveaway
+ */
+ Giveaway::Ptr giveaway;
+
+ /**
+ * @brief Optional. A giveaway with public winners was completed
+ */
+ GiveawayWinners::Ptr giveawayWinners;
+
+ /**
+ * @brief Optional. Message is an invoice for a [payment](https://core.telegram.org/bots/api#payments), information about the invoice.
+ *
+ * [More about payments »](https://core.telegram.org/bots/api#payments)
+ */
+ Invoice::Ptr invoice;
+
+ /**
+ * @brief Optional. Message is a shared location, information about the location
+ */
+ Location::Ptr location;
+
+ /**
+ * @brief Optional. Message is a native poll, information about the poll
+ */
+ Poll::Ptr poll;
+
+ /**
+ * @brief Optional. Message is a venue, information about the venue
+ */
+ Venue::Ptr venue;
+};
+}
+
+#endif //TGBOT_EXTERNALREPLYINFO_H
diff --git a/include/tgbot/types/ForceReply.h b/include/tgbot/types/ForceReply.h
index 83a2d0b..234cf20 100644
--- a/include/tgbot/types/ForceReply.h
+++ b/include/tgbot/types/ForceReply.h
@@ -1,5 +1,5 @@
-#ifndef TGBOT_CPP_FORCEREPLY_H
-#define TGBOT_CPP_FORCEREPLY_H
+#ifndef TGBOT_FORCEREPLY_H
+#define TGBOT_FORCEREPLY_H
#include "tgbot/types/GenericReply.h"
@@ -10,19 +10,15 @@ namespace TgBot {
/**
* @brief Upon receiving a message with this object, Telegram clients will display a reply interface to the user (act as if the user has selected the bot's message and tapped 'Reply').
- * This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice privacy mode.
*
- * Example: A poll bot for groups runs in privacy mode (only receives commands, replies to its messages and mentions).
- * There could be two ways to create a new poll:
- *
- * Explain the user how to send a command with parameters (e.g. /newpoll question answer1 answer2).
- * May be appealing for hardcore users but lacks modern day polish.
- *
- * Guide the user through a step-by-step process.
- * 'Please send me your question', 'Cool, now let's add the first answer option', 'Great. Keep adding answer options, then send /done when you're ready'.
+ * This can be extremely useful if you want to create user-friendly step-by-step interfaces without having to sacrifice [privacy mode](https://core.telegram.org/bots/features#privacy-mode).
*
+ * Example: A [poll bot](https://t.me/PollBot) for groups runs in privacy mode (only receives commands, replies to its messages and mentions).
+ * There could be two ways to create a new poll:
+ * - Explain the user how to send a command with parameters (e.g. /newpoll question answer1 answer2). May be appealing for hardcore users but lacks modern day polish.
+ * - Guide the user through a step-by-step process. 'Please send me your question', 'Cool, now let's add the first answer option', 'Great. Keep adding answer options, then send /done when you're ready'.
* The last option is definitely more attractive.
- * And if you use ForceReply in your bot's questions, it will receive the user's answers even if it only receives replies, commands and mentions — without any extra work for the user.
+ * And if you use ForceReply in your bot's questions, it will receive the user's answers even if it only receives replies, commands and mentions - without any extra work for the user.
*
* @ingroup types
*/
@@ -34,7 +30,7 @@ public:
/**
* @brief Shows reply interface to the user, as if they manually selected the bot's message and tapped 'Reply'
*/
- const bool forceReply = true;
+ bool forceReply;
/**
* @brief Optional. The placeholder to be shown in the input field when the reply is active; 1-64 characters
@@ -43,10 +39,11 @@ 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.
*/
- bool selective = false;
+ bool selective;
};
}
-#endif //TGBOT_CPP_FORCEREPLY_H
+#endif //TGBOT_FORCEREPLY_H
diff --git a/include/tgbot/types/Giveaway.h b/include/tgbot/types/Giveaway.h
new file mode 100644
index 0000000..672a1bd
--- /dev/null
+++ b/include/tgbot/types/Giveaway.h
@@ -0,0 +1,68 @@
+#ifndef TGBOT_GIVEAWAY_H
+#define TGBOT_GIVEAWAY_H
+
+#include "tgbot/types/Chat.h"
+
+#include <cstdint>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents a message about a scheduled giveaway.
+ *
+ * @ingroup types
+ */
+class Giveaway {
+
+public:
+ typedef std::shared_ptr<Giveaway> Ptr;
+
+ /**
+ * @brief The list of chats which the user must join to participate in the giveaway
+ */
+ std::vector<Chat::Ptr> chats;
+
+ /**
+ * @brief Point in time (Unix timestamp) when winners of the giveaway will be selected
+ */
+ std::uint32_t winnersSelectionDate;
+
+ /**
+ * @brief The number of users which are supposed to be selected as winners of the giveaway
+ */
+ std::int32_t winnerCount;
+
+ /**
+ * @brief Optional. True, if only users who join the chats after the giveaway started should be eligible to win
+ */
+ bool onlyNewMembers;
+
+ /**
+ * @brief Optional. True, if the list of giveaway winners will be visible to everyone
+ */
+ bool hasPublicWinners;
+
+ /**
+ * @brief Optional. Description of additional giveaway prize
+ */
+ std::string prizeDescription;
+
+ /**
+ * @brief Optional. A list of two-letter [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country codes indicating the countries from which eligible users for the giveaway must come.
+ *
+ * If empty, then all users can participate in the giveaway.
+ * Users with a phone number that was bought on Fragment can always participate in giveaways.
+ */
+ std::vector<std::string> countryCodes;
+
+ /**
+ * @brief Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for
+ */
+ std::int32_t premiumSubscriptionMonthCount;
+};
+}
+
+#endif //TGBOT_GIVEAWAY_H
diff --git a/include/tgbot/types/GiveawayCompleted.h b/include/tgbot/types/GiveawayCompleted.h
new file mode 100644
index 0000000..c48ea68
--- /dev/null
+++ b/include/tgbot/types/GiveawayCompleted.h
@@ -0,0 +1,38 @@
+#ifndef TGBOT_GIVEAWAYCOMPLETED_H
+#define TGBOT_GIVEAWAYCOMPLETED_H
+
+#include <cstdint>
+#include <memory>
+
+namespace TgBot {
+
+class Message;
+
+/**
+ * @brief This object represents a service message about the completion of a giveaway without public winners.
+ *
+ * @ingroup types
+ */
+class GiveawayCompleted {
+
+public:
+ typedef std::shared_ptr<GiveawayCompleted> Ptr;
+
+ /**
+ * @brief Number of winners in the giveaway
+ */
+ std::int32_t winnerCount;
+
+ /**
+ * @brief Optional. Number of undistributed prizes
+ */
+ std::int32_t unclaimedPrizeCount;
+
+ /**
+ * @brief Optional. Message with the giveaway that was completed, if it wasn't deleted
+ */
+ std::shared_ptr<Message> giveawayMessage;
+};
+}
+
+#endif //TGBOT_GIVEAWAYCOMPLETED_H
diff --git a/include/tgbot/types/GiveawayCreated.h b/include/tgbot/types/GiveawayCreated.h
new file mode 100644
index 0000000..9ef6f87
--- /dev/null
+++ b/include/tgbot/types/GiveawayCreated.h
@@ -0,0 +1,22 @@
+#ifndef TGBOT_GIVEAWAYCREATED_H
+#define TGBOT_GIVEAWAYCREATED_H
+
+#include <memory>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents a service message about the creation of a scheduled giveaway.
+ *
+ * Currently holds no information.
+ *
+ * @ingroup types
+ */
+class GiveawayCreated {
+
+public:
+ typedef std::shared_ptr<GiveawayCreated> Ptr;
+};
+}
+
+#endif //TGBOT_GIVEAWAYCREATED_H
diff --git a/include/tgbot/types/GiveawayWinners.h b/include/tgbot/types/GiveawayWinners.h
new file mode 100644
index 0000000..0117b88
--- /dev/null
+++ b/include/tgbot/types/GiveawayWinners.h
@@ -0,0 +1,81 @@
+#ifndef TGBOT_GIVEAWAYWINNERS_H
+#define TGBOT_GIVEAWAYWINNERS_H
+
+#include "tgbot/types/Chat.h"
+#include "tgbot/types/User.h"
+
+#include <cstdint>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents a message about the completion of a giveaway with public winners.
+ *
+ * @ingroup types
+ */
+class GiveawayWinners {
+
+public:
+ typedef std::shared_ptr<GiveawayWinners> Ptr;
+
+ /**
+ * @brief The chat that created the giveaway
+ */
+ Chat::Ptr chat;
+
+ /**
+ * @brief Identifier of the messsage with the giveaway in the chat
+ */
+ std::int32_t giveawayMessageId;
+
+ /**
+ * @brief Point in time (Unix timestamp) when winners of the giveaway were selected
+ */
+ std::uint32_t winnersSelectionDate;
+
+ /**
+ * @brief Total number of winners in the giveaway
+ */
+ std::int32_t winnerCount;
+
+ /**
+ * @brief List of up to 100 winners of the giveaway
+ */
+ std::vector<User::Ptr> winners;
+
+ /**
+ * @brief Optional. The number of other chats the user had to join in order to be eligible for the giveaway
+ */
+ std::int32_t additionalChatCount;
+
+ /**
+ * @brief Optional. The number of months the Telegram Premium subscription won from the giveaway will be active for
+ */
+ std::int32_t premiumSubscriptionMonthCount;
+
+ /**
+ * @brief Optional. Number of undistributed prizes
+ */
+ std::int32_t unclaimedPrizeCount;
+
+ /**
+ * @brief Optional. True, if only users who had joined the chats after the giveaway started were eligible to win
+ */
+ bool onlyNewMembers;
+
+ /**
+ * @brief Optional. True, if the giveaway was canceled because the payment for it was refunded
+ */
+ bool wasRefunded;
+
+ /**
+ * @brief Optional. Description of additional giveaway prize
+ */
+ std::string prizeDescription;
+};
+}
+
+#endif //TGBOT_GIVEAWAYWINNERS_H
diff --git a/include/tgbot/types/InaccessibleMessage.h b/include/tgbot/types/InaccessibleMessage.h
new file mode 100644
index 0000000..d0c7a4b
--- /dev/null
+++ b/include/tgbot/types/InaccessibleMessage.h
@@ -0,0 +1,40 @@
+#ifndef TGBOT_INACCESSIBLEMESSAGE_H
+#define TGBOT_INACCESSIBLEMESSAGE_H
+
+#include "tgbot/types/Chat.h"
+
+#include <cstdint>
+#include <memory>
+
+namespace TgBot {
+
+/**
+ * @brief This object describes a message that was deleted or is otherwise inaccessible to the bot.
+ *
+ * @ingroup types
+ */
+class InaccessibleMessage {
+
+public:
+ typedef std::shared_ptr<InaccessibleMessage> Ptr;
+
+ /**
+ * @brief Chat the message belonged to
+ */
+ Chat::Ptr chat;
+
+ /**
+ * @brief Unique message identifier inside the chat
+ */
+ std::int32_t messageId;
+
+ /**
+ * @brief Always 0.
+ *
+ * The field can be used to differentiate regular and inaccessible messages.
+ */
+ std::uint8_t date;
+};
+}
+
+#endif //TGBOT_INACCESSIBLEMESSAGE_H
diff --git a/include/tgbot/types/InputTextMessageContent.h b/include/tgbot/types/InputTextMessageContent.h
index de2a88a..12b81fd 100644
--- a/include/tgbot/types/InputTextMessageContent.h
+++ b/include/tgbot/types/InputTextMessageContent.h
@@ -3,6 +3,7 @@
#include "tgbot/types/InputMessageContent.h"
#include "tgbot/types/MessageEntity.h"
+#include "tgbot/types/LinkPreviewOptions.h"
#include <memory>
#include <string>
@@ -11,11 +12,12 @@
namespace TgBot {
/**
- * @brief Represents the content of a text message to be sent as the result of an inline query.
+ * @brief Represents the [content](https://core.telegram.org/bots/api#inputmessagecontent) of a text message to be sent as the result of an inline query.
*
* @ingroup types
*/
class InputTextMessageContent : public InputMessageContent {
+
public:
static const std::string TYPE;
@@ -32,19 +34,20 @@ public:
/**
* @brief Optional. Mode for parsing entities in the message text.
- * 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;
/**
- * @brief Optional. List of special entities that appear in message text, which can be specified instead of InputTextMessageContent::parseMode
+ * @brief Optional. List of special entities that appear in message text, which can be specified instead of parseMode
*/
std::vector<MessageEntity::Ptr> entities;
/**
- * @brief Optional. Disables link previews for links in the sent message
+ * @brief Optional. Link preview generation options for the message
*/
- bool disableWebPagePreview;
+ LinkPreviewOptions::Ptr linkPreviewOptions;
};
}
diff --git a/include/tgbot/types/KeyboardButton.h b/include/tgbot/types/KeyboardButton.h
index 97bdc85..77f4ff1 100644
--- a/include/tgbot/types/KeyboardButton.h
+++ b/include/tgbot/types/KeyboardButton.h
@@ -1,7 +1,7 @@
#ifndef TGBOT_KEYBOARDBUTTON_H
#define TGBOT_KEYBOARDBUTTON_H
-#include "tgbot/types/KeyboardButtonRequestUser.h"
+#include "tgbot/types/KeyboardButtonRequestUsers.h"
#include "tgbot/types/KeyboardButtonRequestChat.h"
#include "tgbot/types/KeyboardButtonPollType.h"
#include "tgbot/types/WebAppInfo.h"
@@ -13,8 +13,21 @@ namespace TgBot {
/**
* @brief This object represents one button of the reply keyboard.
+ *
* For simple text buttons, String can be used instead of this object to specify the button text.
- * The optional fields webApp, requestUser, requestChat, requestContact, requestLocation, and requestPoll are mutually exclusive.
+ * 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.
*
* @ingroup types
*/
@@ -25,52 +38,52 @@ public:
/**
* @brief Text of the button.
- *
+ *
* If none of the optional fields are used, it will be sent as a message when the button is pressed
*/
std::string text;
/**
* @brief Optional. If specified, pressing the button will open a list of suitable users.
- *
- * Tapping on any user will send their identifier to the bot in a “user_shared” service message.
+ *
+ * Identifiers of selected users will be sent to the bot in a “usersShared” service message.
* Available in private chats only.
*/
- KeyboardButtonRequestUser::Ptr requestUser;
+ KeyboardButtonRequestUsers::Ptr requestUsers;
/**
* @brief Optional. If specified, pressing the button will open a list of suitable chats.
- *
- * Tapping on a chat will send its identifier to the bot in a “chat_shared” service message.
+ *
+ * Tapping on a chat will send its identifier to the bot in a “chatShared” service message.
* Available in private chats only.
*/
KeyboardButtonRequestChat::Ptr requestChat;
/**
* @brief Optional. If True, the user's phone number will be sent as a contact when the button is pressed.
- *
+ *
* Available in private chats only.
*/
bool requestContact;
/**
* @brief Optional. If True, the user's current location will be sent when the button is pressed.
- *
+ *
* Available in private chats only.
*/
bool requestLocation;
/**
* @brief Optional. If specified, the user will be asked to create a poll and send it to the bot when the button is pressed.
- *
+ *
* Available in private chats only.
*/
KeyboardButtonPollType::Ptr requestPoll;
/**
- * @brief Optional. If specified, the described Web App will be launched when the button is pressed.
- *
- * The Web App will be able to send a “web_app_data” service message.
+ * @brief Optional. If specified, the described [Web App](https://core.telegram.org/bots/webapps) will be launched when the button is pressed.
+ *
+ * The Web App will be able to send a “webAppData” service message.
* Available in private chats only.
*/
WebAppInfo::Ptr webApp;
diff --git a/include/tgbot/types/KeyboardButtonRequestUser.h b/include/tgbot/types/KeyboardButtonRequestUser.h
deleted file mode 100644
index 3ec6f16..0000000
--- a/include/tgbot/types/KeyboardButtonRequestUser.h
+++ /dev/null
@@ -1,45 +0,0 @@
-#ifndef TGBOT_KEYBOARDBUTTONREQUESTUSER_H
-#define TGBOT_KEYBOARDBUTTONREQUESTUSER_H
-
-#include <cstdint>
-#include <memory>
-
-namespace TgBot {
-
-/**
- * @brief This object defines the criteria used to request a suitable user.
- *
- * The identifier of the selected user will be shared with the bot when the corresponding button is pressed.
- * https://core.telegram.org/bots/features#chat-and-user-selection
- *
- * @ingroup types
- */
-class KeyboardButtonRequestUser {
-
-public:
- typedef std::shared_ptr<KeyboardButtonRequestUser> Ptr;
-
- /**
- * @brief Signed 32-bit identifier of the request, which will be received back in the UserShared object.
- *
- * Must be unique within the message
- */
- std::int32_t requestId;
-
- /**
- * @brief Optional. Pass True to request a bot, pass False to request a regular user.
- *
- * If not specified, no additional restrictions are applied.
- */
- bool userIsBot;
-
- /**
- * @brief Optional. Pass True to request a premium user, pass False to request a non-premium user.
- *
- * If not specified, no additional restrictions are applied.
- */
- bool userIsPremium;
-};
-}
-
-#endif //TGBOT_KEYBOARDBUTTONREQUESTUSER_H
diff --git a/include/tgbot/types/KeyboardButtonRequestUsers.h b/include/tgbot/types/KeyboardButtonRequestUsers.h
new file mode 100644
index 0000000..612bd2d
--- /dev/null
+++ b/include/tgbot/types/KeyboardButtonRequestUsers.h
@@ -0,0 +1,52 @@
+#ifndef TGBOT_KEYBOARDBUTTONREQUESTUSERS_H
+#define TGBOT_KEYBOARDBUTTONREQUESTUSERS_H
+
+#include <cstdint>
+#include <memory>
+
+namespace TgBot {
+
+/**
+ * @brief This object defines the criteria used to request suitable users.
+ *
+ * The identifiers of the selected users will be shared with the bot when the corresponding button is pressed.
+ * [More about requesting users »](https://core.telegram.org/bots/features#chat-and-user-selection)
+ *
+ * @ingroup types
+ */
+class KeyboardButtonRequestUsers {
+
+public:
+ typedef std::shared_ptr<KeyboardButtonRequestUsers> Ptr;
+
+ /**
+ * @brief Signed 32-bit identifier of the request that will be received back in the UsersShared object.
+ *
+ * Must be unique within the message
+ */
+ std::int32_t requestId;
+
+ /**
+ * @brief Optional. Pass True to request bots, pass False to request regular users.
+ *
+ * If not specified, no additional restrictions are applied.
+ */
+ bool userIsBot;
+
+ /**
+ * @brief Optional. Pass True to request premium users, pass False to request non-premium users.
+ *
+ * If not specified, no additional restrictions are applied.
+ */
+ bool userIsPremium;
+
+ /**
+ * @brief Optional. The maximum number of users to be selected; 1-10.
+ *
+ * Defaults to 1.
+ */
+ std::uint8_t maxQuantity;
+};
+}
+
+#endif //TGBOT_KEYBOARDBUTTONREQUESTUSERS_H
diff --git a/include/tgbot/types/LinkPreviewOptions.h b/include/tgbot/types/LinkPreviewOptions.h
new file mode 100644
index 0000000..1ee44f1
--- /dev/null
+++ b/include/tgbot/types/LinkPreviewOptions.h
@@ -0,0 +1,48 @@
+#ifndef TGBOT_LINKPREVIEWOPTIONS_H
+#define TGBOT_LINKPREVIEWOPTIONS_H
+
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * @brief Describes the options used for link preview generation.
+ *
+ * @ingroup types
+ */
+class LinkPreviewOptions {
+
+public:
+ typedef std::shared_ptr<LinkPreviewOptions> Ptr;
+
+ /**
+ * @brief Optional. True, if the link preview is disabled
+ */
+ bool isDisabled;
+
+ /**
+ * @brief Optional. URL to use for the link preview.
+ *
+ * If empty, then the first URL found in the message text will be used
+ */
+ 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
+ */
+ 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
+ */
+ bool preferLargeMedia;
+
+ /**
+ * @brief Optional. True, if the link preview must be shown above the message text; otherwise, the link preview will be shown below the message text
+ */
+ bool showAboveText;
+};
+}
+
+#endif //TGBOT_LINKPREVIEWOPTIONS_H
diff --git a/include/tgbot/types/Message.h b/include/tgbot/types/Message.h
index 880b730..0a235e2 100644
--- a/include/tgbot/types/Message.h
+++ b/include/tgbot/types/Message.h
@@ -3,8 +3,12 @@
#include "tgbot/types/User.h"
#include "tgbot/types/Chat.h"
+#include "tgbot/types/MessageOrigin.h"
#include "tgbot/types/Message.h"
+#include "tgbot/types/ExternalReplyInfo.h"
+#include "tgbot/types/TextQuote.h"
#include "tgbot/types/MessageEntity.h"
+#include "tgbot/types/LinkPreviewOptions.h"
#include "tgbot/types/Animation.h"
#include "tgbot/types/Audio.h"
#include "tgbot/types/Document.h"
@@ -23,7 +27,7 @@
#include "tgbot/types/MessageAutoDeleteTimerChanged.h"
#include "tgbot/types/Invoice.h"
#include "tgbot/types/SuccessfulPayment.h"
-#include "tgbot/types/UserShared.h"
+#include "tgbot/types/UsersShared.h"
#include "tgbot/types/ChatShared.h"
#include "tgbot/types/WriteAccessAllowed.h"
#include "tgbot/types/PassportData.h"
@@ -34,6 +38,10 @@
#include "tgbot/types/ForumTopicReopened.h"
#include "tgbot/types/GeneralForumTopicHidden.h"
#include "tgbot/types/GeneralForumTopicUnhidden.h"
+#include "tgbot/types/GiveawayCreated.h"
+#include "tgbot/types/Giveaway.h"
+#include "tgbot/types/GiveawayWinners.h"
+#include "tgbot/types/GiveawayCompleted.h"
#include "tgbot/types/VideoChatScheduled.h"
#include "tgbot/types/VideoChatStarted.h"
#include "tgbot/types/VideoChatEnded.h"
@@ -54,6 +62,7 @@ namespace TgBot {
* @ingroup types
*/
class Message {
+
public:
typedef std::shared_ptr<Message> Ptr;
@@ -69,58 +78,35 @@ public:
/**
* @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.
*/
Chat::Ptr senderChat;
/**
- * @brief Date the message was sent in Unix time
+ * @brief Date the message was sent in Unix time.
+ *
+ * It is always a positive number, representing a valid date.
*/
- std::int64_t date;
+ std::uint32_t date;
/**
- * @brief Conversation the message belongs to
+ * @brief Chat the message belongs to
*/
Chat::Ptr chat;
/**
- * @brief Optional. For forwarded messages, sender of the original message
- */
- User::Ptr forwardFrom;
-
- /**
- * @brief Optional. For messages forwarded from channels or from anonymous administrators, information about the original sender chat
+ * @brief Optional. Information about the original message for forwarded messages
*/
- Chat::Ptr forwardFromChat;
-
- /**
- * @brief Optional. For messages forwarded from channels, identifier of the original message in the channel
- */
- std::int32_t forwardFromMessageId;
-
- /**
- * @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;
-
- /**
- * @brief Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages
- */
- std::string forwardSenderName;
-
- /**
- * @brief Optional. For forwarded messages, date the original message was sent in Unix time
- */
- std::int64_t forwardDate;
+ MessageOrigin::Ptr forwardOrigin;
/**
* @brief Optional. True, if the message is sent to a forum topic
@@ -133,13 +119,23 @@ public:
bool isAutomaticForward;
/**
- * @brief Optional. For replies, the original message.
- *
+ * @brief Optional. For replies in the same chat and message thread, 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;
/**
+ * @brief Optional. Information about the message that is being replied to, which may come from another chat or forum topic
+ */
+ ExternalReplyInfo::Ptr externalReply;
+
+ /**
+ * @brief Optional. For replies that quote part of the original message, the quoted part of the message
+ */
+ TextQuote::Ptr quote;
+
+ /**
* @brief Optional. Bot through which the message was sent
*/
User::Ptr viaBot;
@@ -147,7 +143,7 @@ public:
/**
* @brief Optional. Date the message was last edited in Unix time
*/
- std::int64_t editDate;
+ std::uint32_t editDate;
/**
* @brief Optional. True, if the message can't be forwarded
@@ -158,7 +154,7 @@ public:
* @brief Optional. The unique identifier of a media message group this message belongs to
*/
std::string mediaGroupId;
-
+
/**
* @brief Optional. Signature of the post author for messages in channels, or the custom title of an anonymous group administrator
*/
@@ -175,8 +171,13 @@ public:
std::vector<MessageEntity::Ptr> entities;
/**
+ * @brief Optional. Options used for link preview generation for the message, if it is a text message and link preview options were changed
+ */
+ LinkPreviewOptions::Ptr linkPreviewOptions;
+
+ /**
* @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;
@@ -212,7 +213,7 @@ public:
Video::Ptr video;
/**
- * @brief Optional. Message is a video note, information about the video message
+ * @brief Optional. Message is a [video note](https://telegram.org/blog/video-messages-and-telescope), information about the video message
*/
VideoNote::Ptr videoNote;
@@ -225,7 +226,7 @@ public:
* @brief Optional. Caption for the animation, audio, document, photo, video or voice
*/
std::string caption;
-
+
/**
* @brief Optional. For messages with a caption, special entities like usernames, URLs, bot commands, etc. that appear in the caption
*/
@@ -247,7 +248,9 @@ public:
Dice::Ptr dice;
/**
- * @brief Optional. Message is a game, information about the game. https://core.telegram.org/bots/api#games
+ * @brief Optional. Message is a game, information about the game.
+ *
+ * [More about games »](https://core.telegram.org/bots/api#games)
*/
Game::Ptr game;
@@ -258,7 +261,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;
@@ -300,7 +303,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.
*/
@@ -308,7 +311,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.
*/
@@ -337,29 +340,29 @@ 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.
*/
Message::Ptr pinnedMessage;
/**
- * @brief Optional. Message is an invoice for a payment, information about the invoice.
- *
- * https://core.telegram.org/bots/api#payments
+ * @brief Optional. Message is an invoice for a [payment](https://core.telegram.org/bots/api#payments), information about the invoice.
+ *
+ * [More about payments »](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.
- *
- * https://core.telegram.org/bots/api#payments
+ *
+ * [More about payments »](https://core.telegram.org/bots/api#payments)
*/
SuccessfulPayment::Ptr successfulPayment;
/**
- * @brief Optional. Service message: a user was shared with the bot
+ * @brief Optional. Service message: users were shared with the bot
*/
- UserShared::Ptr userShared;
+ UsersShared::Ptr usersShared;
/**
* @brief Optional. Service message: a chat was shared with the bot
@@ -368,13 +371,13 @@ public:
/**
* @brief Optional. The domain name of the website on which the user has logged in.
- *
- * https://core.telegram.org/widgets/login
+ *
+ * [More about Telegram Login »](https://core.telegram.org/widgets/login)
*/
std::string connectedWebsite;
/**
- * @brief Optional. Service message: the user allowed the bot to write messages after adding it to the attachment or side menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess (https://core.telegram.org/bots/webapps#initializing-mini-apps)
+ * @brief Optional. Service message: the user allowed the bot to write messages after adding it to the attachment or side menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method [requestWriteAccess](https://core.telegram.org/bots/webapps#initializing-mini-apps)
*/
WriteAccessAllowed::Ptr writeAccessAllowed;
@@ -385,7 +388,7 @@ public:
/**
* @brief Optional. Service message.
- *
+ *
* A user in the chat triggered another user's proximity alert while sharing Live Location.
*/
ProximityAlertTriggered::Ptr proximityAlertTriggered;
@@ -421,6 +424,26 @@ public:
GeneralForumTopicUnhidden::Ptr generalForumTopicUnhidden;
/**
+ * @brief Optional. Service message: a scheduled giveaway was created
+ */
+ GiveawayCreated::Ptr giveawayCreated;
+
+ /**
+ * @brief Optional. The message is a scheduled giveaway message
+ */
+ Giveaway::Ptr giveaway;
+
+ /**
+ * @brief Optional. A giveaway with public winners was completed
+ */
+ GiveawayWinners::Ptr giveawayWinners;
+
+ /**
+ * @brief Optional. Service message: a giveaway without public winners was completed
+ */
+ GiveawayCompleted::Ptr giveawayCompleted;
+
+ /**
* @brief Optional. Service message: video chat scheduled
*/
VideoChatScheduled::Ptr videoChatScheduled;
@@ -447,7 +470,7 @@ public:
/**
* @brief Optional. Inline keyboard attached to the message.
- *
+ *
* loginUrl buttons are represented as ordinary url buttons.
*/
InlineKeyboardMarkup::Ptr replyMarkup;
diff --git a/include/tgbot/types/MessageEntity.h b/include/tgbot/types/MessageEntity.h
index 960e1a7..7ebe49e 100644
--- a/include/tgbot/types/MessageEntity.h
+++ b/include/tgbot/types/MessageEntity.h
@@ -11,11 +11,13 @@ namespace TgBot {
/**
* @brief This object represents one special entity in a text message.
+ *
* For example, hashtags, usernames, URLs, etc.
*
* @ingroup types
*/
class MessageEntity {
+
public:
typedef std::shared_ptr<MessageEntity> Ptr;
@@ -23,42 +25,45 @@ public:
* @brief Enum of possible types.
*/
enum class Type {
- Mention, Hashtag, Cashtag, BotCommand, Url, Email, PhoneNumber, Bold, Italic, Underline, Strikethrough, Spoiler, Code, Pre, TextLink, TextMention, CustomEmoji
+ Mention, Hashtag, Cashtag, BotCommand, Url, Email, PhoneNumber, Bold, Italic, Underline, Strikethrough, Spoiler, Blockquote, Code, Pre, TextLink, TextMention, CustomEmoji
};
/**
* @brief Type of the entity.
- * Currently, can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “spoiler” (spoiler message), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames), “custom_emoji” (for inline custom emoji stickers)
+ *
+ * Currently, can be Type::Mention (@username), Type::Hashtag (#hashtag), Type::Cashtag ($USD), Type::BotCommand (/start@jobs_bot), Type::Url (https://telegram.org), Type::Email (do-not-reply@telegram.org), Type::PhoneNumber (+1-212-555-0123), Type::Bold (bold text), Type::Italic (italic text), Type::Underline (underlined text), Type::Strikethrough (strikethrough text), Type::Spoiler (spoiler message), Type::Blockquote (block quotation), Type::Code (monowidth string), Type::Pre (monowidth block), Type::TextLink (for clickable text URLs), Type::TextMention (for users [without usernames](https://telegram.org/blog/edit#new-mentions)), Type::CustomEmoji (for inline custom emoji stickers)
*/
Type type;
/**
- * @brief Offset in UTF-16 code units to the start of the entity
+ * @brief Offset in [UTF-16 code units](https://core.telegram.org/api/entities#entity-length) to the start of the entity
+ *
*/
std::int32_t offset;
/**
- * @brief Length of the entity in UTF-16 code units
+ * @brief Length of the entity in [UTF-16 code units](https://core.telegram.org/api/entities#entity-length)
*/
std::int32_t length;
/**
- * @brief Optional. For “text_link” only, URL that will be opened after user taps on the text
+ * @brief Optional. For Type::TextLink only, URL that will be opened after user taps on the text
*/
std::string url;
/**
- * @brief Optional. For “text_mention” only, the mentioned user
+ * @brief Optional. For Type::TextMention only, the mentioned user
*/
User::Ptr user;
/**
- * @brief Optional. For “pre” only, the programming language of the entity text
+ * @brief Optional. For Type::Pre only, the programming language of the entity text
*/
std::string language;
/**
- * @brief Optional. For “custom_emoji” only, unique identifier of the custom emoji.
+ * @brief Optional. For Type::CustomEmoji only, unique identifier of the custom emoji.
+ *
* Use Api::getCustomEmojiStickers to get full information about the sticker
*/
std::string customEmojiId;
diff --git a/include/tgbot/types/MessageOrigin.h b/include/tgbot/types/MessageOrigin.h
new file mode 100644
index 0000000..3d0b80f
--- /dev/null
+++ b/include/tgbot/types/MessageOrigin.h
@@ -0,0 +1,42 @@
+#ifndef TGBOT_MESSAGEORIGIN_H
+#define TGBOT_MESSAGEORIGIN_H
+
+#include <cstdint>
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * @brief This object describes the origin of a message.
+ *
+ * It can be one of
+ * - MessageOriginUser
+ * - MessageOriginHiddenUser
+ * - MessageOriginChat
+ * - MessageOriginChannel
+ *
+ * @ingroup types
+ */
+class MessageOrigin {
+
+public:
+ typedef std::shared_ptr<MessageOrigin> Ptr;
+
+ MessageOrigin() {}
+
+ virtual ~MessageOrigin() {}
+
+ /**
+ * @brief Type of the message origin
+ */
+ std::string type;
+
+ /**
+ * @brief Date the message was sent originally in Unix time
+ */
+ std::uint32_t date;
+};
+}
+
+#endif //TGBOT_MESSAGEORIGIN_H
diff --git a/include/tgbot/types/MessageOriginChannel.h b/include/tgbot/types/MessageOriginChannel.h
new file mode 100644
index 0000000..2a534ab
--- /dev/null
+++ b/include/tgbot/types/MessageOriginChannel.h
@@ -0,0 +1,46 @@
+#ifndef TGBOT_MESSAGEORIGINCHANNEL_H
+#define TGBOT_MESSAGEORIGINCHANNEL_H
+
+#include "tgbot/types/MessageOrigin.h"
+#include "tgbot/types/Chat.h"
+
+#include <cstdint>
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * @brief The message was originally sent to a channel chat.
+ *
+ * @ingroup types
+ */
+class MessageOriginChannel : public MessageOrigin {
+
+public:
+ static const std::string TYPE;
+
+ typedef std::shared_ptr<MessageOriginChannel> Ptr;
+
+ MessageOriginChannel() {
+ this->type = TYPE;
+ }
+
+ /**
+ * @brief Channel chat to which the message was originally sent
+ */
+ Chat::Ptr chat;
+
+ /**
+ * @brief Unique message identifier inside the chat
+ */
+ std::int32_t messageId;
+
+ /**
+ * @brief Optional. Signature of the original post author
+ */
+ std::string authorSignature;
+};
+}
+
+#endif //TGBOT_MESSAGEORIGINCHANNEL_H
diff --git a/include/tgbot/types/MessageOriginChat.h b/include/tgbot/types/MessageOriginChat.h
new file mode 100644
index 0000000..8a750e7
--- /dev/null
+++ b/include/tgbot/types/MessageOriginChat.h
@@ -0,0 +1,40 @@
+#ifndef TGBOT_MESSAGEORIGINCHAT_H
+#define TGBOT_MESSAGEORIGINCHAT_H
+
+#include "tgbot/types/MessageOrigin.h"
+#include "tgbot/types/Chat.h"
+
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * @brief The message was originally sent on behalf of a chat to a group chat.
+ *
+ * @ingroup types
+ */
+class MessageOriginChat : public MessageOrigin {
+
+public:
+ static const std::string TYPE;
+
+ typedef std::shared_ptr<MessageOriginChat> Ptr;
+
+ MessageOriginChat() {
+ this->type = TYPE;
+ }
+
+ /**
+ * @brief Chat that sent the message originally
+ */
+ Chat::Ptr senderChat;
+
+ /**
+ * @brief Optional. For messages originally sent by an anonymous chat administrator, original message author signature
+ */
+ std::string authorSignature;
+};
+}
+
+#endif //TGBOT_MESSAGEORIGINCHAT_H
diff --git a/include/tgbot/types/MessageOriginHiddenUser.h b/include/tgbot/types/MessageOriginHiddenUser.h
new file mode 100644
index 0000000..616661a
--- /dev/null
+++ b/include/tgbot/types/MessageOriginHiddenUser.h
@@ -0,0 +1,34 @@
+#ifndef TGBOT_MESSAGEORIGINHIDDENUSER_H
+#define TGBOT_MESSAGEORIGINHIDDENUSER_H
+
+#include "tgbot/types/MessageOrigin.h"
+
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * @brief The message was originally sent by an unknown user.
+ *
+ * @ingroup types
+ */
+class MessageOriginHiddenUser : public MessageOrigin {
+
+public:
+ static const std::string TYPE;
+
+ typedef std::shared_ptr<MessageOriginHiddenUser> Ptr;
+
+ MessageOriginHiddenUser() {
+ this->type = TYPE;
+ }
+
+ /**
+ * @brief Name of the user that sent the message originally
+ */
+ std::string senderUserName;
+};
+}
+
+#endif //TGBOT_MESSAGEORIGINHIDDENUSER_H
diff --git a/include/tgbot/types/MessageOriginUser.h b/include/tgbot/types/MessageOriginUser.h
new file mode 100644
index 0000000..4f94e72
--- /dev/null
+++ b/include/tgbot/types/MessageOriginUser.h
@@ -0,0 +1,34 @@
+#ifndef TGBOT_MESSAGEORIGINUSER_H
+#define TGBOT_MESSAGEORIGINUSER_H
+
+#include "tgbot/types/MessageOrigin.h"
+#include "tgbot/types/User.h"
+
+#include <memory>
+
+namespace TgBot {
+
+/**
+ * @brief The message was originally sent by a known user.
+ *
+ * @ingroup types
+ */
+class MessageOriginUser : public MessageOrigin {
+
+public:
+ static const std::string TYPE;
+
+ typedef std::shared_ptr<MessageOriginUser> Ptr;
+
+ MessageOriginUser() {
+ this->type = TYPE;
+ }
+
+ /**
+ * @brief User that sent the message originally
+ */
+ User::Ptr senderUser;
+};
+}
+
+#endif //TGBOT_MESSAGEORIGINUSER_H
diff --git a/include/tgbot/types/MessageReactionCountUpdated.h b/include/tgbot/types/MessageReactionCountUpdated.h
new file mode 100644
index 0000000..57337f1
--- /dev/null
+++ b/include/tgbot/types/MessageReactionCountUpdated.h
@@ -0,0 +1,45 @@
+#ifndef TGBOT_MESSAGEREACTIONCOUNTUPDATED_H
+#define TGBOT_MESSAGEREACTIONCOUNTUPDATED_H
+
+#include "tgbot/types/Chat.h"
+#include "tgbot/types/ReactionCount.h"
+
+#include <cstdint>
+#include <memory>
+#include <vector>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents reaction changes on a message with anonymous reactions.
+ *
+ * @ingroup types
+ */
+class MessageReactionCountUpdated {
+
+public:
+ typedef std::shared_ptr<MessageReactionCountUpdated> Ptr;
+
+ /**
+ * @brief The chat containing the message
+ */
+ Chat::Ptr chat;
+
+ /**
+ * @brief Unique message identifier inside the chat
+ */
+ std::int32_t messageId;
+
+ /**
+ * @brief Date of the change in Unix time
+ */
+ std::uint32_t date;
+
+ /**
+ * @brief List of reactions that are present on the message
+ */
+ std::vector<ReactionCount::Ptr> reactions;
+};
+}
+
+#endif //TGBOT_MESSAGEREACTIONCOUNTUPDATED_H
diff --git a/include/tgbot/types/MessageReactionUpdated.h b/include/tgbot/types/MessageReactionUpdated.h
new file mode 100644
index 0000000..8e4252a
--- /dev/null
+++ b/include/tgbot/types/MessageReactionUpdated.h
@@ -0,0 +1,61 @@
+#ifndef TGBOT_MESSAGEREACTIONUPDATED_H
+#define TGBOT_MESSAGEREACTIONUPDATED_H
+
+#include "tgbot/types/Chat.h"
+#include "tgbot/types/User.h"
+#include "tgbot/types/ReactionType.h"
+
+#include <cstdint>
+#include <memory>
+#include <vector>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents a change of a reaction on a message performed by a user.
+ *
+ * @ingroup types
+ */
+class MessageReactionUpdated {
+
+public:
+ typedef std::shared_ptr<MessageReactionUpdated> Ptr;
+
+ /**
+ * @brief The chat containing the message the user reacted to
+ */
+ Chat::Ptr chat;
+
+ /**
+ * @brief Unique identifier of the message inside the chat
+ */
+ std::int32_t messageId;
+
+ /**
+ * @brief Optional. The user that changed the reaction, if the user isn't anonymous
+ */
+ User::Ptr user;
+
+ /**
+ * @brief Optional. The chat on behalf of which the reaction was changed, if the user is anonymous
+ */
+ Chat::Ptr actorChat;
+
+ /**
+ * @brief Date of the change in Unix time
+ */
+ std::uint32_t date;
+
+ /**
+ * @brief Previous list of reaction types that were set by the user
+ */
+ std::vector<ReactionType::Ptr> oldReaction;
+
+ /**
+ * @brief New list of reaction types that have been set by the user
+ */
+ std::vector<ReactionType::Ptr> newReaction;
+};
+}
+
+#endif //TGBOT_MESSAGEREACTIONUPDATED_H
diff --git a/include/tgbot/types/ReactionCount.h b/include/tgbot/types/ReactionCount.h
new file mode 100644
index 0000000..bb1512d
--- /dev/null
+++ b/include/tgbot/types/ReactionCount.h
@@ -0,0 +1,33 @@
+#ifndef TGBOT_REACTIONCOUNT_H
+#define TGBOT_REACTIONCOUNT_H
+
+#include "tgbot/types/ReactionType.h"
+
+#include <cstdint>
+#include <memory>
+
+namespace TgBot {
+
+/**
+ * @brief Represents a reaction added to a message along with the number of times it was added.
+ *
+ * @ingroup types
+ */
+class ReactionCount {
+
+public:
+ typedef std::shared_ptr<ReactionCount> Ptr;
+
+ /**
+ * @brief Type of the reaction
+ */
+ ReactionType::Ptr type;
+
+ /**
+ * @brief Number of times the reaction was added
+ */
+ std::int32_t totalCount;
+};
+}
+
+#endif //TGBOT_REACTIONCOUNT_H
diff --git a/include/tgbot/types/ReactionType.h b/include/tgbot/types/ReactionType.h
new file mode 100644
index 0000000..7349550
--- /dev/null
+++ b/include/tgbot/types/ReactionType.h
@@ -0,0 +1,34 @@
+#ifndef TGBOT_REACTIONTYPE_H
+#define TGBOT_REACTIONTYPE_H
+
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * @brief This object describes the type of a reaction.
+ *
+ * Currently, it can be one of
+ * - ReactionTypeEmoji
+ * - ReactionTypeCustomEmoji
+ *
+ * @ingroup types
+ */
+class ReactionType {
+
+public:
+ typedef std::shared_ptr<ReactionType> Ptr;
+
+ ReactionType() {}
+
+ virtual ~ReactionType() {}
+
+ /**
+ * @brief Type of the reaction
+ */
+ std::string type;
+};
+}
+
+#endif //TGBOT_REACTIONTYPE_H
diff --git a/include/tgbot/types/ReactionTypeCustomEmoji.h b/include/tgbot/types/ReactionTypeCustomEmoji.h
new file mode 100644
index 0000000..4185c74
--- /dev/null
+++ b/include/tgbot/types/ReactionTypeCustomEmoji.h
@@ -0,0 +1,34 @@
+#ifndef TGBOT_REACTIONTYPECUSTOMEMOJI_H
+#define TGBOT_REACTIONTYPECUSTOMEMOJI_H
+
+#include "tgbot/types/ReactionType.h"
+
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * @brief The reaction is based on a custom emoji.
+ *
+ * @ingroup types
+ */
+class ReactionTypeCustomEmoji : public ReactionType {
+
+public:
+ static const std::string TYPE;
+
+ typedef std::shared_ptr<ReactionTypeCustomEmoji> Ptr;
+
+ ReactionTypeCustomEmoji() {
+ this->type = TYPE;
+ }
+
+ /**
+ * @brief Custom emoji identifier
+ */
+ std::string customEmojiId;
+};
+}
+
+#endif //TGBOT_REACTIONTYPECUSTOMEMOJI_H
diff --git a/include/tgbot/types/ReactionTypeEmoji.h b/include/tgbot/types/ReactionTypeEmoji.h
new file mode 100644
index 0000000..770e961
--- /dev/null
+++ b/include/tgbot/types/ReactionTypeEmoji.h
@@ -0,0 +1,38 @@
+#ifndef TGBOT_REACTIONTYPEEMOJI_H
+#define TGBOT_REACTIONTYPEEMOJI_H
+
+#include "tgbot/types/ReactionType.h"
+
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * @brief The reaction is based on an emoji.
+ *
+ * @ingroup types
+ */
+class ReactionTypeEmoji : public ReactionType {
+
+public:
+ static const std::string TYPE;
+
+ typedef std::shared_ptr<ReactionTypeEmoji> Ptr;
+
+ ReactionTypeEmoji() {
+ this->type = TYPE;
+ }
+
+ /**
+ * @brief Reaction emoji.
+ *
+ * Currently, it can be one of "👍", "👎", "❤", "🔥", "🥰", "👏", "😁", "🤔", "🤯", "😱", "🤬", "😢", "🎉", "🤩", "🤮", "💩", "🙏", "👌", "🕊", "🤡", "🥱", "🥴", "😍", "🐳", "❤‍🔥", "🌚", "🌭", "💯", "🤣", "⚡", "🍌", "🏆", "💔", "🤨", "😐", "🍓", "🍾", "💋", "🖕", "😈", "😴", "😭", "🤓", "👻", "👨‍💻", "👀", "🎃", "🙈", "😇", "😨", "🤝", "✍", "🤗", "🫡", "🎅", "🎄", "☃", "💅", "🤪", "🗿", "🆒", "💘", "🙉", "🦄", "😘", "💊", "🙊", "😎", "👾", "🤷‍♂", "🤷", "🤷‍♀", "😡"
+ *
+ * See https://core.telegram.org/bots/api#reactiontypeemoji
+ */
+ std::string emoji;
+};
+}
+
+#endif //TGBOT_REACTIONTYPEEMOJI_H
diff --git a/include/tgbot/types/ReplyKeyboardRemove.h b/include/tgbot/types/ReplyKeyboardRemove.h
index 4522bda..7c3aad9 100644
--- a/include/tgbot/types/ReplyKeyboardRemove.h
+++ b/include/tgbot/types/ReplyKeyboardRemove.h
@@ -1,5 +1,5 @@
-#ifndef TGBOT_CPP_REPLYKEYBOARDREMOVE_H
-#define TGBOT_CPP_REPLYKEYBOARDREMOVE_H
+#ifndef TGBOT_REPLYKEYBOARDREMOVE_H
+#define TGBOT_REPLYKEYBOARDREMOVE_H
#include "tgbot/types/GenericReply.h"
@@ -10,8 +10,8 @@ namespace TgBot {
/**
* @brief Upon receiving a message with this object, Telegram clients will remove the current custom keyboard and display the default letter-keyboard.
*
- * By default, custom keyboards are displayed until a new keyboard is sent by a bot. An exception is made for one-time keyboards that are hidden
- * immediately after the user presses a button (see ReplyKeyboardMarkup).
+ * By default, custom keyboards are displayed until a new keyboard is sent by a bot.
+ * An exception is made for one-time keyboards that are hidden immediately after the user presses a button (see ReplyKeyboardMarkup).
*
* @ingroup types
*/
@@ -21,20 +21,18 @@ public:
typedef std::shared_ptr<ReplyKeyboardRemove> Ptr;
/**
- * @brief Requests clients to remove the custom keyboard (user will not be able to summon this keyboard;
- *
- * if you want to hide the keyboard from sight but keep it accessible, use one_time_keyboard in ReplyKeyboardMarkup)
+ * @brief Requests clients to remove the custom keyboard (user will not be able to summon this keyboard; if you want to hide the keyboard from sight but keep it accessible, use oneTimeKeyboard in ReplyKeyboardMarkup)
*/
- const bool removeKeyboard = true;
+ bool removeKeyboard;
/**
- * @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 reply_to_message_id), sender of the original message.
+ * @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.
* 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 = false;
+ bool selective;
};
-
}
-#endif //TGBOT_CPP_REPLYKEYBOARDREMOVE_H
+#endif //TGBOT_REPLYKEYBOARDREMOVE_H
diff --git a/include/tgbot/types/ReplyParameters.h b/include/tgbot/types/ReplyParameters.h
new file mode 100644
index 0000000..72b314f
--- /dev/null
+++ b/include/tgbot/types/ReplyParameters.h
@@ -0,0 +1,67 @@
+#ifndef TGBOT_REPLYPARAMETERS_H
+#define TGBOT_REPLYPARAMETERS_H
+
+#include "tgbot/types/MessageEntity.h"
+
+#include <cstdint>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace TgBot {
+
+/**
+ * @brief Describes reply parameters for the message that is being sent.
+ *
+ * @ingroup types
+ */
+class ReplyParameters {
+
+public:
+ typedef std::shared_ptr<ReplyParameters> Ptr;
+
+ /**
+ * @brief Identifier of the message that will be replied to in the current chat, or in the chat chatId if it is specified
+ */
+ std::int32_t messageId;
+
+ /**
+ * @brief Optional. If the message to be replied to is from a different chat, unique identifier for the chat or username of the channel (in the format @channelusername)
+ */
+ std::int64_t chatId;
+
+ /**
+ * @brief Optional. Pass True if the message should be sent even if the specified message to be replied to is not found; can be used only for replies in the same chat and forum topic.
+ */
+ bool allowSendingWithoutReply;
+
+ /**
+ * @brief Optional. Quoted part of the message to be replied to; 0-1024 characters after entities parsing.
+ *
+ * The quote must be an exact substring of the message to be replied to, including bold, italic, underline, strikethrough, spoiler, and customEmoji entities.
+ * The message will fail to send if the quote isn't found in the original message.
+ */
+ std::string quote;
+
+ /**
+ * @brief Optional. Mode for parsing entities in the quote.
+ *
+ * See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
+ */
+ std::string quoteParseMode;
+
+ /**
+ * @brief Optional. A JSON-serialized list of special entities that appear in the quote.
+ *
+ * It can be specified instead of quoteParseMode.
+ */
+ std::vector<MessageEntity::Ptr> quoteEntities;
+
+ /**
+ * @brief Optional. Position of the quote in the original message in UTF-16 code units
+ */
+ std::int32_t quotePosition;
+};
+}
+
+#endif //TGBOT_REPLYPARAMETERS_H
diff --git a/include/tgbot/types/ShippingAddress.h b/include/tgbot/types/ShippingAddress.h
index 68efb4c..02feadd 100644
--- a/include/tgbot/types/ShippingAddress.h
+++ b/include/tgbot/types/ShippingAddress.h
@@ -1,49 +1,48 @@
#ifndef TGBOT_SHIPPINGADDRESS_H
#define TGBOT_SHIPPINGADDRESS_H
-#include <string>
#include <memory>
+#include <string>
namespace TgBot {
/**
* @brief This object represents a shipping address.
*
- * https://core.telegram.org/bots/api#shippingaddress
- *
* @ingroup types
*/
class ShippingAddress {
+
public:
typedef std::shared_ptr<ShippingAddress> Ptr;
/**
- * @brief ISO 3166-1 alpha-2 country code.
+ * @brief Two-letter [ISO 3166-1 alpha-2](https://en.wikipedia.org/wiki/ISO_3166-1_alpha-2) country code
*/
std::string countryCode;
/**
- * @brief State, if applicable.
+ * @brief State, if applicable
*/
std::string state;
/**
- * @brief City.
+ * @brief City
*/
std::string city;
/**
- * @brief First line for the address.
+ * @brief First line for the address
*/
std::string streetLine1;
/**
- * @brief Second line for the address.
+ * @brief Second line for the address
*/
std::string streetLine2;
/**
- * Address post code.
+ * @brief Address post code
*/
std::string postCode;
};
diff --git a/include/tgbot/types/TextQuote.h b/include/tgbot/types/TextQuote.h
new file mode 100644
index 0000000..7c871c3
--- /dev/null
+++ b/include/tgbot/types/TextQuote.h
@@ -0,0 +1,49 @@
+#ifndef TGBOT_TEXTQUOTE_H
+#define TGBOT_TEXTQUOTE_H
+
+#include "tgbot/types/MessageEntity.h"
+
+#include <cstdint>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace TgBot {
+
+/**
+ * @brief This object contains information about the quoted part of a message that is replied to by the given message.
+ *
+ * @ingroup types
+ */
+class TextQuote {
+
+public:
+ typedef std::shared_ptr<TextQuote> Ptr;
+
+ /**
+ * @brief Text of the quoted part of a message that is replied to by the given message
+ */
+ std::string text;
+
+ /**
+ * @brief Optional. Special entities that appear in the quote.
+ *
+ * Currently, only bold, italic, underline, strikethrough, spoiler, and customEmoji entities are kept in quotes.
+ */
+ std::vector<MessageEntity::Ptr> entities;
+
+ /**
+ * @brief Approximate quote position in the original message in UTF-16 code units as specified by the sender
+ */
+ std::int32_t position;
+
+ /**
+ * @brief Optional. True, if the quote was chosen manually by the message sender.
+ *
+ * Otherwise, the quote was added automatically by the server.
+ */
+ bool isManual;
+};
+}
+
+#endif //TGBOT_TEXTQUOTE_H
diff --git a/include/tgbot/types/Update.h b/include/tgbot/types/Update.h
index 6294ff5..920c7c3 100644
--- a/include/tgbot/types/Update.h
+++ b/include/tgbot/types/Update.h
@@ -1,7 +1,9 @@
-#ifndef TGBOT_CPP_UPDATE_H
-#define TGBOT_CPP_UPDATE_H
+#ifndef TGBOT_UPDATE_H
+#define TGBOT_UPDATE_H
#include "tgbot/types/Message.h"
+#include "tgbot/types/MessageReactionUpdated.h"
+#include "tgbot/types/MessageReactionCountUpdated.h"
#include "tgbot/types/InlineQuery.h"
#include "tgbot/types/ChosenInlineResult.h"
#include "tgbot/types/CallbackQuery.h"
@@ -11,6 +13,8 @@
#include "tgbot/types/PollAnswer.h"
#include "tgbot/types/ChatMemberUpdated.h"
#include "tgbot/types/ChatJoinRequest.h"
+#include "tgbot/types/ChatBoostUpdated.h"
+#include "tgbot/types/ChatBoostRemoved.h"
#include <cstdint>
#include <memory>
@@ -18,7 +22,8 @@
namespace TgBot {
/**
- * @brief This object represents an incoming update.
+ * @brief This [object](https://core.telegram.org/bots/api#available-types) represents an incoming update.
+ *
* At most one of the optional parameters can be present in any given update.
*
* @ingroup types
@@ -29,41 +34,58 @@ public:
typedef std::shared_ptr<Update> Ptr;
/**
- * @brief The update‘s unique identifier.
+ * @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, since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order.
+ * 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.
* 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;
/**
- * @brief Optional. New incoming message of any kind — text, photo, sticker, etc.
+ * @brief Optional. New incoming message of any kind - text, photo, sticker, etc.
*/
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
+ */
Message::Ptr editedMessage;
/**
- * @brief Optional. New incoming channel post of any kind — text, photo, sticker, etc.
- */
+ * @brief Optional. New incoming channel post of any kind - text, photo, sticker, etc.
+ */
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
+ */
Message::Ptr editedChannelPost;
/**
- * @brief Optional. New incoming inline query
+ * @brief Optional. A reaction to a message was changed by a user.
+ *
+ * The bot must be an administrator in the chat and must explicitly specify "message_reaction" in the list of allowedUpdates to receive these updates.
+ * The update isn't received for reactions set by bots.
+ */
+ MessageReactionUpdated::Ptr messageReaction;
+
+ /**
+ * @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.
+ */
+ MessageReactionCountUpdated::Ptr messageReactionCount;
+
+ /**
+ * @brief Optional. New incoming [inline](https://core.telegram.org/bots/api#inline-mode) query
*/
InlineQuery::Ptr inlineQuery;
/**
- * @brief Optional. The result of an inline query that was chosen by a user and sent to their chat partner.
- * Please see https://core.telegram.org/bots/inline#collecting-feedback for details on how to enable these updates for your bot. (https://core.telegram.org/bots/inline#collecting-feedback)
+ * @brief Optional. The result of an [inline](https://core.telegram.org/bots/api#inline-mode) query that was chosen by a user and sent to their chat partner.
+ *
+ * Please see our documentation on the [feedback collecting](https://core.telegram.org/bots/inline#collecting-feedback) for details on how to enable these updates for your bot.
*/
ChosenInlineResult::Ptr chosenInlineResult;
@@ -74,46 +96,67 @@ public:
/**
* @brief Optional. New incoming shipping query.
+ *
* Only for invoices with flexible price
*/
ShippingQuery::Ptr shippingQuery;
/**
* @brief Optional. New incoming pre-checkout query.
+ *
* Contains full information about checkout
*/
PreCheckoutQuery::Ptr preCheckoutQuery;
/**
* @brief Optional. New poll state.
+ *
* Bots receive only updates about stopped polls and polls, which are sent by the bot
*/
Poll::Ptr poll;
/**
* @brief Optional. A user changed their answer in a non-anonymous poll.
+ *
* Bots receive new votes only in polls that were sent by the bot itself.
*/
PollAnswer::Ptr pollAnswer;
/**
* @brief Optional. The bot's chat member status was updated in a chat.
+ *
* For private chats, this update is received only when the bot is blocked or unblocked by the user.
*/
ChatMemberUpdated::Ptr myChatMember;
/**
* @brief Optional. A chat member's status was updated in a chat.
- * The bot must be an administrator in the chat and must explicitly specify “chatMember” in the list of allowedUpdates to receive these updates.
+ *
+ * The bot must be an administrator in the chat and must explicitly specify "chat_member" in the list of allowedUpdates to receive these updates.
*/
ChatMemberUpdated::Ptr chatMember;
/**
* @brief Optional. A request to join the chat has been sent.
+ *
* The bot must have the canInviteUsers administrator right in the chat to receive these updates.
*/
ChatJoinRequest::Ptr chatJoinRequest;
+
+ /**
+ * @brief Optional. A chat boost was added or changed.
+ *
+ * The bot must be an administrator in the chat to receive these updates.
+ */
+ ChatBoostUpdated::Ptr chatBoost;
+
+ /**
+ * @brief Optional. A boost was removed from a chat.
+ *
+ * The bot must be an administrator in the chat to receive these updates.
+ */
+ ChatBoostRemoved::Ptr removedChatBoost;
};
}
-#endif //TGBOT_CPP_UPDATE_H
+#endif //TGBOT_UPDATE_H
diff --git a/include/tgbot/types/UserChatBoosts.h b/include/tgbot/types/UserChatBoosts.h
new file mode 100644
index 0000000..c1b058d
--- /dev/null
+++ b/include/tgbot/types/UserChatBoosts.h
@@ -0,0 +1,28 @@
+#ifndef TGBOT_USERCHATBOOSTS_H
+#define TGBOT_USERCHATBOOSTS_H
+
+#include "tgbot/types/ChatBoost.h"
+
+#include <memory>
+#include <vector>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents a list of boosts added to a chat by a user.
+ *
+ * @ingroup types
+ */
+class UserChatBoosts {
+
+public:
+ typedef std::shared_ptr<UserChatBoosts> Ptr;
+
+ /**
+ * @brief The list of boosts added to the chat by the user
+ */
+ std::vector<ChatBoost::Ptr> boosts;
+};
+}
+
+#endif //TGBOT_USERCHATBOOSTS_H
diff --git a/include/tgbot/types/UserShared.h b/include/tgbot/types/UserShared.h
deleted file mode 100644
index 9d92b4d..0000000
--- a/include/tgbot/types/UserShared.h
+++ /dev/null
@@ -1,36 +0,0 @@
-#ifndef TGBOT_USERSHARED_H
-#define TGBOT_USERSHARED_H
-
-#include <cstdint>
-#include <memory>
-
-namespace TgBot {
-
-/**
- * @brief This object contains information about the user whose identifier was shared with the bot using a KeyboardButtonRequestUser button.
- *
- * @ingroup types
- */
-class UserShared {
-
-public:
- typedef std::shared_ptr<UserShared> Ptr;
-
- /**
- * @brief Identifier of the request
- */
- std::int32_t requestId;
-
- /**
- * @brief Identifier of the shared user.
- *
- * The bot may not have access to the user and could be unable to use this identifier, unless the user is already known to the bot by some other means.
- *
- * 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 64-bit integer or double-precision float type are safe for storing this identifier.
- */
- std::int64_t userId;
-};
-}
-
-#endif //TGBOT_USERSHARED_H
diff --git a/include/tgbot/types/UsersShared.h b/include/tgbot/types/UsersShared.h
new file mode 100644
index 0000000..82a63e5
--- /dev/null
+++ b/include/tgbot/types/UsersShared.h
@@ -0,0 +1,36 @@
+#ifndef TGBOT_USERSSHARED_H
+#define TGBOT_USERSSHARED_H
+
+#include <cstdint>
+#include <memory>
+#include <vector>
+
+namespace TgBot {
+
+/**
+ * @brief This object contains information about the users whose identifiers were shared with the bot using a KeyboardButtonRequestUsers button.
+ *
+ * @ingroup types
+ */
+class UsersShared {
+
+public:
+ typedef std::shared_ptr<UsersShared> Ptr;
+
+ /**
+ * @brief Identifier of the request
+ */
+ std::int32_t requestId;
+
+ /**
+ * @brief Identifiers of the shared users.
+ *
+ * These numbers may have more than 32 significant bits and some programming languages may have difficulty/silent defects in interpreting them.
+ * But they have at most 52 significant bits, so 64-bit integers or double-precision float types are safe for storing these identifiers.
+ * The bot may not have access to the users and could be unable to use these identifiers, unless the users are already known to the bot by some other means.
+ */
+ std::vector<std::int64_t> userIds;
+};
+}
+
+#endif //TGBOT_USERSSHARED_H
diff --git a/src/Api.cpp b/src/Api.cpp
index 0d11295..cdd5ad7 100644
--- a/src/Api.cpp
+++ b/src/Api.cpp
@@ -112,17 +112,16 @@ bool Api::close() const {
Message::Ptr Api::sendMessage(boost::variant<std::int64_t, std::string> chatId,
const std::string& text,
- bool disableWebPagePreview,
- std::int32_t replyToMessageId,
+ LinkPreviewOptions::Ptr linkPreviewOptions,
+ ReplyParameters::Ptr replyParameters,
GenericReply::Ptr replyMarkup,
const std::string& parseMode,
bool disableNotification,
const std::vector<MessageEntity::Ptr>& entities,
- bool allowSendingWithoutReply,
- bool protectContent,
- std::int32_t messageThreadId) const {
+ std::int32_t messageThreadId,
+ bool protectContent) const {
std::vector<HttpReqArg> args;
- args.reserve(11);
+ args.reserve(10);
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
@@ -135,8 +134,8 @@ Message::Ptr Api::sendMessage(boost::variant<std::int64_t, std::string> chatId,
if (!entities.empty()) {
args.emplace_back("entities", _tgTypeParser.parseArray<MessageEntity>(&TgTypeParser::parseMessageEntity, entities));
}
- if (disableWebPagePreview) {
- args.emplace_back("disable_web_page_preview", disableWebPagePreview);
+ if (linkPreviewOptions != nullptr) {
+ args.emplace_back("link_preview_options", _tgTypeParser.parseLinkPreviewOptions(linkPreviewOptions));
}
if (disableNotification) {
args.emplace_back("disable_notification", disableNotification);
@@ -144,11 +143,8 @@ Message::Ptr Api::sendMessage(boost::variant<std::int64_t, std::string> chatId,
if (protectContent) {
args.emplace_back("protect_content", protectContent);
}
- if (replyToMessageId != 0) {
- args.emplace_back("reply_to_message_id", replyToMessageId);
- }
- if (allowSendingWithoutReply) {
- args.emplace_back("allow_sending_without_reply", allowSendingWithoutReply);
+ if (replyParameters != nullptr) {
+ args.emplace_back("reply_parameters", _tgTypeParser.parseReplyParameters(replyParameters));
}
if (replyMarkup) {
args.emplace_back("reply_markup", _tgTypeParser.parseGenericReply(replyMarkup));
@@ -182,6 +178,36 @@ Message::Ptr Api::forwardMessage(boost::variant<std::int64_t, std::string> chatI
return _tgTypeParser.parseJsonAndGetMessage(sendRequest("forwardMessage", args));
}
+std::vector<MessageId::Ptr> Api::forwardMessages(boost::variant<std::int64_t, std::string> chatId,
+ boost::variant<std::int64_t, std::string> fromChatId,
+ const std::vector<std::int32_t>& messageIds,
+ std::int32_t messageThreadId,
+ bool disableNotification,
+ bool protectContent) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(6);
+
+ args.emplace_back("chat_id", chatId);
+ args.emplace_back("from_chat_id", fromChatId);
+ if (!messageIds.empty()) {
+ args.emplace_back("message_ids", _tgTypeParser.parseArray<std::int32_t>(
+ [] (const std::int32_t& i)->std::int32_t {
+ return i;
+ }, messageIds));
+ }
+ if (messageThreadId != 0) {
+ args.emplace_back("message_thread_id", messageThreadId);
+ }
+ if (disableNotification) {
+ args.emplace_back("disable_notification", disableNotification);
+ }
+ if (protectContent) {
+ args.emplace_back("protect_content", protectContent);
+ }
+
+ return _tgTypeParser.parseJsonAndGetArray<MessageId>(&TgTypeParser::parseJsonAndGetMessageId, sendRequest("forwardMessages", args));
+}
+
MessageId::Ptr Api::copyMessage(boost::variant<std::int64_t, std::string> chatId,
boost::variant<std::int64_t, std::string> fromChatId,
std::int32_t messageId,
@@ -189,13 +215,12 @@ MessageId::Ptr Api::copyMessage(boost::variant<std::int64_t, std::string> chatId
const std::string& parseMode,
const std::vector<MessageEntity::Ptr>& captionEntities,
bool disableNotification,
- std::int32_t replyToMessageId,
- bool allowSendingWithoutReply,
+ ReplyParameters::Ptr replyParameters,
GenericReply::Ptr replyMarkup,
bool protectContent,
std::int32_t messageThreadId) const {
std::vector<HttpReqArg> args;
- args.reserve(12);
+ args.reserve(11);
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
@@ -218,11 +243,8 @@ MessageId::Ptr Api::copyMessage(boost::variant<std::int64_t, std::string> chatId
if (protectContent) {
args.emplace_back("protect_content", protectContent);
}
- if (replyToMessageId) {
- args.emplace_back("reply_to_message_id", replyToMessageId);
- }
- if (allowSendingWithoutReply) {
- args.emplace_back("allow_sending_without_reply", allowSendingWithoutReply);
+ if (replyParameters != nullptr) {
+ args.emplace_back("reply_parameters", _tgTypeParser.parseReplyParameters(replyParameters));
}
if (replyMarkup) {
args.emplace_back("reply_markup", _tgTypeParser.parseGenericReply(replyMarkup));
@@ -231,20 +253,54 @@ MessageId::Ptr Api::copyMessage(boost::variant<std::int64_t, std::string> chatId
return _tgTypeParser.parseJsonAndGetMessageId(sendRequest("copyMessage", args));
}
+std::vector<MessageId::Ptr> Api::copyMessages(boost::variant<std::int64_t, std::string> chatId,
+ boost::variant<std::int64_t, std::string> fromChatId,
+ const std::vector<std::int32_t>& messageIds,
+ std::int32_t messageThreadId,
+ bool disableNotification,
+ bool protectContent,
+ bool removeCaption) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(7);
+
+ args.emplace_back("chat_id", chatId);
+ args.emplace_back("from_chat_id", fromChatId);
+
+ if (!messageIds.empty()) {
+ args.emplace_back("message_ids", _tgTypeParser.parseArray<std::int32_t>(
+ [] (const std::int32_t& i)->std::int32_t {
+ return i;
+ }, messageIds));
+ }
+ if (messageThreadId != 0) {
+ args.emplace_back("message_thread_id", messageThreadId);
+ }
+ if (disableNotification) {
+ args.emplace_back("disable_notification", disableNotification);
+ }
+ if (protectContent) {
+ args.emplace_back("protect_content", protectContent);
+ }
+ if (removeCaption) {
+ args.emplace_back("remove_caption", removeCaption);
+ }
+
+ return _tgTypeParser.parseJsonAndGetArray<MessageId>(&TgTypeParser::parseJsonAndGetMessageId, sendRequest("copyMessages", args));
+}
+
Message::Ptr Api::sendPhoto(boost::variant<std::int64_t, std::string> chatId,
boost::variant<InputFile::Ptr, std::string> photo,
const std::string& caption,
- std::int32_t replyToMessageId,
+ ReplyParameters::Ptr replyParameters,
GenericReply::Ptr replyMarkup,
const std::string& parseMode,
bool disableNotification,
const std::vector<MessageEntity::Ptr>& captionEntities,
- bool allowSendingWithoutReply,
- bool protectContent,
std::int32_t messageThreadId,
+ bool protectContent,
bool hasSpoiler) const {
std::vector<HttpReqArg> args;
- args.reserve(12);
+ args.reserve(11);
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
@@ -274,11 +330,8 @@ Message::Ptr Api::sendPhoto(boost::variant<std::int64_t, std::string> chatId,
if (protectContent) {
args.emplace_back("protect_content", protectContent);
}
- if (replyToMessageId != 0) {
- args.emplace_back("reply_to_message_id", replyToMessageId);
- }
- if (allowSendingWithoutReply) {
- args.emplace_back("allow_sending_without_reply", allowSendingWithoutReply);
+ if (replyParameters != nullptr) {
+ args.emplace_back("reply_parameters", _tgTypeParser.parseReplyParameters(replyParameters));
}
if (replyMarkup != nullptr) {
args.emplace_back("reply_markup", _tgTypeParser.parseGenericReply(replyMarkup));
@@ -294,16 +347,15 @@ Message::Ptr Api::sendAudio(boost::variant<std::int64_t, std::string> chatId,
const std::string& performer,
const std::string& title,
boost::variant<InputFile::Ptr, std::string> thumbnail,
- std::int32_t replyToMessageId,
+ ReplyParameters::Ptr replyParameters,
GenericReply::Ptr replyMarkup,
const std::string& parseMode,
bool disableNotification,
const std::vector<MessageEntity::Ptr>& captionEntities,
- bool allowSendingWithoutReply,
- bool protectContent,
- std::int32_t messageThreadId) const {
+ std::int32_t messageThreadId,
+ bool protectContent) const {
std::vector<HttpReqArg> args;
- args.reserve(15);
+ args.reserve(14);
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
@@ -348,11 +400,8 @@ Message::Ptr Api::sendAudio(boost::variant<std::int64_t, std::string> chatId,
if (protectContent) {
args.emplace_back("protect_content", protectContent);
}
- if (replyToMessageId) {
- args.emplace_back("reply_to_message_id", replyToMessageId);
- }
- if (allowSendingWithoutReply) {
- args.emplace_back("allow_sending_without_reply", allowSendingWithoutReply);
+ if (replyParameters != nullptr) {
+ args.emplace_back("reply_parameters", _tgTypeParser.parseReplyParameters(replyParameters));
}
if (replyMarkup) {
args.emplace_back("reply_markup", _tgTypeParser.parseGenericReply(replyMarkup));
@@ -365,17 +414,16 @@ Message::Ptr Api::sendDocument(boost::variant<std::int64_t, std::string> chatId,
boost::variant<InputFile::Ptr, std::string> document,
boost::variant<InputFile::Ptr, std::string> thumbnail,
const std::string& caption,
- std::int32_t replyToMessageId,
+ ReplyParameters::Ptr replyParameters,
GenericReply::Ptr replyMarkup,
const std::string& parseMode,
bool disableNotification,
const std::vector<MessageEntity::Ptr>& captionEntities,
bool disableContentTypeDetection,
- bool allowSendingWithoutReply,
- bool protectContent,
- std::int32_t messageThreadId) const {
+ std::int32_t messageThreadId,
+ bool protectContent) const {
std::vector<HttpReqArg> args;
- args.reserve(13);
+ args.reserve(12);
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
@@ -414,11 +462,8 @@ Message::Ptr Api::sendDocument(boost::variant<std::int64_t, std::string> chatId,
if (protectContent) {
args.emplace_back("protect_content", protectContent);
}
- if (replyToMessageId) {
- args.emplace_back("reply_to_message_id", replyToMessageId);
- }
- if (allowSendingWithoutReply) {
- args.emplace_back("allow_sending_without_reply", allowSendingWithoutReply);
+ if (replyParameters != nullptr) {
+ args.emplace_back("reply_parameters", _tgTypeParser.parseReplyParameters(replyParameters));
}
if (replyMarkup) {
args.emplace_back("reply_markup", _tgTypeParser.parseGenericReply(replyMarkup));
@@ -435,17 +480,16 @@ Message::Ptr Api::sendVideo(boost::variant<std::int64_t, std::string> chatId,
std::int32_t height,
boost::variant<InputFile::Ptr, std::string> thumbnail,
const std::string& caption ,
- std::int32_t replyToMessageId,
+ ReplyParameters::Ptr replyParameters,
GenericReply::Ptr replyMarkup,
const std::string& parseMode,
bool disableNotification,
const std::vector<MessageEntity::Ptr>& captionEntities,
- bool allowSendingWithoutReply,
- bool protectContent,
std::int32_t messageThreadId,
+ bool protectContent,
bool hasSpoiler) const {
std::vector<HttpReqArg> args;
- args.reserve(17);
+ args.reserve(16);
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
@@ -496,11 +540,8 @@ Message::Ptr Api::sendVideo(boost::variant<std::int64_t, std::string> chatId,
if (protectContent) {
args.emplace_back("protect_content", protectContent);
}
- if (replyToMessageId != 0) {
- args.emplace_back("reply_to_message_id", replyToMessageId);
- }
- if (allowSendingWithoutReply) {
- args.emplace_back("allow_sending_without_reply", allowSendingWithoutReply);
+ if (replyParameters != nullptr) {
+ args.emplace_back("reply_parameters", _tgTypeParser.parseReplyParameters(replyParameters));
}
if (replyMarkup != nullptr) {
args.emplace_back("reply_markup", _tgTypeParser.parseGenericReply(replyMarkup));
@@ -516,17 +557,16 @@ Message::Ptr Api::sendAnimation(boost::variant<std::int64_t, std::string> chatId
std::int32_t height,
boost::variant<InputFile::Ptr, std::string> thumbnail,
const std::string& caption,
- std::int32_t replyToMessageId,
+ ReplyParameters::Ptr replyParameters,
GenericReply::Ptr replyMarkup,
const std::string& parseMode,
bool disableNotification,
const std::vector<MessageEntity::Ptr>& captionEntities,
- bool allowSendingWithoutReply,
- bool protectContent,
std::int32_t messageThreadId,
- bool hasSpoiler ) const {
+ bool protectContent,
+ bool hasSpoiler) const {
std::vector<HttpReqArg> args;
- args.reserve(16);
+ args.reserve(15);
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
@@ -574,11 +614,8 @@ Message::Ptr Api::sendAnimation(boost::variant<std::int64_t, std::string> chatId
if (protectContent) {
args.emplace_back("protect_content", protectContent);
}
- if (replyToMessageId != 0) {
- args.emplace_back("reply_to_message_id", replyToMessageId);
- }
- if (allowSendingWithoutReply) {
- args.emplace_back("allow_sending_without_reply", allowSendingWithoutReply);
+ if (replyParameters != nullptr) {
+ args.emplace_back("reply_parameters", _tgTypeParser.parseReplyParameters(replyParameters));
}
if (replyMarkup != nullptr) {
args.emplace_back("reply_markup", _tgTypeParser.parseGenericReply(replyMarkup));
@@ -591,16 +628,15 @@ Message::Ptr Api::sendVoice(boost::variant<std::int64_t, std::string> chatId,
boost::variant<InputFile::Ptr, std::string> voice,
const std::string& caption,
std::int32_t duration,
- std::int32_t replyToMessageId,
+ ReplyParameters::Ptr replyParameters,
GenericReply::Ptr replyMarkup,
const std::string& parseMode,
bool disableNotification,
const std::vector<MessageEntity::Ptr>& captionEntities,
- bool allowSendingWithoutReply,
- bool protectContent,
- std::int32_t messageThreadId) const {
+ std::int32_t messageThreadId,
+ bool protectContent) const {
std::vector<HttpReqArg> args;
- args.reserve(12);
+ args.reserve(11);
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
@@ -630,11 +666,8 @@ Message::Ptr Api::sendVoice(boost::variant<std::int64_t, std::string> chatId,
if (protectContent) {
args.emplace_back("protect_content", protectContent);
}
- if (replyToMessageId) {
- args.emplace_back("reply_to_message_id", replyToMessageId);
- }
- if (allowSendingWithoutReply) {
- args.emplace_back("allow_sending_without_reply", allowSendingWithoutReply);
+ if (replyParameters != nullptr) {
+ args.emplace_back("reply_parameters", _tgTypeParser.parseReplyParameters(replyParameters));
}
if (replyMarkup) {
args.emplace_back("reply_markup", _tgTypeParser.parseGenericReply(replyMarkup));
@@ -645,17 +678,16 @@ Message::Ptr Api::sendVoice(boost::variant<std::int64_t, std::string> chatId,
Message::Ptr Api::sendVideoNote(boost::variant<std::int64_t, std::string> chatId,
boost::variant<InputFile::Ptr, std::string> videoNote,
- std::int64_t replyToMessageId,
+ ReplyParameters::Ptr replyParameters,
bool disableNotification,
std::int32_t duration,
std::int32_t length,
boost::variant<InputFile::Ptr, std::string> thumbnail,
GenericReply::Ptr replyMarkup,
- bool allowSendingWithoutReply,
- bool protectContent,
- std::int32_t messageThreadId) const {
+ std::int32_t messageThreadId,
+ bool protectContent) const {
std::vector<HttpReqArg> args;
- args.reserve(11);
+ args.reserve(10);
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
@@ -688,11 +720,8 @@ Message::Ptr Api::sendVideoNote(boost::variant<std::int64_t, std::string> chatId
if (protectContent) {
args.emplace_back("protect_content", protectContent);
}
- if (replyToMessageId) {
- args.emplace_back("reply_to_message_id", replyToMessageId);
- }
- if (allowSendingWithoutReply) {
- args.emplace_back("allow_sending_without_reply", allowSendingWithoutReply);
+ if (replyParameters != nullptr) {
+ args.emplace_back("reply_parameters", _tgTypeParser.parseReplyParameters(replyParameters));
}
if (replyMarkup) {
args.emplace_back("reply_markup", _tgTypeParser.parseGenericReply(replyMarkup));
@@ -704,12 +733,11 @@ Message::Ptr Api::sendVideoNote(boost::variant<std::int64_t, std::string> chatId
std::vector<Message::Ptr> Api::sendMediaGroup(boost::variant<std::int64_t, std::string> chatId,
const std::vector<InputMedia::Ptr>& media,
bool disableNotification,
- std::int32_t replyToMessageId,
- bool allowSendingWithoutReply,
- bool protectContent,
- std::int32_t messageThreadId) const {
+ ReplyParameters::Ptr replyParameters,
+ std::int32_t messageThreadId,
+ bool protectContent) const {
std::vector<HttpReqArg> args;
- args.reserve(7);
+ args.reserve(6);
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
@@ -722,11 +750,8 @@ std::vector<Message::Ptr> Api::sendMediaGroup(boost::variant<std::int64_t, std::
if (protectContent) {
args.emplace_back("protect_content", protectContent);
}
- if (replyToMessageId != 0) {
- args.emplace_back("reply_to_message_id", replyToMessageId);
- }
- if (allowSendingWithoutReply) {
- args.emplace_back("allow_sending_without_reply", allowSendingWithoutReply);
+ if (replyParameters != nullptr) {
+ args.emplace_back("reply_parameters", _tgTypeParser.parseReplyParameters(replyParameters));
}
return _tgTypeParser.parseJsonAndGetArray<Message>(&TgTypeParser::parseJsonAndGetMessage, sendRequest("sendMediaGroup", args));
@@ -736,17 +761,16 @@ Message::Ptr Api::sendLocation(boost::variant<std::int64_t, std::string> chatId,
float latitude,
float longitude,
std::int32_t livePeriod,
- std::int32_t replyToMessageId,
+ ReplyParameters::Ptr replyParameters,
GenericReply::Ptr replyMarkup,
bool disableNotification,
float horizontalAccuracy,
std::int32_t heading,
std::int32_t proximityAlertRadius,
- bool allowSendingWithoutReply,
- bool protectContent,
- std::int32_t messageThreadId) const {
+ std::int32_t messageThreadId,
+ bool protectContent) const {
std::vector<HttpReqArg> args;
- args.reserve(13);
+ args.reserve(12);
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
@@ -772,11 +796,8 @@ Message::Ptr Api::sendLocation(boost::variant<std::int64_t, std::string> chatId,
if (protectContent) {
args.emplace_back("protect_content", protectContent);
}
- if (replyToMessageId) {
- args.emplace_back("reply_to_message_id", replyToMessageId);
- }
- if (allowSendingWithoutReply) {
- args.emplace_back("allow_sending_without_reply", allowSendingWithoutReply);
+ if (replyParameters != nullptr) {
+ args.emplace_back("reply_parameters", _tgTypeParser.parseReplyParameters(replyParameters));
}
if (replyMarkup) {
args.emplace_back("reply_markup", _tgTypeParser.parseGenericReply(replyMarkup));
@@ -867,15 +888,14 @@ Message::Ptr Api::sendVenue(boost::variant<std::int64_t, std::string> chatId,
const std::string& foursquareId,
const std::string& foursquareType,
bool disableNotification,
- std::int32_t replyToMessageId,
+ ReplyParameters::Ptr replyParameters,
GenericReply::Ptr replyMarkup,
const std::string& googlePlaceId,
const std::string& googlePlaceType,
- bool allowSendingWithoutReply,
- bool protectContent,
- std::int32_t messageThreadId) const {
+ std::int32_t messageThreadId,
+ bool protectContent) const {
std::vector<HttpReqArg> args;
- args.reserve(15);
+ args.reserve(14);
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
@@ -903,11 +923,8 @@ Message::Ptr Api::sendVenue(boost::variant<std::int64_t, std::string> chatId,
if (protectContent) {
args.emplace_back("protect_content", protectContent);
}
- if (replyToMessageId) {
- args.emplace_back("reply_to_message_id", replyToMessageId);
- }
- if (allowSendingWithoutReply) {
- args.emplace_back("allow_sending_without_reply", allowSendingWithoutReply);
+ if (replyParameters != nullptr) {
+ args.emplace_back("reply_parameters", _tgTypeParser.parseReplyParameters(replyParameters));
}
if (replyMarkup) {
args.emplace_back("reply_markup", _tgTypeParser.parseGenericReply(replyMarkup));
@@ -922,13 +939,12 @@ Message::Ptr Api::sendContact(boost::variant<std::int64_t, std::string> chatId,
const std::string& lastName ,
const std::string& vcard,
bool disableNotification,
- std::int32_t replyToMessageId,
+ ReplyParameters::Ptr replyParameters,
GenericReply::Ptr replyMarkup,
- bool allowSendingWithoutReply,
- bool protectContent,
- std::int32_t messageThreadId) const {
+ std::int32_t messageThreadId,
+ bool protectContent) const {
std::vector<HttpReqArg> args;
- args.reserve(11);
+ args.reserve(10);
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
@@ -948,11 +964,8 @@ Message::Ptr Api::sendContact(boost::variant<std::int64_t, std::string> chatId,
if (protectContent) {
args.emplace_back("protect_content", protectContent);
}
- if (replyToMessageId) {
- args.emplace_back("reply_to_message_id", replyToMessageId);
- }
- if (allowSendingWithoutReply) {
- args.emplace_back("allow_sending_without_reply", allowSendingWithoutReply);
+ if (replyParameters != nullptr) {
+ args.emplace_back("reply_parameters", _tgTypeParser.parseReplyParameters(replyParameters));
}
if (replyMarkup) {
args.emplace_back("reply_markup", _tgTypeParser.parseGenericReply(replyMarkup));
@@ -965,7 +978,7 @@ Message::Ptr Api::sendPoll(boost::variant<std::int64_t, std::string> chatId,
const std::string& question,
const std::vector<std::string>& options,
bool disableNotification,
- std::int32_t replyToMessageId,
+ ReplyParameters::Ptr replyParameters,
GenericReply::Ptr replyMarkup,
bool isAnonymous,
const std::string& type,
@@ -977,11 +990,10 @@ Message::Ptr Api::sendPoll(boost::variant<std::int64_t, std::string> chatId,
std::int32_t openPeriod,
std::int32_t closeDate,
bool isClosed,
- bool allowSendingWithoutReply,
- bool protectContent,
- std::int32_t messageThreadId) const {
+ std::int32_t messageThreadId,
+ bool protectContent) const {
std::vector<HttpReqArg> args;
- args.reserve(19);
+ args.reserve(18);
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
@@ -1028,11 +1040,8 @@ Message::Ptr Api::sendPoll(boost::variant<std::int64_t, std::string> chatId,
if (protectContent) {
args.emplace_back("protect_content", protectContent);
}
- if (replyToMessageId != 0) {
- args.emplace_back("reply_to_message_id", replyToMessageId);
- }
- if (allowSendingWithoutReply) {
- args.emplace_back("allow_sending_without_reply", allowSendingWithoutReply);
+ if (replyParameters != nullptr) {
+ args.emplace_back("reply_parameters", _tgTypeParser.parseReplyParameters(replyParameters));
}
if (replyMarkup) {
args.emplace_back("reply_markup", _tgTypeParser.parseGenericReply(replyMarkup));
@@ -1043,14 +1052,13 @@ Message::Ptr Api::sendPoll(boost::variant<std::int64_t, std::string> chatId,
Message::Ptr Api::sendDice(boost::variant<std::int64_t, std::string> chatId,
bool disableNotification,
- std::int32_t replyToMessageId,
+ ReplyParameters::Ptr replyParameters,
GenericReply::Ptr replyMarkup,
const std::string& emoji,
- bool allowSendingWithoutReply,
- bool protectContent,
- std::int32_t messageThreadId) const {
+ std::int32_t messageThreadId,
+ bool protectContent) const {
std::vector<HttpReqArg> args;
- args.reserve(8);
+ args.reserve(7);
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
@@ -1065,11 +1073,8 @@ Message::Ptr Api::sendDice(boost::variant<std::int64_t, std::string> chatId,
if (protectContent) {
args.emplace_back("protect_content", protectContent);
}
- if (replyToMessageId != 0) {
- args.emplace_back("reply_to_message_id", replyToMessageId);
- }
- if (allowSendingWithoutReply) {
- args.emplace_back("allow_sending_without_reply", allowSendingWithoutReply);
+ if (replyParameters != nullptr) {
+ args.emplace_back("reply_parameters", _tgTypeParser.parseReplyParameters(replyParameters));
}
if (replyMarkup) {
args.emplace_back("reply_markup", _tgTypeParser.parseGenericReply(replyMarkup));
@@ -1078,6 +1083,25 @@ Message::Ptr Api::sendDice(boost::variant<std::int64_t, std::string> chatId,
return _tgTypeParser.parseJsonAndGetMessage(sendRequest("sendDice", args));
}
+bool Api::setMessageReaction(boost::variant<std::int64_t, std::string> chatId,
+ std::int32_t messageId,
+ const std::vector<ReactionType::Ptr>& reaction,
+ bool isBig) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(4);
+
+ args.emplace_back("chat_id", chatId);
+ args.emplace_back("message_id", messageId);
+ if (!reaction.empty()) {
+ args.emplace_back("reaction", _tgTypeParser.parseArray<ReactionType>(&TgTypeParser::parseReactionType, reaction));
+ }
+ if (isBig) {
+ args.emplace_back("is_big", isBig);
+ }
+
+ return sendRequest("setMessageReaction", args).get<bool>("", false);
+}
+
bool Api::sendChatAction(std::int64_t chatId,
const std::string& action,
std::int32_t messageThreadId) const {
@@ -1710,6 +1734,17 @@ bool Api::answerCallbackQuery(const std::string& callbackQueryId,
return sendRequest("answerCallbackQuery", args).get<bool>("", false);
}
+UserChatBoosts::Ptr Api::getUserChatBoosts(boost::variant<std::int64_t, std::string> chatId,
+ std::int32_t userId) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(2);
+
+ args.emplace_back("chat_id", chatId);
+ args.emplace_back("user_id", userId);
+
+ return _tgTypeParser.parseJsonAndGetUserChatBoosts(sendRequest("getUserChatBoosts", args));
+}
+
bool Api::setMyCommands(const std::vector<BotCommand::Ptr>& commands,
BotCommandScope::Ptr scope,
const std::string& languageCode) const {
@@ -1892,7 +1927,7 @@ Message::Ptr Api::editMessageText(const std::string& text,
std::int32_t messageId,
const std::string& inlineMessageId,
const std::string& parseMode,
- bool disableWebPagePreview,
+ LinkPreviewOptions::Ptr linkPreviewOptions,
InlineKeyboardMarkup::Ptr replyMarkup,
const std::vector<MessageEntity::Ptr>& entities) const {
std::vector<HttpReqArg> args;
@@ -1920,8 +1955,8 @@ Message::Ptr Api::editMessageText(const std::string& text,
if (!entities.empty()) {
args.emplace_back("entities", _tgTypeParser.parseArray<MessageEntity>(&TgTypeParser::parseMessageEntity, entities));
}
- if (disableWebPagePreview) {
- args.emplace_back("disable_web_page_preview", disableWebPagePreview);
+ if (linkPreviewOptions) {
+ args.emplace_back("link_preview_options", _tgTypeParser.parseLinkPreviewOptions(linkPreviewOptions));
}
if (replyMarkup) {
args.emplace_back("reply_markup", _tgTypeParser.parseInlineKeyboardMarkup(replyMarkup));
@@ -2079,17 +2114,32 @@ bool Api::deleteMessage(boost::variant<std::int64_t, std::string> chatId,
return sendRequest("deleteMessage", args).get<bool>("", false);
}
+bool Api::deleteMessages(boost::variant<std::int64_t, std::string> chatId,
+ const std::vector<std::int32_t>& messageIds) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(2);
+
+ args.emplace_back("chat_id", chatId);
+ if (!messageIds.empty()) {
+ args.emplace_back("message_ids", _tgTypeParser.parseArray<std::int32_t>(
+ [] (const std::int32_t& i)->std::int32_t {
+ return i;
+ }, messageIds));
+ }
+
+ return sendRequest("deleteMessages", args).get<bool>("", false);
+}
+
Message::Ptr Api::sendSticker(boost::variant<std::int64_t, std::string> chatId,
boost::variant<InputFile::Ptr, std::string> sticker,
- std::int32_t replyToMessageId,
+ ReplyParameters::Ptr replyParameters,
GenericReply::Ptr replyMarkup,
bool disableNotification,
- bool allowSendingWithoutReply,
- bool protectContent,
std::int32_t messageThreadId,
+ bool protectContent,
const std::string& emoji) const {
std::vector<HttpReqArg> args;
- args.reserve(9);
+ args.reserve(8);
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
@@ -2110,11 +2160,8 @@ Message::Ptr Api::sendSticker(boost::variant<std::int64_t, std::string> chatId,
if (protectContent) {
args.emplace_back("protect_content", protectContent);
}
- if (replyToMessageId) {
- args.emplace_back("reply_to_message_id", replyToMessageId);
- }
- if (allowSendingWithoutReply) {
- args.emplace_back("allow_sending_without_reply", allowSendingWithoutReply);
+ if (replyParameters != nullptr) {
+ args.emplace_back("reply_parameters", _tgTypeParser.parseReplyParameters(replyParameters));
}
if (replyMarkup) {
args.emplace_back("reply_markup", _tgTypeParser.parseGenericReply(replyMarkup));
@@ -2370,17 +2417,16 @@ Message::Ptr Api::sendInvoice(boost::variant<std::int64_t, std::string> chatId,
bool sendPhoneNumberToProvider,
bool sendEmailToProvider,
bool isFlexible,
- std::int32_t replyToMessageId,
+ ReplyParameters::Ptr replyParameters,
GenericReply::Ptr replyMarkup,
bool disableNotification,
- bool allowSendingWithoutReply,
+ std::int32_t messageThreadId,
std::int32_t maxTipAmount,
const std::vector<std::int32_t>& suggestedTipAmounts,
const std::string& startParameter,
- bool protectContent,
- std::int32_t messageThreadId) const {
+ bool protectContent) const {
std::vector<HttpReqArg> args;
- args.reserve(28);
+ args.reserve(27);
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
@@ -2443,11 +2489,8 @@ Message::Ptr Api::sendInvoice(boost::variant<std::int64_t, std::string> chatId,
if (protectContent) {
args.emplace_back("protect_content", protectContent);
}
- if (replyToMessageId) {
- args.emplace_back("reply_to_message_id", replyToMessageId);
- }
- if (allowSendingWithoutReply) {
- args.emplace_back("allow_sending_without_reply", allowSendingWithoutReply);
+ if (replyParameters != nullptr) {
+ args.emplace_back("reply_parameters", _tgTypeParser.parseReplyParameters(replyParameters));
}
if (replyMarkup) {
args.emplace_back("reply_markup", _tgTypeParser.parseGenericReply(replyMarkup));
@@ -2578,14 +2621,13 @@ bool Api::setPassportDataErrors(std::int64_t userId,
Message::Ptr Api::sendGame(std::int64_t chatId,
const std::string& gameShortName,
- std::int32_t replyToMessageId,
+ ReplyParameters::Ptr replyParameters,
InlineKeyboardMarkup::Ptr replyMarkup,
bool disableNotification,
- bool allowSendingWithoutReply,
- bool protectContent,
- std::int32_t messageThreadId) const {
+ std::int32_t messageThreadId,
+ bool protectContent) const {
std::vector<HttpReqArg> args;
- args.reserve(8);
+ args.reserve(7);
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
@@ -2598,11 +2640,8 @@ Message::Ptr Api::sendGame(std::int64_t chatId,
if (protectContent) {
args.emplace_back("protect_content", protectContent);
}
- if (replyToMessageId) {
- args.emplace_back("reply_to_message_id", replyToMessageId);
- }
- if (allowSendingWithoutReply) {
- args.emplace_back("allow_sending_without_reply", allowSendingWithoutReply);
+ if (replyParameters != nullptr) {
+ args.emplace_back("reply_parameters", _tgTypeParser.parseReplyParameters(replyParameters));
}
if (replyMarkup) {
args.emplace_back("reply_markup", _tgTypeParser.parseGenericReply(replyMarkup));
diff --git a/src/TgTypeParser.cpp b/src/TgTypeParser.cpp
index 5a56a31..52215bb 100644
--- a/src/TgTypeParser.cpp
+++ b/src/TgTypeParser.cpp
@@ -9,6 +9,8 @@ Update::Ptr TgTypeParser::parseJsonAndGetUpdate(const boost::property_tree::ptre
result->editedMessage = tryParseJson<Message>(&TgTypeParser::parseJsonAndGetMessage, data, "edited_message");
result->channelPost = tryParseJson<Message>(&TgTypeParser::parseJsonAndGetMessage, data, "channel_post");
result->editedChannelPost = tryParseJson<Message>(&TgTypeParser::parseJsonAndGetMessage, data, "edited_channel_post");
+ result->messageReaction = tryParseJson<MessageReactionUpdated>(&TgTypeParser::parseJsonAndGetMessageReactionUpdated, data, "message_reaction");
+ result->messageReactionCount = tryParseJson<MessageReactionCountUpdated>(&TgTypeParser::parseJsonAndGetMessageReactionCountUpdated, data, "message_reaction_count");
result->inlineQuery = tryParseJson<InlineQuery>(&TgTypeParser::parseJsonAndGetInlineQuery, data, "inline_query");
result->chosenInlineResult = tryParseJson<ChosenInlineResult>(&TgTypeParser::parseJsonAndGetChosenInlineResult, data, "chosen_inline_result");
result->callbackQuery = tryParseJson<CallbackQuery>(&TgTypeParser::parseJsonAndGetCallbackQuery, data, "callback_query");
@@ -19,6 +21,8 @@ Update::Ptr TgTypeParser::parseJsonAndGetUpdate(const boost::property_tree::ptre
result->myChatMember = tryParseJson<ChatMemberUpdated>(&TgTypeParser::parseJsonAndGetChatMemberUpdated, data, "my_chat_member");
result->chatMember = tryParseJson<ChatMemberUpdated>(&TgTypeParser::parseJsonAndGetChatMemberUpdated, data, "chat_member");
result->chatJoinRequest = tryParseJson<ChatJoinRequest>(&TgTypeParser::parseJsonAndGetChatJoinRequest, data, "chat_join_request");
+ result->chatBoost = tryParseJson<ChatBoostUpdated>(&TgTypeParser::parseJsonAndGetChatBoostUpdated, data, "chat_boost");
+ result->removedChatBoost = tryParseJson<ChatBoostRemoved>(&TgTypeParser::parseJsonAndGetChatBoostRemoved, data, "removed_chat_boost");
return result;
}
@@ -33,6 +37,8 @@ std::string TgTypeParser::parseUpdate(const Update::Ptr& object) const {
appendToJson(result, "edited_message", parseMessage(object->editedMessage));
appendToJson(result, "channel_post", parseMessage(object->channelPost));
appendToJson(result, "edited_channel_post", parseMessage(object->editedChannelPost));
+ appendToJson(result, "message_reaction", parseMessageReactionUpdated(object->messageReaction));
+ appendToJson(result, "message_reaction_count", parseMessageReactionCountUpdated(object->messageReactionCount));
appendToJson(result, "inline_query", parseInlineQuery(object->inlineQuery));
appendToJson(result, "chosen_inline_result", parseChosenInlineResult(object->chosenInlineResult));
appendToJson(result, "callback_query", parseCallbackQuery(object->callbackQuery));
@@ -43,6 +49,8 @@ std::string TgTypeParser::parseUpdate(const Update::Ptr& object) const {
appendToJson(result, "my_chat_member", parseChatMemberUpdated(object->myChatMember));
appendToJson(result, "chat_member", parseChatMemberUpdated(object->chatMember));
appendToJson(result, "chat_join_request", parseChatJoinRequest(object->chatJoinRequest));
+ appendToJson(result, "chat_boost", parseChatBoostUpdated(object->chatBoost));
+ appendToJson(result, "removed_chat_boost", parseChatBoostRemoved(object->removedChatBoost));
removeLastComma(result);
result += '}';
return result;
@@ -151,6 +159,11 @@ Chat::Ptr TgTypeParser::parseJsonAndGetChat(const boost::property_tree::ptree& d
[] (const boost::property_tree::ptree& innerData)->std::string {
return innerData.get<std::string>("");
}, data, "active_usernames");
+ result->availableReactions = parseJsonAndGetArray<ReactionType>(&TgTypeParser::parseJsonAndGetReactionType, data, "available_reactions");
+ result->accentColorId = data.get<std::int32_t>("accent_color_id", 0);
+ result->backgroundCustomEmojiId = data.get<std::string>("background_custom_emoji_id", "");
+ result->profileAccentColorId = data.get<std::int32_t>("profile_accent_color_id", 0);
+ result->profileBackgroundCustomEmojiId = data.get<std::string>("profile_background_custom_emoji_id", "");
result->emojiStatusCustomEmojiId = data.get<std::string>("emoji_status_custom_emoji_id", "");
result->emojiStatusExpirationDate = data.get<std::int64_t>("emoji_status_expiration_date", 0);
result->bio = data.get<std::string>("bio", "");
@@ -164,9 +177,10 @@ Chat::Ptr TgTypeParser::parseJsonAndGetChat(const boost::property_tree::ptree& d
result->permissions = tryParseJson<ChatPermissions>(&TgTypeParser::parseJsonAndGetChatPermissions, data, "permissions");
result->slowModeDelay = data.get<std::int32_t>("slow_mode_delay", 0);
result->messageAutoDeleteTime = data.get<std::int32_t>("message_auto_delete_time", 0);
- result->hasProtectedContent = data.get<bool>("has_protected_content", false);
result->hasAggressiveAntiSpamEnabled = data.get<bool>("has_aggressive_anti_spam_enabled", false);
result->hasHiddenMembers = data.get<bool>("has_hidden_members", false);
+ result->hasProtectedContent = data.get<bool>("has_protected_content", false);
+ result->hasVisibleHistory = data.get<bool>("has_visible_history", false);
result->stickerSetName = data.get<std::string>("sticker_set_name", "");
result->canSetStickerSet = data.get<bool>("can_set_sticker_set", false);
result->linkedChatId = data.get<std::int64_t>("linked_chat_id", 0);
@@ -196,10 +210,15 @@ std::string TgTypeParser::parseChat(const Chat::Ptr& object) const {
appendToJson(result, "last_name", object->lastName);
appendToJson(result, "is_forum", object->isForum);
appendToJson(result, "photo", parseChatPhoto(object->photo));
- appendToJson(result, "active_usernames",
- parseArray<std::string>([] (const std::string& s)->std::string {
+ appendToJson(result, "active_usernames", parseArray<std::string>(
+ [] (const std::string& s)->std::string {
return s;
}, object->activeUsernames));
+ appendToJson(result, "available_reactions", parseArray(&TgTypeParser::parseReactionType, object->availableReactions));
+ appendToJson(result, "accent_color_id", object->accentColorId);
+ appendToJson(result, "background_custom_emoji_id", object->backgroundCustomEmojiId);
+ appendToJson(result, "profile_accent_color_id", object->profileAccentColorId);
+ appendToJson(result, "profile_background_custom_emoji_id", object->profileBackgroundCustomEmojiId);
appendToJson(result, "emoji_status_custom_emoji_id", object->emojiStatusCustomEmojiId);
appendToJson(result, "emoji_status_expiration_date", object->emojiStatusExpirationDate);
appendToJson(result, "bio", object->bio);
@@ -216,6 +235,7 @@ std::string TgTypeParser::parseChat(const Chat::Ptr& object) const {
appendToJson(result, "has_aggressive_anti_spam_enabled", object->hasAggressiveAntiSpamEnabled);
appendToJson(result, "has_hidden_members", object->hasHiddenMembers);
appendToJson(result, "has_protected_content", object->hasProtectedContent);
+ appendToJson(result, "has_visible_history", object->hasVisibleHistory);
appendToJson(result, "sticker_set_name", object->stickerSetName);
appendToJson(result, "can_set_sticker_set", object->canSetStickerSet);
appendToJson(result, "linked_chat_id", object->linkedChatId);
@@ -231,24 +251,22 @@ Message::Ptr TgTypeParser::parseJsonAndGetMessage(const boost::property_tree::pt
result->messageThreadId = data.get<std::int32_t>("message_thread_id", 0);
result->from = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "from");
result->senderChat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "sender_chat");
- result->date = data.get<std::int64_t>("date", 0);
result->chat = parseJsonAndGetChat(data.find("chat")->second);
- result->forwardFrom = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "forward_from");
- result->forwardFromChat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "forward_from_chat");
- result->forwardFromMessageId = data.get<std::int32_t>("forward_from_message_id", 0);
- result->forwardSignature = data.get<std::string>("forward_signature", "");
- result->forwardSenderName = data.get<std::string>("forward_sender_name", "");
- result->forwardDate = data.get<std::int64_t>("forward_date", 0);
+ result->date = data.get<std::uint32_t>("date", 0);
+ result->forwardOrigin = tryParseJson<MessageOrigin>(&TgTypeParser::parseJsonAndGetMessageOrigin, data, "forward_origin");
result->isTopicMessage = data.get<bool>("is_topic_message", false);
result->isAutomaticForward = data.get<bool>("is_automatic_forward", false);
result->replyToMessage = tryParseJson<Message>(&TgTypeParser::parseJsonAndGetMessage, data, "reply_to_message");
+ result->externalReply = tryParseJson<ExternalReplyInfo>(&TgTypeParser::parseJsonAndGetExternalReplyInfo, data, "external_reply");
+ result->quote = tryParseJson<TextQuote>(&TgTypeParser::parseJsonAndGetTextQuote, data, "quote");
result->viaBot = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "via_bot");
- result->editDate = data.get<std::int64_t>("edit_date", 0);
+ result->editDate = data.get<std::uint32_t>("edit_date", 0);
result->hasProtectedContent = data.get<bool>("has_protected_content", false);
result->mediaGroupId = data.get<std::string>("media_group_id", "");
result->authorSignature = data.get<std::string>("author_signature", "");
result->text = data.get<std::string>("text", "");
result->entities = parseJsonAndGetArray<MessageEntity>(&TgTypeParser::parseJsonAndGetMessageEntity, data, "entities");
+ result->linkPreviewOptions = tryParseJson<LinkPreviewOptions>(&TgTypeParser::parseJsonAndGetLinkPreviewOptions, data, "link_preview_options");
result->animation = tryParseJson<Animation>(&TgTypeParser::parseJsonAndGetAnimation, data, "animation");
result->audio = tryParseJson<Audio>(&TgTypeParser::parseJsonAndGetAudio, data, "audio");
result->document = tryParseJson<Document>(&TgTypeParser::parseJsonAndGetDocument, data, "document");
@@ -281,7 +299,7 @@ Message::Ptr TgTypeParser::parseJsonAndGetMessage(const boost::property_tree::pt
result->pinnedMessage = tryParseJson<Message>(&TgTypeParser::parseJsonAndGetMessage, data, "pinned_message");
result->invoice = tryParseJson<Invoice>(&TgTypeParser::parseJsonAndGetInvoice, data, "invoice");
result->successfulPayment = tryParseJson<SuccessfulPayment>(&TgTypeParser::parseJsonAndGetSuccessfulPayment, data, "successful_payment");
- result->userShared = tryParseJson<UserShared>(&TgTypeParser::parseJsonAndGetUserShared, data, "user_shared");
+ result->usersShared = tryParseJson<UsersShared>(&TgTypeParser::parseJsonAndGetUsersShared, data, "users_shared");
result->chatShared = tryParseJson<ChatShared>(&TgTypeParser::parseJsonAndGetChatShared, data, "chat_shared");
result->connectedWebsite = data.get<std::string>("connected_website", "");
result->writeAccessAllowed = tryParseJson<WriteAccessAllowed>(&TgTypeParser::parseJsonAndGetWriteAccessAllowed, data, "write_access_allowed");
@@ -293,6 +311,10 @@ Message::Ptr TgTypeParser::parseJsonAndGetMessage(const boost::property_tree::pt
result->forumTopicReopened = tryParseJson<ForumTopicReopened>(&TgTypeParser::parseJsonAndGetForumTopicReopened, data, "forum_topic_reopened");
result->generalForumTopicHidden = tryParseJson<GeneralForumTopicHidden>(&TgTypeParser::parseJsonAndGetGeneralForumTopicHidden, data, "general_forum_topic_hidden");
result->generalForumTopicUnhidden = tryParseJson<GeneralForumTopicUnhidden>(&TgTypeParser::parseJsonAndGetGeneralForumTopicUnhidden, data, "general_forum_topic_unhidden");
+ result->giveawayCreated = tryParseJson<GiveawayCreated>(&TgTypeParser::parseJsonAndGetGiveawayCreated, data, "giveaway_created");
+ result->giveaway = tryParseJson<Giveaway>(&TgTypeParser::parseJsonAndGetGiveaway, data, "giveaway");
+ result->giveawayWinners = tryParseJson<GiveawayWinners>(&TgTypeParser::parseJsonAndGetGiveawayWinners, data, "giveaway_winners");
+ result->giveawayCompleted = tryParseJson<GiveawayCompleted>(&TgTypeParser::parseJsonAndGetGiveawayCompleted, data, "giveaway_completed");
result->videoChatScheduled = tryParseJson<VideoChatScheduled>(&TgTypeParser::parseJsonAndGetVideoChatScheduled, data, "video_chat_scheduled");
result->videoChatStarted = tryParseJson<VideoChatStarted>(&TgTypeParser::parseJsonAndGetVideoChatStarted, data, "video_chat_started");
result->videoChatEnded = tryParseJson<VideoChatEnded>(&TgTypeParser::parseJsonAndGetVideoChatEnded, data, "video_chat_ended");
@@ -314,15 +336,12 @@ std::string TgTypeParser::parseMessage(const Message::Ptr& object) const {
appendToJson(result, "sender_chat", parseChat(object->senderChat));
appendToJson(result, "date", object->date);
appendToJson(result, "chat", parseChat(object->chat));
- appendToJson(result, "forward_from", parseUser(object->forwardFrom));
- appendToJson(result, "forward_from_chat", parseChat(object->forwardFromChat));
- appendToJson(result, "forward_from_message_id", object->forwardFromMessageId);
- appendToJson(result, "forward_signature", object->forwardSignature);
- appendToJson(result, "forward_sender_name", object->forwardSenderName);
- appendToJson(result, "forward_date", object->forwardDate);
+ appendToJson(result, "forward_origin", parseMessageOrigin(object->forwardOrigin));
appendToJson(result, "is_topic_message", object->isTopicMessage);
appendToJson(result, "is_automatic_forward", object->isAutomaticForward);
appendToJson(result, "reply_to_message", parseMessage(object->replyToMessage));
+ appendToJson(result, "external_reply", parseExternalReplyInfo(object->externalReply));
+ appendToJson(result, "quote", parseTextQuote(object->quote));
appendToJson(result, "via_bot", parseUser(object->viaBot));
appendToJson(result, "edit_date", object->editDate);
appendToJson(result, "has_protected_content", object->hasProtectedContent);
@@ -330,6 +349,7 @@ std::string TgTypeParser::parseMessage(const Message::Ptr& object) const {
appendToJson(result, "author_signature", object->authorSignature);
appendToJson(result, "text", object->text);
appendToJson(result, "entities", parseArray(&TgTypeParser::parseMessageEntity, object->entities));
+ appendToJson(result, "link_preview_options", parseLinkPreviewOptions(object->linkPreviewOptions));
appendToJson(result, "animation", parseAnimation(object->animation));
appendToJson(result, "audio", parseAudio(object->audio));
appendToJson(result, "document", parseDocument(object->document));
@@ -362,7 +382,7 @@ std::string TgTypeParser::parseMessage(const Message::Ptr& object) const {
appendToJson(result, "pinned_message", parseMessage(object->pinnedMessage));
appendToJson(result, "invoice", parseInvoice(object->invoice));
appendToJson(result, "successful_payment", parseSuccessfulPayment(object->successfulPayment));
- appendToJson(result, "user_shared", parseUserShared(object->userShared));
+ appendToJson(result, "users_shared", parseUsersShared(object->usersShared));
appendToJson(result, "chat_shared", parseChatShared(object->chatShared));
appendToJson(result, "connected_website", object->connectedWebsite);
appendToJson(result, "write_access_allowed", parseWriteAccessAllowed(object->writeAccessAllowed));
@@ -374,6 +394,10 @@ std::string TgTypeParser::parseMessage(const Message::Ptr& object) const {
appendToJson(result, "forum_topic_reopened", parseForumTopicReopened(object->forumTopicReopened));
appendToJson(result, "general_forum_topic_hidden", parseGeneralForumTopicHidden(object->generalForumTopicHidden));
appendToJson(result, "general_forum_topic_unhidden", parseGeneralForumTopicUnhidden(object->generalForumTopicUnhidden));
+ appendToJson(result, "giveaway_created", parseGiveawayCreated(object->giveawayCreated));
+ appendToJson(result, "giveaway", parseGiveaway(object->giveaway));
+ appendToJson(result, "giveaway_winners", parseGiveawayWinners(object->giveawayWinners));
+ appendToJson(result, "giveaway_completed", parseGiveawayCompleted(object->giveawayCompleted));
appendToJson(result, "video_chat_scheduled", parseVideoChatScheduled(object->videoChatScheduled));
appendToJson(result, "video_chat_started", parseVideoChatStarted(object->videoChatStarted));
appendToJson(result, "video_chat_ended", parseVideoChatEnded(object->videoChatEnded));
@@ -403,6 +427,28 @@ std::string TgTypeParser::parseMessageId(const MessageId::Ptr& object) const {
return result;
}
+InaccessibleMessage::Ptr TgTypeParser::parseJsonAndGetInaccessibleMessage(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<InaccessibleMessage>());
+ result->chat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "chat");
+ result->messageId = data.get<std::int32_t>("message_id", 0);
+ result->date = data.get<std::uint8_t>("date", 0);
+ return result;
+}
+
+std::string TgTypeParser::parseInaccessibleMessage(const InaccessibleMessage::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "chat", parseChat(object->chat));
+ appendToJson(result, "message_id", object->messageId);
+ appendToJson(result, "date", object->date);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
MessageEntity::Ptr TgTypeParser::parseJsonAndGetMessageEntity(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<MessageEntity>());
std::string type = data.get<std::string>("type", "");
@@ -430,6 +476,8 @@ MessageEntity::Ptr TgTypeParser::parseJsonAndGetMessageEntity(const boost::prope
result->type = MessageEntity::Type::Strikethrough;
} else if (type == "spoiler") {
result->type = MessageEntity::Type::Spoiler;
+ } else if (type == "blockquote") {
+ result->type = MessageEntity::Type::Blockquote;
} else if (type == "code") {
result->type = MessageEntity::Type::Code;
} else if (type == "pre") {
@@ -480,6 +528,8 @@ std::string TgTypeParser::parseMessageEntity(const MessageEntity::Ptr& object) c
appendToJson(result, "type", "strikethrough");
} else if (object->type == MessageEntity::Type::Spoiler) {
appendToJson(result, "type", "spoiler");
+ } else if (object->type == MessageEntity::Type::Blockquote) {
+ appendToJson(result, "type", "blockquote");
} else if (object->type == MessageEntity::Type::Code) {
appendToJson(result, "type", "code");
} else if (object->type == MessageEntity::Type::Pre) {
@@ -502,6 +552,250 @@ std::string TgTypeParser::parseMessageEntity(const MessageEntity::Ptr& object) c
return result;
}
+TextQuote::Ptr TgTypeParser::parseJsonAndGetTextQuote(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<TextQuote>());
+ result->text = data.get<std::string>("text", "");
+ result->entities = parseJsonAndGetArray<MessageEntity>(&TgTypeParser::parseJsonAndGetMessageEntity, data, "entities");
+ result->position = data.get<std::int32_t>("position", 0);
+ result->isManual = data.get<bool>("is_manual", false);
+ return result;
+}
+
+std::string TgTypeParser::parseTextQuote(const TextQuote::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "text", object->text);
+ appendToJson(result, "entities", parseArray(&TgTypeParser::parseMessageEntity, object->entities));
+ appendToJson(result, "position", object->position);
+ appendToJson(result, "is_manual", object->isManual);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+ExternalReplyInfo::Ptr TgTypeParser::parseJsonAndGetExternalReplyInfo(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<ExternalReplyInfo>());
+ result->origin = tryParseJson<MessageOrigin>(&TgTypeParser::parseJsonAndGetMessageOrigin, data, "origin");
+ result->chat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "chat");
+ result->messageId = data.get<std::int32_t>("message_id", 0);
+ result->linkPreviewOptions = tryParseJson<LinkPreviewOptions>(&TgTypeParser::parseJsonAndGetLinkPreviewOptions, data, "link_preview_options");
+ result->animation = tryParseJson<Animation>(&TgTypeParser::parseJsonAndGetAnimation, data, "animation");
+ result->audio = tryParseJson<Audio>(&TgTypeParser::parseJsonAndGetAudio, data, "audio");
+ result->document = tryParseJson<Document>(&TgTypeParser::parseJsonAndGetDocument, data, "document");
+ result->photo = parseJsonAndGetArray<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "photo");
+ result->sticker = tryParseJson<Sticker>(&TgTypeParser::parseJsonAndGetSticker, data, "sticker");
+ result->story = tryParseJson<Story>(&TgTypeParser::parseJsonAndGetStory, data, "story");
+ result->video = tryParseJson<Video>(&TgTypeParser::parseJsonAndGetVideo, data, "video");
+ result->videoNote = tryParseJson<VideoNote>(&TgTypeParser::parseJsonAndGetVideoNote, data, "video_note");
+ result->voice = tryParseJson<Voice>(&TgTypeParser::parseJsonAndGetVoice, data, "voice");
+ result->hasMediaSpoiler = data.get<bool>("has_media_spoiler", false);
+ result->contact = tryParseJson<Contact>(&TgTypeParser::parseJsonAndGetContact, data, "contact");
+ result->dice = tryParseJson<Dice>(&TgTypeParser::parseJsonAndGetDice, data, "dice");
+ result->game = tryParseJson<Game>(&TgTypeParser::parseJsonAndGetGame, data, "game");
+ result->giveaway = tryParseJson<Giveaway>(&TgTypeParser::parseJsonAndGetGiveaway, data, "giveaway");
+ result->giveawayWinners = tryParseJson<GiveawayWinners>(&TgTypeParser::parseJsonAndGetGiveawayWinners, data, "giveaway_winners");
+ result->invoice = tryParseJson<Invoice>(&TgTypeParser::parseJsonAndGetInvoice, data, "invoice");
+ result->location = tryParseJson<Location>(&TgTypeParser::parseJsonAndGetLocation, data, "location");
+ result->poll = tryParseJson<Poll>(&TgTypeParser::parseJsonAndGetPoll, data, "poll");
+ result->venue = tryParseJson<Venue>(&TgTypeParser::parseJsonAndGetVenue, data, "venue");
+ return result;
+}
+
+std::string TgTypeParser::parseExternalReplyInfo(const ExternalReplyInfo::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "origin", parseMessageOrigin(object->origin));
+ appendToJson(result, "chat", parseChat(object->chat));
+ appendToJson(result, "message_id", object->messageId);
+ appendToJson(result, "link_preview_options", parseLinkPreviewOptions(object->linkPreviewOptions));
+ appendToJson(result, "animation", parseAnimation(object->animation));
+ appendToJson(result, "audio", parseAudio(object->audio));
+ appendToJson(result, "document", parseDocument(object->document));
+ appendToJson(result, "photo", parseArray(&TgTypeParser::parsePhotoSize, object->photo));
+ appendToJson(result, "sticker", parseSticker(object->sticker));
+ appendToJson(result, "story", parseStory(object->story));
+ appendToJson(result, "video", parseVideo(object->video));
+ appendToJson(result, "video_note", parseVideoNote(object->videoNote));
+ appendToJson(result, "voice", parseVoice(object->voice));
+ appendToJson(result, "has_media_spoiler", object->hasMediaSpoiler);
+ appendToJson(result, "contact", parseContact(object->contact));
+ appendToJson(result, "dice", parseDice(object->dice));
+ appendToJson(result, "game", parseGame(object->game));
+ appendToJson(result, "giveaway", parseGiveaway(object->giveaway));
+ appendToJson(result, "giveaway_winners", parseGiveawayWinners(object->giveawayWinners));
+ appendToJson(result, "invoice", parseInvoice(object->invoice));
+ appendToJson(result, "location", parseLocation(object->location));
+ appendToJson(result, "poll", parsePoll(object->poll));
+ appendToJson(result, "venue", parseVenue(object->venue));
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+ReplyParameters::Ptr TgTypeParser::parseJsonAndGetReplyParameters(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<ReplyParameters>());
+ result->messageId = data.get<std::int32_t>("message_id", 0);
+ result->chatId = data.get<std::int64_t>("chat_id", 0);
+ result->allowSendingWithoutReply = data.get<bool>("allow_sending_without_reply", false);
+ result->quote = data.get<std::string>("quote", "");
+ result->quoteParseMode = data.get<std::string>("quote_parse_mode", "");
+ result->quoteEntities = parseJsonAndGetArray<MessageEntity>(&TgTypeParser::parseJsonAndGetMessageEntity, data, "quote_entities");
+ result->quotePosition = data.get<std::int32_t>("quote_position", 0);
+ return result;
+}
+
+std::string TgTypeParser::parseReplyParameters(const ReplyParameters::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "message_id", object->messageId);
+ appendToJson(result, "chat_id", object->chatId);
+ appendToJson(result, "allow_sending_without_reply", object->allowSendingWithoutReply);
+ appendToJson(result, "quote", object->quote);
+ appendToJson(result, "quote_parse_mode", object->quoteParseMode);
+ appendToJson(result, "quote_entities", parseArray(&TgTypeParser::parseMessageEntity, object->quoteEntities));
+ appendToJson(result, "quote_position", object->quotePosition);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+MessageOrigin::Ptr TgTypeParser::parseJsonAndGetMessageOrigin(const boost::property_tree::ptree& data) const {
+ std::string type = data.get<std::string>("type", "");
+ MessageOrigin::Ptr result;
+
+ if (type == MessageOriginUser::TYPE) {
+ result = std::static_pointer_cast<MessageOrigin>(parseJsonAndGetMessageOriginUser(data));
+ } else if (type == MessageOriginHiddenUser::TYPE) {
+ result = std::static_pointer_cast<MessageOrigin>(parseJsonAndGetMessageOriginHiddenUser(data));
+ } else if (type == MessageOriginChat::TYPE) {
+ result = std::static_pointer_cast<MessageOrigin>(parseJsonAndGetMessageOriginChat(data));
+ } else if (type == MessageOriginChannel::TYPE) {
+ result = std::static_pointer_cast<MessageOrigin>(parseJsonAndGetMessageOriginChannel(data));
+ } else {
+ result = std::make_shared<MessageOrigin>();
+ }
+
+ result->type = type;
+ result->date = data.get<std::int32_t>("date", 0);
+
+ return result;
+}
+
+std::string TgTypeParser::parseMessageOrigin(const MessageOrigin::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "type", object->type);
+ appendToJson(result, "date", object->date);
+
+ if (object->type == MessageOriginUser::TYPE) {
+ result += parseMessageOriginUser(std::static_pointer_cast<MessageOriginUser>(object));
+ } else if (object->type == MessageOriginHiddenUser::TYPE) {
+ result += parseMessageOriginHiddenUser(std::static_pointer_cast<MessageOriginHiddenUser>(object));
+ } else if (object->type == MessageOriginChat::TYPE) {
+ result += parseMessageOriginChat(std::static_pointer_cast<MessageOriginChat>(object));
+ } else if (object->type == MessageOriginChannel::TYPE) {
+ result += parseMessageOriginChannel(std::static_pointer_cast<MessageOriginChannel>(object));
+ }
+
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+MessageOriginUser::Ptr TgTypeParser::parseJsonAndGetMessageOriginUser(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGetMessageOrigin().
+ auto result(std::make_shared<MessageOriginUser>());
+ result->senderUser = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "sender_user");
+ return result;
+}
+
+std::string TgTypeParser::parseMessageOriginUser(const MessageOriginUser::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ // This function will be called by parseMessageOrigin(), so I don't add
+ // curly brackets to the result std::string.
+ std::string result;
+ appendToJson(result, "sender_user", parseUser(object->senderUser));
+ // The last comma will be erased by parseMessageOrigin().
+ return result;
+}
+
+MessageOriginHiddenUser::Ptr TgTypeParser::parseJsonAndGetMessageOriginHiddenUser(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGetMessageOrigin().
+ auto result(std::make_shared<MessageOriginHiddenUser>());
+ result->senderUserName = data.get<std::string>("sender_user_name", "");
+ return result;
+}
+
+std::string TgTypeParser::parseMessageOriginHiddenUser(const MessageOriginHiddenUser::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ // This function will be called by parseMessageOrigin(), so I don't add
+ // curly brackets to the result std::string.
+ std::string result;
+ appendToJson(result, "sender_user_name", object->senderUserName);
+ // The last comma will be erased by parseMessageOrigin().
+ return result;
+}
+
+MessageOriginChat::Ptr TgTypeParser::parseJsonAndGetMessageOriginChat(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGetMessageOrigin().
+ auto result(std::make_shared<MessageOriginChat>());
+ result->senderChat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "sender_chat");
+ result->authorSignature = data.get<std::string>("author_signature", "");
+ return result;
+}
+
+std::string TgTypeParser::parseMessageOriginChat(const MessageOriginChat::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ // This function will be called by parseMessageOrigin(), so I don't add
+ // curly brackets to the result std::string.
+ std::string result;
+ appendToJson(result, "sender_chat", parseChat(object->senderChat));
+ appendToJson(result, "author_signature", object->authorSignature);
+ // The last comma will be erased by parseMessageOrigin().
+ return result;
+}
+
+MessageOriginChannel::Ptr TgTypeParser::parseJsonAndGetMessageOriginChannel(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGetMessageOrigin().
+ auto result(std::make_shared<MessageOriginChannel>());
+ result->chat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "chat");
+ result->messageId = data.get<std::int32_t>("message_id", 0);
+ result->authorSignature = data.get<std::string>("author_signature", "");
+ return result;
+}
+
+std::string TgTypeParser::parseMessageOriginChannel(const MessageOriginChannel::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ // This function will be called by parseMessageOrigin(), so I don't add
+ // curly brackets to the result std::string.
+ std::string result;
+ appendToJson(result, "chat", parseChat(object->chat));
+ appendToJson(result, "message_id", object->messageId);
+ appendToJson(result, "author_signature", object->authorSignature);
+ // The last comma will be erased by parseMessageOrigin().
+ return result;
+}
+
PhotoSize::Ptr TgTypeParser::parseJsonAndGetPhotoSize(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<PhotoSize>());
result->fileId = data.get<std::string>("file_id", "");
@@ -1090,21 +1384,27 @@ std::string TgTypeParser::parseGeneralForumTopicUnhidden(const GeneralForumTopic
return result;
}
-UserShared::Ptr TgTypeParser::parseJsonAndGetUserShared(const boost::property_tree::ptree& data) const {
- auto result(std::make_shared<UserShared>());
+UsersShared::Ptr TgTypeParser::parseJsonAndGetUsersShared(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<UsersShared>());
result->requestId = data.get<std::int32_t>("request_id", 0);
- result->userId = data.get<std::int64_t>("user_id", 0);
+ result->userIds = parseJsonAndGetArray<std::int64_t>(
+ [] (const boost::property_tree::ptree& innerData)->std::int64_t {
+ return innerData.get<std::int64_t>("");
+ }, data, "user_ids");
return result;
}
-std::string TgTypeParser::parseUserShared(const UserShared::Ptr& object) const {
+std::string TgTypeParser::parseUsersShared(const UsersShared::Ptr& object) const {
if (!object) {
return "";
}
std::string result;
result += '{';
appendToJson(result, "request_id", object->requestId);
- appendToJson(result, "user_id", object->userId);
+ appendToJson(result, "user_ids", parseArray<std::int64_t>(
+ [] (std::int64_t i)->std::int64_t {
+ return i;
+ }, object->userIds));
removeLastComma(result);
result += '}';
return result;
@@ -1222,6 +1522,146 @@ std::string TgTypeParser::parseVideoChatParticipantsInvited(const VideoChatParti
return result;
}
+GiveawayCreated::Ptr TgTypeParser::parseJsonAndGetGiveawayCreated(const boost::property_tree::ptree& /*data*/) const {
+ auto result(std::make_shared<GiveawayCreated>());
+ return result;
+}
+
+std::string TgTypeParser::parseGiveawayCreated(const GiveawayCreated::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ // removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+Giveaway::Ptr TgTypeParser::parseJsonAndGetGiveaway(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<Giveaway>());
+ result->chats = parseJsonAndGetArray<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "chats");
+ result->winnersSelectionDate = data.get<std::uint32_t>("winners_selection_date", 0);
+ result->winnerCount = data.get<std::int32_t>("winner_count", 0);
+ result->onlyNewMembers = data.get<bool>("only_new_members", false);
+ result->hasPublicWinners = data.get<bool>("has_public_winners", false);
+ result->prizeDescription = data.get<std::string>("prize_description", "");
+ result->countryCodes = parseJsonAndGetArray<std::string>(
+ [] (const boost::property_tree::ptree& innerData)->std::string {
+ return innerData.get<std::string>("");
+ }, data, "country_codes");
+ result->premiumSubscriptionMonthCount = data.get<std::int32_t>("premium_subscription_month_count", 0);
+ return result;
+}
+
+std::string TgTypeParser::parseGiveaway(const Giveaway::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "chats", parseArray(&TgTypeParser::parseChat, object->chats));
+ appendToJson(result, "winners_selection_date", object->winnersSelectionDate);
+ appendToJson(result, "winner_count", object->winnerCount);
+ appendToJson(result, "only_new_members", object->onlyNewMembers);
+ appendToJson(result, "has_public_winners", object->hasPublicWinners);
+ appendToJson(result, "prize_description", object->prizeDescription);
+ appendToJson(result, "country_codes", parseArray<std::string>(
+ [] (const std::string& s)->std::string {
+ return s;
+ }, object->countryCodes));
+ appendToJson(result, "premium_subscription_month_count", object->premiumSubscriptionMonthCount);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+GiveawayWinners::Ptr TgTypeParser::parseJsonAndGetGiveawayWinners(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<GiveawayWinners>());
+ result->chat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "chat");
+ result->giveawayMessageId = data.get<std::int32_t>("giveaway_message_id", 0);
+ result->winnersSelectionDate = data.get<std::uint32_t>("winners_selection_date", 0);
+ result->winnerCount = data.get<std::int32_t>("winner_count", 0);
+ result->winners = parseJsonAndGetArray<User>(&TgTypeParser::parseJsonAndGetUser, data, "winners");
+ result->additionalChatCount = data.get<std::int32_t>("additional_chat_count", 0);
+ result->premiumSubscriptionMonthCount = data.get<std::int32_t>("premium_subscription_month_count", 0);
+ result->unclaimedPrizeCount = data.get<std::int32_t>("unclaimed_prize_count", 0);
+ result->onlyNewMembers = data.get<bool>("only_new_members", false);
+ result->wasRefunded = data.get<bool>("was_refunded", false);
+ result->prizeDescription = data.get<std::string>("prize_description", "");
+ return result;
+}
+
+std::string TgTypeParser::parseGiveawayWinners(const GiveawayWinners::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "chat", parseChat(object->chat));
+ appendToJson(result, "giveaway_message_id", object->giveawayMessageId);
+ appendToJson(result, "winners_selection_date", object->winnersSelectionDate);
+ appendToJson(result, "winner_count", object->winnerCount);
+ appendToJson(result, "winners", parseArray(&TgTypeParser::parseUser, object->winners));
+ appendToJson(result, "additional_chat_count", object->additionalChatCount);
+ appendToJson(result, "premium_subscription_month_count", object->premiumSubscriptionMonthCount);
+ appendToJson(result, "unclaimed_prize_count", object->unclaimedPrizeCount);
+ appendToJson(result, "only_new_members", object->onlyNewMembers);
+ appendToJson(result, "was_refunded", object->wasRefunded);
+ appendToJson(result, "prize_description", object->prizeDescription);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+GiveawayCompleted::Ptr TgTypeParser::parseJsonAndGetGiveawayCompleted(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<GiveawayCompleted>());
+ result->winnerCount = data.get<std::int32_t>("winner_count", 0);
+ result->unclaimedPrizeCount = data.get<std::int32_t>("unclaimed_prize_count", 0);
+ result->giveawayMessage = tryParseJson<Message>(&TgTypeParser::parseJsonAndGetMessage, data, "giveaway_message");
+ return result;
+}
+
+std::string TgTypeParser::parseGiveawayCompleted(const GiveawayCompleted::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "winner_count", object->winnerCount);
+ appendToJson(result, "unclaimed_prize_count", object->unclaimedPrizeCount);
+ appendToJson(result, "giveaway_message", parseMessage(object->giveawayMessage));
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+LinkPreviewOptions::Ptr TgTypeParser::parseJsonAndGetLinkPreviewOptions(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<LinkPreviewOptions>());
+ result->isDisabled = data.get<bool>("is_disabled", false);
+ result->url = data.get<std::string>("url", "");
+ result->preferSmallMedia = data.get<bool>("prefer_small_media", false);
+ result->preferLargeMedia = data.get<bool>("prefer_large_media", false);
+ result->showAboveText = data.get<bool>("show_above_text", false);
+ return result;
+}
+
+std::string TgTypeParser::parseLinkPreviewOptions(const LinkPreviewOptions::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "is_disabled", object->isDisabled);
+ appendToJson(result, "url", object->url);
+ appendToJson(result, "prefer_small_media", object->preferSmallMedia);
+ appendToJson(result, "prefer_large_media", object->preferLargeMedia);
+ appendToJson(result, "show_above_text", object->showAboveText);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
UserProfilePhotos::Ptr TgTypeParser::parseJsonAndGetUserProfilePhotos(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<UserProfilePhotos>());
result->totalCount = data.get<std::int32_t>("total_count", 0);
@@ -1329,7 +1769,7 @@ std::string TgTypeParser::parseReplyKeyboardMarkup(const ReplyKeyboardMarkup::Pt
KeyboardButton::Ptr TgTypeParser::parseJsonAndGetKeyboardButton(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<KeyboardButton>());
result->text = data.get<std::string>("text", "");
- result->requestUser = tryParseJson<KeyboardButtonRequestUser>(&TgTypeParser::parseJsonAndGetKeyboardButtonRequestUser, data, "request_user");
+ result->requestUsers = tryParseJson<KeyboardButtonRequestUsers>(&TgTypeParser::parseJsonAndGetKeyboardButtonRequestUsers, data, "request_users");
result->requestChat = tryParseJson<KeyboardButtonRequestChat>(&TgTypeParser::parseJsonAndGetKeyboardButtonRequestChat, data, "request_chat");
result->requestContact = data.get<bool>("request_contact", false);
result->requestLocation = data.get<bool>("request_location", false);
@@ -1345,7 +1785,7 @@ std::string TgTypeParser::parseKeyboardButton(const KeyboardButton::Ptr& object)
std::string result;
result += '{';
appendToJson(result, "text", object->text);
- appendToJson(result, "request_user", parseKeyboardButtonRequestUser(object->requestUser));
+ appendToJson(result, "request_users", parseKeyboardButtonRequestUsers(object->requestUsers));
appendToJson(result, "request_chat", parseKeyboardButtonRequestChat(object->requestChat));
appendToJson(result, "request_contact", object->requestContact);
appendToJson(result, "request_location", object->requestLocation);
@@ -1356,15 +1796,16 @@ std::string TgTypeParser::parseKeyboardButton(const KeyboardButton::Ptr& object)
return result;
}
-KeyboardButtonRequestUser::Ptr TgTypeParser::parseJsonAndGetKeyboardButtonRequestUser(const boost::property_tree::ptree& data) const {
- auto result(std::make_shared<KeyboardButtonRequestUser>());
+KeyboardButtonRequestUsers::Ptr TgTypeParser::parseJsonAndGetKeyboardButtonRequestUsers(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<KeyboardButtonRequestUsers>());
result->requestId = data.get<std::int32_t>("request_id", 0);
result->userIsBot = data.get<bool>("user_is_bot", false);
result->userIsPremium = data.get<bool>("user_is_premium", false);
+ result->maxQuantity = data.get<std::uint8_t>("max_quantity", 1);
return result;
}
-std::string TgTypeParser::parseKeyboardButtonRequestUser(const KeyboardButtonRequestUser::Ptr& object) const {
+std::string TgTypeParser::parseKeyboardButtonRequestUsers(const KeyboardButtonRequestUsers::Ptr& object) const {
if (!object) {
return "";
}
@@ -1373,6 +1814,7 @@ std::string TgTypeParser::parseKeyboardButtonRequestUser(const KeyboardButtonReq
appendToJson(result, "request_id", object->requestId);
appendToJson(result, "user_is_bot", object->userIsBot);
appendToJson(result, "user_is_premium", object->userIsPremium);
+ appendToJson(result, "max_quantity", object->maxQuantity);
removeLastComma(result);
result += '}';
return result;
@@ -1430,6 +1872,7 @@ std::string TgTypeParser::parseKeyboardButtonPollType(const KeyboardButtonPollTy
ReplyKeyboardRemove::Ptr TgTypeParser::parseJsonAndGetReplyKeyboardRemove(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<ReplyKeyboardRemove>());
+ result->removeKeyboard = data.get<bool>("remove_keyboard", false);
result->selective = data.get<bool>("selective", false);
return result;
}
@@ -1579,7 +2022,6 @@ std::string TgTypeParser::parseCallbackQuery(const CallbackQuery::Ptr& object) c
if (!object) {
return "";
}
-
std::string result;
result += '{';
appendToJson(result, "id", object->id);
@@ -1587,8 +2029,8 @@ std::string TgTypeParser::parseCallbackQuery(const CallbackQuery::Ptr& object) c
appendToJson(result, "message", parseMessage(object->message));
appendToJson(result, "inline_message_id", object->inlineMessageId);
appendToJson(result, "chat_instance", object->chatInstance);
- appendToJson(result, "game_short_name", object->gameShortName);
appendToJson(result, "data", object->data);
+ appendToJson(result, "game_short_name", object->gameShortName);
removeLastComma(result);
result += '}';
return result;
@@ -1596,6 +2038,7 @@ std::string TgTypeParser::parseCallbackQuery(const CallbackQuery::Ptr& object) c
ForceReply::Ptr TgTypeParser::parseJsonAndGetForceReply(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<ForceReply>());
+ result->forceReply = data.get<bool>("force_reply", false);
result->inputFieldPlaceholder = data.get<std::string>("input_field_placeholder", "");
result->selective = data.get<bool>("selective", false);
return result;
@@ -1719,6 +2162,34 @@ std::string TgTypeParser::parseChatAdministratorRights(const ChatAdministratorRi
return result;
}
+ChatMemberUpdated::Ptr TgTypeParser::parseJsonAndGetChatMemberUpdated(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<ChatMemberUpdated>());
+ result->chat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "chat");
+ result->from = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "from");
+ result->date = data.get<uint32_t>("date", 0);
+ result->oldChatMember = tryParseJson<ChatMember>(&TgTypeParser::parseJsonAndGetChatMember, data, "old_chat_member");
+ result->newChatMember = tryParseJson<ChatMember>(&TgTypeParser::parseJsonAndGetChatMember, data, "new_chat_member");
+ result->inviteLink = tryParseJson<ChatInviteLink>(&TgTypeParser::parseJsonAndGetChatInviteLink, data, "invite_link");
+ return result;
+}
+
+std::string TgTypeParser::parseChatMemberUpdated(const ChatMemberUpdated::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "chat", parseChat(object->chat));
+ appendToJson(result, "from", parseUser(object->from));
+ appendToJson(result, "date", object->date);
+ appendToJson(result, "old_chat_member", parseChatMember(object->oldChatMember));
+ appendToJson(result, "new_chat_member", parseChatMember(object->newChatMember));
+ appendToJson(result, "invite_link", parseChatInviteLink(object->inviteLink));
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
ChatMember::Ptr TgTypeParser::parseJsonAndGetChatMember(const boost::property_tree::ptree& data) const {
std::string status = data.get<std::string>("status", "");
ChatMember::Ptr result;
@@ -1947,36 +2418,6 @@ std::string TgTypeParser::parseChatMemberBanned(const ChatMemberBanned::Ptr& obj
return result;
}
-ChatMemberUpdated::Ptr TgTypeParser::parseJsonAndGetChatMemberUpdated(const boost::property_tree::ptree& data) const {
- auto result(std::make_shared<ChatMemberUpdated>());
- result->chat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "chat");
- result->from = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "from");
- result->date = data.get<std::uint32_t>("date", 0);
- result->oldChatMember = tryParseJson<ChatMember>(&TgTypeParser::parseJsonAndGetChatMember, data, "old_chat_member");
- result->newChatMember = tryParseJson<ChatMember>(&TgTypeParser::parseJsonAndGetChatMember, data, "new_chat_member");
- result->inviteLink = tryParseJson<ChatInviteLink>(&TgTypeParser::parseJsonAndGetChatInviteLink, data, "invite_link");
- result->viaChatFolderInviteLink = data.get<bool>("via_chat_folder_invite_link", false);
- return result;
-}
-
-std::string TgTypeParser::parseChatMemberUpdated(const ChatMemberUpdated::Ptr& object) const {
- if (!object) {
- return "";
- }
- std::string result;
- result += '{';
- appendToJson(result, "chat", parseChat(object->chat));
- appendToJson(result, "from", parseUser(object->from));
- appendToJson(result, "date", object->date);
- appendToJson(result, "old_chat_member", parseChatMember(object->oldChatMember));
- appendToJson(result, "new_chat_member", parseChatMember(object->newChatMember));
- appendToJson(result, "invite_link", parseChatInviteLink(object->inviteLink));
- appendToJson(result, "via_chat_folder_invite_link", object->viaChatFolderInviteLink);
- removeLastComma(result);
- result += '}';
- return result;
-}
-
ChatJoinRequest::Ptr TgTypeParser::parseJsonAndGetChatJoinRequest(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<ChatJoinRequest>());
result->chat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "chat");
@@ -2069,6 +2510,154 @@ std::string TgTypeParser::parseChatLocation(const ChatLocation::Ptr& object) con
return result;
}
+ReactionType::Ptr TgTypeParser::parseJsonAndGetReactionType(const boost::property_tree::ptree& data) const {
+ std::string type = data.get<std::string>("type", "");
+ ReactionType::Ptr result;
+
+ if (type == ReactionTypeEmoji::TYPE) {
+ result = std::static_pointer_cast<ReactionType>(parseJsonAndGetReactionTypeEmoji(data));
+ } else if (type == ReactionTypeCustomEmoji::TYPE) {
+ result = std::static_pointer_cast<ReactionType>(parseJsonAndGetReactionTypeCustomEmoji(data));
+ } else {
+ result = std::make_shared<ReactionType>();
+ }
+
+ result->type = type;
+
+ return result;
+}
+
+std::string TgTypeParser::parseReactionType(const ReactionType::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "type", object->type);
+
+ if (object->type == ReactionTypeEmoji::TYPE) {
+ result += parseReactionTypeEmoji(std::static_pointer_cast<ReactionTypeEmoji>(object));
+ } else if (object->type == ReactionTypeCustomEmoji::TYPE) {
+ result += parseReactionTypeCustomEmoji(std::static_pointer_cast<ReactionTypeCustomEmoji>(object));
+ }
+
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+ReactionTypeEmoji::Ptr TgTypeParser::parseJsonAndGetReactionTypeEmoji(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGetReactionType().
+ auto result(std::make_shared<ReactionTypeEmoji>());
+ result->emoji = data.get<std::string>("emoji", "");
+ return result;
+}
+
+std::string TgTypeParser::parseReactionTypeEmoji(const ReactionTypeEmoji::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ // This function will be called by parseReactionType(), so I don't add
+ // curly brackets to the result std::string.
+ appendToJson(result, "emoji", object->emoji);
+ // The last comma will be erased by parseReactionType().
+ return result;
+}
+
+ReactionTypeCustomEmoji::Ptr TgTypeParser::parseJsonAndGetReactionTypeCustomEmoji(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGetReactionType().
+ auto result(std::make_shared<ReactionTypeCustomEmoji>());
+ result->customEmojiId = data.get<std::string>("custom_emoji_id", "");
+ return result;
+}
+
+std::string TgTypeParser::parseReactionTypeCustomEmoji(const ReactionTypeCustomEmoji::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ // This function will be called by parseReactionType(), so I don't add
+ // curly brackets to the result std::string.
+ appendToJson(result, "custom_emoji_id", object->customEmojiId);
+ // The last comma will be erased by parseReactionType().
+ return result;
+}
+
+ReactionCount::Ptr TgTypeParser::parseJsonAndGetReactionCount(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<ReactionCount>());
+ result->type = tryParseJson<ReactionType>(&TgTypeParser::parseJsonAndGetReactionType, data, "type");
+ result->totalCount = data.get<std::int32_t>("total_count", 0);
+ return result;
+}
+
+std::string TgTypeParser::parseReactionCount(const ReactionCount::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "type", parseReactionType(object->type));
+ appendToJson(result, "total_count", object->totalCount);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+MessageReactionUpdated::Ptr TgTypeParser::parseJsonAndGetMessageReactionUpdated(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<MessageReactionUpdated>());
+ result->chat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "chat");
+ result->messageId = data.get<std::int32_t>("message_id", 0);
+ result->user = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "user");
+ result->actorChat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "actor_chat");
+ result->date = data.get<std::uint32_t>("date", 0);
+ result->oldReaction = parseJsonAndGetArray<ReactionType>(&TgTypeParser::parseJsonAndGetReactionType, data, "old_reaction");
+ result->newReaction = parseJsonAndGetArray<ReactionType>(&TgTypeParser::parseJsonAndGetReactionType, data, "new_reaction");
+ return result;
+}
+
+std::string TgTypeParser::parseMessageReactionUpdated(const MessageReactionUpdated::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "chat", parseChat(object->chat));
+ appendToJson(result, "message_id", object->messageId);
+ appendToJson(result, "user", parseUser(object->user));
+ appendToJson(result, "actor_chat", parseChat(object->actorChat));
+ appendToJson(result, "date", object->date);
+ appendToJson(result, "old_reaction", parseArray(&TgTypeParser::parseReactionType, object->oldReaction));
+ appendToJson(result, "new_reaction", parseArray(&TgTypeParser::parseReactionType, object->newReaction));
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+MessageReactionCountUpdated::Ptr TgTypeParser::parseJsonAndGetMessageReactionCountUpdated(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<MessageReactionCountUpdated>());
+ result->chat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "chat");
+ result->messageId = data.get<std::int32_t>("message_id", 0);
+ result->date = data.get<std::uint32_t>("date", 0);
+ result->reactions = parseJsonAndGetArray<ReactionCount>(&TgTypeParser::parseJsonAndGetReactionCount, data, "reactions");
+ return result;
+}
+
+std::string TgTypeParser::parseMessageReactionCountUpdated(const MessageReactionCountUpdated::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "chat", parseChat(object->chat));
+ appendToJson(result, "message_id", object->messageId);
+ appendToJson(result, "date", object->date);
+ appendToJson(result, "reactions", parseArray(&TgTypeParser::parseReactionCount, object->reactions));
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
ForumTopic::Ptr TgTypeParser::parseJsonAndGetForumTopic(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<ForumTopic>());
result->messageThreadId = data.get<std::int32_t>("message_thread_id", 0);
@@ -2445,6 +3034,189 @@ std::string TgTypeParser::parseMenuButtonDefault(const MenuButtonDefault::Ptr& o
return result;
}
+ChatBoostSource::Ptr TgTypeParser::parseJsonAndGetChatBoostSource(const boost::property_tree::ptree& data) const {
+ std::string source = data.get<std::string>("source", "");
+ ChatBoostSource::Ptr result;
+
+ if (source == ChatBoostSourcePremium::SOURCE) {
+ result = std::static_pointer_cast<ChatBoostSource>(parseJsonAndGetChatBoostSourcePremium(data));
+ } else if (source == ChatBoostSourceGiftCode::SOURCE) {
+ result = std::static_pointer_cast<ChatBoostSource>(parseJsonAndGetChatBoostSourceGiftCode(data));
+ } else if (source == ChatBoostSourceGiveaway::SOURCE) {
+ result = std::static_pointer_cast<ChatBoostSource>(parseJsonAndGetChatBoostSourceGiveaway(data));
+ } else {
+ result = std::make_shared<ChatBoostSource>();
+ }
+
+ result->source = source;
+ result->user = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "user");
+
+ return result;
+}
+
+std::string TgTypeParser::parseChatBoostSource(const ChatBoostSource::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "source", object->source);
+ appendToJson(result, "user", parseUser(object->user));
+
+ if (object->source == ChatBoostSourcePremium::SOURCE) {
+ result += parseChatBoostSourcePremium(std::static_pointer_cast<ChatBoostSourcePremium>(object));
+ } else if (object->source == ChatBoostSourceGiftCode::SOURCE) {
+ result += parseChatBoostSourceGiftCode(std::static_pointer_cast<ChatBoostSourceGiftCode>(object));
+ } else if (object->source == ChatBoostSourceGiveaway::SOURCE) {
+ result += parseChatBoostSourceGiveaway(std::static_pointer_cast<ChatBoostSourceGiveaway>(object));
+ }
+
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+ChatBoostSourcePremium::Ptr TgTypeParser::parseJsonAndGetChatBoostSourcePremium(const boost::property_tree::ptree& /*data*/) const {
+ // NOTE: This function will be called by parseJsonAndGetChatBoostSource().
+ auto result(std::make_shared<ChatBoostSourcePremium>());
+ return result;
+}
+
+std::string TgTypeParser::parseChatBoostSourcePremium(const ChatBoostSourcePremium::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ // This function will be called by parseChatBoostSource(), so I don't add
+ // curly brackets to the result std::string.
+ std::string result;
+ // The last comma will be erased by parseChatBoostSource().
+ return result;
+}
+
+ChatBoostSourceGiftCode::Ptr TgTypeParser::parseJsonAndGetChatBoostSourceGiftCode(const boost::property_tree::ptree& /*data*/) const {
+ // NOTE: This function will be called by parseJsonAndGetChatBoostSource().
+ auto result(std::make_shared<ChatBoostSourceGiftCode>());
+ return result;
+}
+
+std::string TgTypeParser::parseChatBoostSourceGiftCode(const ChatBoostSourceGiftCode::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ // This function will be called by parseChatBoostSource(), so I don't add
+ // curly brackets to the result std::string.
+ std::string result;
+ // The last comma will be erased by parseChatBoostSource().
+ return result;
+}
+
+ChatBoostSourceGiveaway::Ptr TgTypeParser::parseJsonAndGetChatBoostSourceGiveaway(const boost::property_tree::ptree& data) const {
+ // NOTE: This function will be called by parseJsonAndGetChatBoostSource().
+ auto result(std::make_shared<ChatBoostSourceGiveaway>());
+ result->giveawayMessageId = data.get<std::int32_t>("giveaway_message_id", 0);
+ result->isUnclaimed = data.get<bool>("is_unclaimed", false);
+ return result;
+}
+
+std::string TgTypeParser::parseChatBoostSourceGiveaway(const ChatBoostSourceGiveaway::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ // This function will be called by parseChatBoostSource(), so I don't add
+ // curly brackets to the result std::string.
+ std::string result;
+ appendToJson(result, "giveaway_message_id", object->giveawayMessageId);
+ appendToJson(result, "is_unclaimed", object->isUnclaimed);
+ // The last comma will be erased by parseChatBoostSource().
+ return result;
+}
+
+ChatBoost::Ptr TgTypeParser::parseJsonAndGetChatBoost(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<ChatBoost>());
+ result->boostId = data.get<std::string>("boost_id", "");
+ result->addDate = data.get<std::uint32_t>("add_date", 0);
+ result->expirationDate = data.get<std::uint32_t>("expiration_date", 0);
+ result->source = tryParseJson<ChatBoostSource>(&TgTypeParser::parseJsonAndGetChatBoostSource, data, "source");
+ return result;
+}
+
+std::string TgTypeParser::parseChatBoost(const ChatBoost::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "boost_id", object->boostId);
+ appendToJson(result, "add_date", object->addDate);
+ appendToJson(result, "expiration_date", object->expirationDate);
+ appendToJson(result, "source", parseChatBoostSource(object->source));
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+ChatBoostUpdated::Ptr TgTypeParser::parseJsonAndGetChatBoostUpdated(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<ChatBoostUpdated>());
+ result->chat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "chat");
+ result->boost = tryParseJson<ChatBoost>(&TgTypeParser::parseJsonAndGetChatBoost, data, "boost");
+ return result;
+}
+
+std::string TgTypeParser::parseChatBoostUpdated(const ChatBoostUpdated::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "chat", parseChat(object->chat));
+ appendToJson(result, "boost", parseChatBoost(object->boost));
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+ChatBoostRemoved::Ptr TgTypeParser::parseJsonAndGetChatBoostRemoved(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<ChatBoostRemoved>());
+ result->chat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "chat");
+ result->boostId = data.get<std::string>("boost_id", "");
+ result->removeDate = data.get<std::uint32_t>("remove_date", 0);
+ result->source = tryParseJson<ChatBoostSource>(&TgTypeParser::parseJsonAndGetChatBoostSource, data, "source");
+ return result;
+}
+
+std::string TgTypeParser::parseChatBoostRemoved(const ChatBoostRemoved::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "chat", parseChat(object->chat));
+ appendToJson(result, "boost_id", object->boostId);
+ appendToJson(result, "remove_date", object->removeDate);
+ appendToJson(result, "source", parseChatBoostSource(object->source));
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+UserChatBoosts::Ptr TgTypeParser::parseJsonAndGetUserChatBoosts(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<UserChatBoosts>());
+ result->boosts = parseJsonAndGetArray<ChatBoost>(&TgTypeParser::parseJsonAndGetChatBoost, data, "boosts");
+ return result;
+}
+
+std::string TgTypeParser::parseUserChatBoosts(const UserChatBoosts::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "boosts", parseArray(&TgTypeParser::parseChatBoost, object->boosts));
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
ResponseParameters::Ptr TgTypeParser::parseJsonAndGetResponseParameters(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<ResponseParameters>());
result->migrateToChatId = data.get<std::int64_t>("migrate_to_chat_id", 0);
@@ -3676,7 +4448,7 @@ InputTextMessageContent::Ptr TgTypeParser::parseJsonAndGetInputTextMessageConten
result->messageText = data.get<std::string>("message_text", "");
result->parseMode = data.get<std::string>("parse_mode", "");
result->entities = parseJsonAndGetArray<MessageEntity>(&TgTypeParser::parseJsonAndGetMessageEntity, data, "entities");
- result->disableWebPagePreview = data.get<bool>("disable_web_page_preview", false);
+ result->linkPreviewOptions = tryParseJson<LinkPreviewOptions>(&TgTypeParser::parseJsonAndGetLinkPreviewOptions, data, "link_preview_options");
return result;
}
@@ -3689,7 +4461,7 @@ std::string TgTypeParser::parseInputTextMessageContent(const InputTextMessageCon
appendToJson(result, "message_text", object->messageText);
appendToJson(result, "parse_mode", object->parseMode);
appendToJson(result, "entities", parseArray(&TgTypeParser::parseMessageEntity, object->entities));
- appendToJson(result, "disable_web_page_preview", object->disableWebPagePreview);
+ appendToJson(result, "link_preview_options", parseLinkPreviewOptions(object->linkPreviewOptions));
// The last comma will be erased by parseInputMessageContent().
return result;
}
diff --git a/src/types/ChatBoostSource.cpp b/src/types/ChatBoostSource.cpp
new file mode 100644
index 0000000..84417b6
--- /dev/null
+++ b/src/types/ChatBoostSource.cpp
@@ -0,0 +1,11 @@
+#include "tgbot/types/ChatBoostSourcePremium.h"
+#include "tgbot/types/ChatBoostSourceGiftCode.h"
+#include "tgbot/types/ChatBoostSourceGiveaway.h"
+
+#include <string>
+
+using namespace TgBot;
+
+const std::string ChatBoostSourcePremium::SOURCE = "premium";
+const std::string ChatBoostSourceGiftCode::SOURCE = "gift_code";
+const std::string ChatBoostSourceGiveaway::SOURCE = "giveaway";
diff --git a/src/types/MessageOrigin.cpp b/src/types/MessageOrigin.cpp
new file mode 100644
index 0000000..c2471d9
--- /dev/null
+++ b/src/types/MessageOrigin.cpp
@@ -0,0 +1,13 @@
+#include "tgbot/types/MessageOriginUser.h"
+#include "tgbot/types/MessageOriginHiddenUser.h"
+#include "tgbot/types/MessageOriginChat.h"
+#include "tgbot/types/MessageOriginChannel.h"
+
+#include <string>
+
+using namespace TgBot;
+
+const std::string MessageOriginUser::TYPE = "user";
+const std::string MessageOriginHiddenUser::TYPE = "hidden_user";
+const std::string MessageOriginChat::TYPE = "chat";
+const std::string MessageOriginChannel::TYPE = "channel";
diff --git a/src/types/ReactionType.cpp b/src/types/ReactionType.cpp
new file mode 100644
index 0000000..3dd984b
--- /dev/null
+++ b/src/types/ReactionType.cpp
@@ -0,0 +1,9 @@
+#include "tgbot/types/ReactionTypeEmoji.h"
+#include "tgbot/types/ReactionTypeCustomEmoji.h"
+
+#include <string>
+
+using namespace TgBot;
+
+const std::string ReactionTypeEmoji::TYPE = "emoji";
+const std::string ReactionTypeCustomEmoji::TYPE = "custom_emoji";