summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--CMakeLists.txt12
-rw-r--r--README.md17
-rw-r--r--include/tgbot/Api.h817
-rw-r--r--include/tgbot/TgTypeParser.h202
-rw-r--r--include/tgbot/types/Animation.h2
-rw-r--r--include/tgbot/types/Audio.h2
-rw-r--r--include/tgbot/types/Birthdate.h34
-rw-r--r--include/tgbot/types/BotDescription.h25
-rw-r--r--include/tgbot/types/BotName.h25
-rw-r--r--include/tgbot/types/BotShortDescription.h25
-rw-r--r--include/tgbot/types/BusinessConnection.h57
-rw-r--r--include/tgbot/types/BusinessIntro.h36
-rw-r--r--include/tgbot/types/BusinessLocation.h31
-rw-r--r--include/tgbot/types/BusinessMessagesDeleted.h42
-rw-r--r--include/tgbot/types/BusinessOpeningHours.h32
-rw-r--r--include/tgbot/types/BusinessOpeningHoursInterval.h29
-rw-r--r--include/tgbot/types/Chat.h161
-rw-r--r--include/tgbot/types/ChatAdministratorRights.h32
-rw-r--r--include/tgbot/types/ChatBoost.h44
-rw-r--r--include/tgbot/types/ChatBoostAdded.h26
-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.h34
-rw-r--r--include/tgbot/types/ChatMemberBanned.h4
-rw-r--r--include/tgbot/types/ChatMemberRestricted.h11
-rw-r--r--include/tgbot/types/ChatMemberUpdated.h12
-rw-r--r--include/tgbot/types/ChatPermissions.h18
-rw-r--r--include/tgbot/types/ChatShared.h29
-rw-r--r--include/tgbot/types/Document.h2
-rw-r--r--include/tgbot/types/EncryptedPassportElement.h50
-rw-r--r--include/tgbot/types/ExternalReplyInfo.h167
-rw-r--r--include/tgbot/types/ForceReply.h29
-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/InlineKeyboardButton.h27
-rw-r--r--include/tgbot/types/InlineKeyboardMarkup.h5
-rw-r--r--include/tgbot/types/InlineQueryResult.h31
-rw-r--r--include/tgbot/types/InlineQueryResultArticle.h6
-rw-r--r--include/tgbot/types/InlineQueryResultAudio.h16
-rw-r--r--include/tgbot/types/InlineQueryResultCachedAudio.h7
-rw-r--r--include/tgbot/types/InlineQueryResultCachedDocument.h7
-rw-r--r--include/tgbot/types/InlineQueryResultCachedSticker.h4
-rw-r--r--include/tgbot/types/InlineQueryResultCachedVoice.h9
-rw-r--r--include/tgbot/types/InlineQueryResultContact.h24
-rw-r--r--include/tgbot/types/InlineQueryResultDocument.h27
-rw-r--r--include/tgbot/types/InlineQueryResultGame.h3
-rw-r--r--include/tgbot/types/InlineQueryResultGif.h4
-rw-r--r--include/tgbot/types/InlineQueryResultLocation.h30
-rw-r--r--include/tgbot/types/InlineQueryResultMpeg4Gif.h4
-rw-r--r--include/tgbot/types/InlineQueryResultPhoto.h2
-rw-r--r--include/tgbot/types/InlineQueryResultVenue.h36
-rw-r--r--include/tgbot/types/InlineQueryResultVideo.h2
-rw-r--r--include/tgbot/types/InlineQueryResultVoice.h5
-rw-r--r--include/tgbot/types/InlineQueryResultsButton.h46
-rw-r--r--include/tgbot/types/InputMediaAnimation.h2
-rw-r--r--include/tgbot/types/InputMediaAudio.h2
-rw-r--r--include/tgbot/types/InputMediaDocument.h2
-rw-r--r--include/tgbot/types/InputMediaVideo.h2
-rw-r--r--include/tgbot/types/InputSticker.h57
-rw-r--r--include/tgbot/types/InputTextMessageContent.h13
-rw-r--r--include/tgbot/types/KeyboardButton.h32
-rw-r--r--include/tgbot/types/KeyboardButtonRequestChat.h37
-rw-r--r--include/tgbot/types/KeyboardButtonRequestUser.h43
-rw-r--r--include/tgbot/types/KeyboardButtonRequestUsers.h67
-rw-r--r--include/tgbot/types/LinkPreviewOptions.h48
-rw-r--r--include/tgbot/types/Location.h23
-rw-r--r--include/tgbot/types/Message.h166
-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/PollAnswer.h20
-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/ReplyKeyboardMarkup.h13
-rw-r--r--include/tgbot/types/ReplyKeyboardRemove.h22
-rw-r--r--include/tgbot/types/ReplyParameters.h72
-rw-r--r--include/tgbot/types/SharedUser.h54
-rw-r--r--include/tgbot/types/ShippingAddress.h17
-rw-r--r--include/tgbot/types/Sticker.h7
-rw-r--r--include/tgbot/types/StickerSet.h17
-rw-r--r--include/tgbot/types/Story.h33
-rw-r--r--include/tgbot/types/SwitchInlineQueryChosenChat.h46
-rw-r--r--include/tgbot/types/TextQuote.h49
-rw-r--r--include/tgbot/types/Update.h106
-rw-r--r--include/tgbot/types/User.h20
-rw-r--r--include/tgbot/types/UserChatBoosts.h28
-rw-r--r--include/tgbot/types/UserShared.h36
-rw-r--r--include/tgbot/types/UsersShared.h34
-rw-r--r--include/tgbot/types/Video.h2
-rw-r--r--include/tgbot/types/VideoNote.h2
-rw-r--r--include/tgbot/types/WebAppInfo.h6
-rw-r--r--include/tgbot/types/WriteAccessAllowed.h20
-rw-r--r--samples/inline-keyboard/src/main.cpp6
-rw-r--r--samples/receive-file/src/main.cpp7
-rw-r--r--samples/reply-keyboard/src/main.cpp4
-rw-r--r--src/Api.cpp928
-rw-r--r--src/TgTypeParser.cpp1746
-rw-r--r--src/types/ChatBoostSource.cpp11
-rw-r--r--src/types/InputFile.cpp10
-rw-r--r--src/types/MessageOrigin.cpp13
-rw-r--r--src/types/ReactionType.cpp9
116 files changed, 5732 insertions, 1339 deletions
diff --git a/CMakeLists.txt b/CMakeLists.txt
index c76b640..627af9c 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -11,7 +11,7 @@ option(BUILD_SHARED_LIBS "Build tgbot-cpp shared/static library." OFF)
option(BUILD_DOCUMENTATION "Build doxygen API documentation." OFF)
# sources
-set(CMAKE_CXX_STANDARD 14)
+set(CMAKE_CXX_STANDARD 17)
set(CMAKE_CXX_STANDARD_REQUIRED ON)
set(CMAKE_CXX_EXTENSIONS OFF)
if(WIN32)
@@ -38,13 +38,16 @@ set(SRC_LIST
src/tools/FileTools.cpp
src/tools/StringTools.cpp
src/types/BotCommandScope.cpp
+ src/types/ChatBoostSource.cpp
src/types/ChatMember.cpp
src/types/InlineQueryResult.cpp
src/types/InputFile.cpp
src/types/InputMedia.cpp
src/types/InputMessageContent.cpp
src/types/MenuButton.cpp
- src/types/PassportElementError.cpp)
+ src/types/MessageOrigin.cpp
+ src/types/PassportElementError.cpp
+ src/types/ReactionType.cpp)
# libs
## threads
@@ -76,6 +79,7 @@ link_directories(${Boost_LIBRARY_DIR_RELEASE})
if(NOT Boost_USE_STATIC_LIBS)
add_definitions(-DBOOST_ALL_DYN_LINK)
endif()
+add_definitions(-DBOOST_BIND_GLOBAL_PLACEHOLDERS)
set(LIB_LIST
${CMAKE_THREAD_LIBS_INIT}
@@ -88,6 +92,10 @@ if (CURL_FOUND)
set(LIB_LIST ${LIB_LIST} ${CURL_LIBRARIES})
endif()
+if (WIN32)
+ set(LIB_LIST ${LIB_LIST} Ws2_32)
+endif()
+
# building project
add_library(${PROJECT_NAME} ${SRC_LIST})
target_include_directories(${PROJECT_NAME} PUBLIC
diff --git a/README.md b/README.md
index 9d128e8..d20f8fc 100644
--- a/README.md
+++ b/README.md
@@ -9,7 +9,11 @@ Documentation is located [here](http://reo7sp.github.io/tgbot-cpp).
## State
-- [x] Telegram Bot API 6.5
+- [x] Telegram Bot API 7.2
+- [ ] [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)
## Sample
@@ -64,7 +68,12 @@ Dependencies:
You can install dependencies on Debian-based distibutives with these commands:
```sh
-sudo apt-get install g++ make binutils cmake libboost-system-dev libssl-dev zlib1g-dev libcurl4-openssl-dev
+sudo apt install g++ make binutils cmake libboost-system-dev libssl-dev zlib1g-dev libcurl4-openssl-dev
+```
+
+Optionally, install the dependencies for testing and documenting
+```sh
+sudo apt install libboost-test-dev doxygen
```
You can compile and install the library with these commands:
@@ -99,8 +108,8 @@ Taken from [Vcpkg - Quick Start: Windows](https://github.com/Microsoft/vcpkg/#qu
Prerequisites:
- Windows 7 or newer
-- Git
-- Visual Studio 2015 Update 3 or greater with the English language pack
+- [Git][https://git-scm.com/downloads]
+- [Visual Studio][https://visualstudio.microsoft.com] 2015 Update 3 or greater with the English language pack
First, download and bootstrap vcpkg itself; it can be installed anywhere, but generally we recommend using vcpkg as a submodule for CMake projects, and installing it globally for Visual Studio projects. We recommend somewhere like `C:\src\vcpkg` or `C:\dev\vcpkg`, since otherwise you may run into path issues for some port build systems.
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h
index 6bd24e4..2288f5c 100644
--- a/include/tgbot/Api.h
+++ b/include/tgbot/Api.h
@@ -17,6 +17,7 @@
#include "tgbot/types/Venue.h"
#include "tgbot/types/WebhookInfo.h"
#include "tgbot/types/ChatMember.h"
+#include "tgbot/types/Sticker.h"
#include "tgbot/types/StickerSet.h"
#include "tgbot/types/File.h"
#include "tgbot/types/InputMedia.h"
@@ -55,16 +56,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 +76,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 +163,42 @@ 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 a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account
+ * @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
+ * @param businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent
+ *
* @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,
+ std::int32_t messageThreadId = 0,
bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ const std::string& businessConnectionId = "") 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 +209,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 A JSON-serialized list of 1-100 identifiers of 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,67 +259,93 @@ 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 A JSON-serialized list of 1-100 identifiers of 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 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 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 a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account
* @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
- *
+ * @param businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent
+ *
* @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 hasSpoiler = false) const;
+ bool protectContent = false,
+ bool hasSpoiler = false,
+ const std::string& businessConnectionId = "") 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
* @param duration Optional. Duration of the audio in seconds
* @param performer Optional. Performer
* @param title Optional. Track name
- * @param thumb 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 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 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 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 a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account
* @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
+ * @param businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent
+ *
* @return On success, the sent Message is returned.
*/
Message::Ptr sendAudio(boost::variant<std::int64_t, std::string> chatId,
@@ -307,74 +354,74 @@ public:
std::int32_t duration = 0,
const std::string& performer = "",
const std::string& title = "",
- boost::variant<InputFile::Ptr, std::string> thumb = "",
- std::int32_t replyToMessageId = 0,
+ boost::variant<InputFile::Ptr, std::string> thumbnail = "",
+ 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,
+ std::int32_t messageThreadId = 0,
bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ const std::string& businessConnectionId = "") 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 thumb 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 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 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 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 a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account
* @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
+ * @param businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent
+ *
* @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> thumb = "",
+ 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,
+ std::int32_t messageThreadId = 0,
bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ const std::string& businessConnectionId = "") 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
* @param duration Optional. Duration of sent video in seconds
* @param width Optional. Video width
* @param height Optional. Video height
- * @param thumb 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 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 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 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 a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account
* @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
- *
+ * @param businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent
+ *
* @return On success, the sent Message is returned.
*/
Message::Ptr sendVideo(boost::variant<std::int64_t, std::string> chatId,
@@ -383,21 +430,21 @@ public:
std::int32_t duration = 0,
std::int32_t width = 0,
std::int32_t height = 0,
- boost::variant<InputFile::Ptr, std::string> thumb = "",
+ 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 hasSpoiler = false) const;
+ bool protectContent = false,
+ bool hasSpoiler = false,
+ const std::string& businessConnectionId = "") 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)
@@ -405,18 +452,18 @@ public:
* @param duration Optional. Duration of sent animation in seconds
* @param width Optional. Animation width
* @param height Optional. Animation height
- * @param thumb 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 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 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 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 a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account
* @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
- *
+ * @param businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent
+ *
* @return On success, the sent Message is returned.
*/
Message::Ptr sendAnimation(boost::variant<std::int64_t, std::string> chatId,
@@ -424,138 +471,138 @@ public:
std::int32_t duration = 0,
std::int32_t width = 0,
std::int32_t height = 0,
- boost::variant<InputFile::Ptr, std::string> thumb = "",
+ 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 hasSpoiler = false) const;
+ bool protectContent = false,
+ bool hasSpoiler = false,
+ const std::string& businessConnectionId = "") 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 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 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 a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account
* @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
+ * @param businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent
+ *
* @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,
+ std::int32_t messageThreadId = 0,
bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ const std::string& businessConnectionId = "") 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 thumb 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 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](https://core.telegram.org/bots/features#inline-keyboards), [custom reply keyboard](https://core.telegram.org/bots/features#keyboards), instructions to remove a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account
* @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 businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent
+ *
* @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> thumb = "",
+ boost::variant<InputFile::Ptr, std::string> thumbnail = "",
GenericReply::Ptr replyMarkup = nullptr,
- bool allowSendingWithoutReply = false,
+ std::int32_t messageThreadId = 0,
bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ const std::string& businessConnectionId = "") 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
+ * @param businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent
+ *
* @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,
+ ReplyParameters::Ptr replyParameters = nullptr,
+ std::int32_t messageThreadId = 0,
bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ const std::string& businessConnectionId = "") 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 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 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 a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account
* @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
+ * @param businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent
+ *
* @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,
+ std::int32_t messageThreadId = 0,
bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ const std::string& businessConnectionId = "") const;
/**
* @brief Use this method to edit live location messages.
@@ -601,7 +648,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 +657,14 @@ 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 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 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 a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account
* @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
+ * @param businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent
+ *
* @return On success, the sent Message is returned.
*/
Message::Ptr sendVenue(boost::variant<std::int64_t, std::string> chatId,
@@ -628,29 +675,29 @@ 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,
+ std::int32_t messageThreadId = 0,
bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ const std::string& businessConnectionId = "") 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 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 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 a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account
* @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 businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent
+ *
* @return On success, the sent Message is returned.
*/
Message::Ptr sendContact(boost::variant<std::int64_t, std::string> chatId,
@@ -659,11 +706,11 @@ 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,
+ std::int32_t messageThreadId = 0,
bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ const std::string& businessConnectionId = "") const;
/**
* @brief Use this method to send a native poll.
@@ -672,8 +719,8 @@ 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 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 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 a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account
* @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”
* @param allowsMultipleAnswers Optional. True, if the poll allows multiple answers, ignored for polls in quiz mode, defaults to False
@@ -684,9 +731,9 @@ 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
+ * @param businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent
*
* @return On success, the sent Message is returned.
*/
@@ -694,7 +741,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,52 +753,73 @@ public:
std::int32_t openPeriod = 0,
std::int32_t closeDate = 0,
bool isClosed = false,
- bool allowSendingWithoutReply = false,
+ std::int32_t messageThreadId = 0,
bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ const std::string& businessConnectionId = "") 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 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 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 a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account
* @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
+ * @param businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent
*
* @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,
+ std::int32_t messageThreadId = 0,
bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ const std::string& businessConnectionId = "") 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. A JSON-serialized 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.
+ *
* The status is set for 5 seconds or less (when a message arrives from your bot, Telegram clients clear its typing status).
*
- * Example: The ImageBot needs some time to process a request and upload the image.
+ * Example: The [ImageBot](https://t.me/imagebot) needs some time to process a request and upload the image.
* Instead of sending a text message along the lines of “Retrieving image, please wait…”, the bot may use Api::sendChatAction with action = upload_photo.
* The user will see a “sending photo” status for the bot.
- *
+ *
* We only recommend using this method when a response from the bot will take a noticeable amount of time to arrive.
*
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
* @param action Type of action to broadcast. Choose one, depending on what the user is about to receive: typing for text messages, upload_photo for photos, record_video or upload_video for videos, record_voice or upload_voice for voice notes, upload_document for general files, choose_sticker for stickers, find_location for location data, record_video_note or upload_video_note for video notes.
- * @param messageThreadId Optional. Unique identifier for the target message thread; supergroups only
+ * @param messageThreadId Optional. Unique identifier for the target message thread; for supergroups only
+ * @param businessConnectionId Optional. Unique identifier of the business connection on behalf of which the action will be sent
*
* @return Returns True on success.
*/
bool sendChatAction(std::int64_t chatId,
const std::string& action,
- std::int32_t messageThreadId = 0) const;
+ std::int32_t messageThreadId = 0,
+ const std::string& businessConnectionId = "") const;
/**
* @brief Use this method to get a list of profile pictures for a user.
@@ -829,7 +897,7 @@ public:
* @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
* @param userId Unique identifier of the target user
* @param permissions A JSON-serialized object for new user permissions
- * @param untilDate Optional. Date when restrictions will be lifted for the user, unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever
+ * @param untilDate Optional. Date when restrictions will be lifted for the user; Unix time. If user is restricted for more than 366 days or less than 30 seconds from the current time, they are considered to be restricted forever
* @param useIndependentChatPermissions Optional. Pass True if chat permissions are set independently. Otherwise, the canSendOtherMessages and canAddWebPagPreviews permissions will imply the canSendMessages, canSendAudios, canSendDocuments, canSendPhotos, canSendVideos, canSendVideoNotes, and canSendVoiceNotes permissions; the canSendPolls permission will imply the canSendMessages permission.
*
* @return Returns True on success.
@@ -837,30 +905,33 @@ public:
bool restrictChatMember(boost::variant<std::int64_t, std::string> chatId,
std::int64_t userId,
ChatPermissions::Ptr permissions,
- std::int64_t untilDate = 0,
+ std::uint32_t untilDate = 0,
bool useIndependentChatPermissions = false) const;
/**
* @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 create channel posts, channels only
- * @param canEditMessages Optional. Pass True if the administrator can edit messages of other users and can pin messages, channels only
+ * @param canPostMessages Optional. Pass True if the administrator can post messages in the channel, or access channel statistics; for channels only
+ * @param canEditMessages Optional. Pass True if the administrator can edit messages of other users and can pin messages; for 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 canPinMessages Optional. Pass True if the administrator can pin messages; for 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, 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, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode. Implied by any other administrator privilege.
* @param canManageVideoChats Optional. Pass True if the administrator can manage video chats
- * @param canRestrictMembers Optional. Pass True if the administrator can restrict, ban or unban chat members
- * @param canManageTopics Optional. Pass True if the user is allowed to create, rename, close, and reopen forum topics, supergroups only
- *
+ * @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; for supergroups only
+ * @param canPostStories Optional. Pass True if the administrator can post stories to the chat
+ * @param canEditStories Optional. Pass True if the administrator can edit stories posted by other users
+ * @param canDeleteStories Optional. Pass True if the administrator can delete stories posted by other users
+ *
* @return Returns True on success.
*/
bool promoteChatMember(boost::variant<std::int64_t, std::string> chatId,
@@ -876,7 +947,10 @@ public:
bool canManageChat = false,
bool canManageVideoChats = false,
bool canRestrictMembers = false,
- bool canManageTopics = false) const;
+ bool canManageTopics = false,
+ bool canPostStories = false,
+ bool canEditStories = false,
+ bool canDeleteStories = false) const;
/**
* @brief Use this method to set a custom title for an administrator in a supergroup promoted by the bot.
@@ -1132,10 +1206,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;
@@ -1236,7 +1310,7 @@ public:
bool editForumTopic(boost::variant<std::int64_t, std::string> chatId,
std::int32_t messageThreadId,
const std::string& name = "",
- boost::variant<std::int8_t, std::string> iconCustomEmojiId = 0) const;
+ boost::variant<std::int32_t, std::string> iconCustomEmojiId = 0) const;
/**
* @brief Use this method to close an open topic in a forum supergroup chat.
@@ -1350,6 +1424,17 @@ public:
bool unhideGeneralForumTopic(boost::variant<std::int64_t, std::string> chatId) const;
/**
+ * @brief Use this method to clear the list of pinned messages in a General forum topic.
+ *
+ * The bot must be an administrator in the chat for this to work and must have the canPinMessages administrator right in the supergroup.
+ *
+ * @param chatId Unique identifier for the target chat or username of the target supergroup (in the format @supergroupusername)
+ *
+ * @return Returns True on success.
+ */
+ bool unpinAllGeneralForumTopicMessages(boost::variant<std::int64_t, std::string> chatId) const;
+
+ /**
* @brief Use this method to send answers to callback queries sent from inline keyboards.
*
* The answer will be displayed to the user as a notification at the top of the chat screen or as an alert.
@@ -1373,6 +1458,28 @@ 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 get information about the connection of the bot with a business account.
+ *
+ * @param businessConnectionId Unique identifier of the business connection
+ *
+ * @return Returns a BusinessConnection object on success.
+ */
+ BusinessConnection::Ptr getBusinessConnection(const std::string& businessConnectionId) 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.
@@ -1412,6 +1519,66 @@ public:
const std::string& languageCode = "") const;
/**
+ * @brief Use this method to change the bot's name.
+ *
+ * @param name Optional. New bot name; 0-64 characters. Pass an empty string to remove the dedicated name for the given language.
+ * @param languageCode Optional. A two-letter ISO 639-1 language code. If empty, the name will be shown to all users for whose language there is no dedicated name.
+ *
+ * @return Returns True on success.
+ */
+ bool setMyName(const std::string& name = "",
+ const std::string& languageCode = "") const;
+
+ /**
+ * @brief Use this method to get the current bot name for the given user language.
+ *
+ * @param languageCode Optional. A two-letter ISO 639-1 language code or an empty string
+ *
+ * @return Returns BotName on success.
+ */
+ BotName::Ptr getMyName(const std::string& languageCode = "") const;
+
+ /**
+ * @brief Use this method to change the bot's description, which is shown in the chat with the bot if the chat is empty.
+ *
+ * @param description Optional. New bot description; 0-512 characters. Pass an empty string to remove the dedicated description for the given language.
+ * @param languageCode Optional. A two-letter ISO 639-1 language code. If empty, the description will be applied to all users for whose language there is no dedicated description.
+ *
+ * @return Returns True on success.
+ */
+ bool setMyDescription(const std::string& description = "",
+ const std::string& languageCode = "") const;
+
+ /**
+ * @brief Use this method to get the current bot description for the given user language.
+ *
+ * @param languageCode Optional. A two-letter ISO 639-1 language code or an empty string
+ *
+ * @return Returns BotDescription on success.
+ */
+ BotDescription::Ptr getMyDescription(const std::string& languageCode = "") const;
+
+ /**
+ * @brief Use this method to change the bot's short description, which is shown on the bot's profile page and is sent together with the link when users share the bot.
+ *
+ * @param shortDescription Optional. New short description for the bot; 0-120 characters. Pass an empty string to remove the dedicated short description for the given language.
+ * @param languageCode Optional. A two-letter ISO 639-1 language code. If empty, the short description will be applied to all users for whose language there is no dedicated short description.
+ *
+ * @return Returns True on success.
+ */
+ bool setMyShortDescription(const std::string& shortDescription = "",
+ const std::string& languageCode = "") const;
+
+ /**
+ * @brief Use this method to get the current bot short description for the given user language.
+ *
+ * @param languageCode Optional. A two-letter ISO 639-1 language code or an empty string
+ *
+ * @return Returns BotShortDescription on success.
+ */
+ BotShortDescription::Ptr getMyShortDescription(const std::string& languageCode = "") const;
+
+ /**
* @brief Use this method to change the bot's menu button in a private chat, or the default menu button.
*
* @param chatId Optional. Unique identifier for the target private chat. If not specified, default bot's menu button will be changed
@@ -1434,7 +1601,7 @@ public:
/**
* @brief Use this method to change the default administrator rights requested by the bot when it's added as an administrator to groups or channels.
*
- * These rights will be suggested to users, but they are are free to modify the list before adding the bot.
+ * These rights will be suggested to users, but they are free to modify the list before adding the bot.
*
* @param rights Optional. A JSON-serialized object describing new default administrator rights. If not specified, the default administrator rights will be cleared.
* @param forChannels Optional. Pass True to change the default administrator rights of the bot in channels. Otherwise, the default administrator rights of the bot for groups and supergroups will be changed.
@@ -1454,17 +1621,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,
@@ -1472,8 +1639,8 @@ public:
std::int32_t messageId = 0,
const std::string& inlineMessageId = "",
const std::string& parseMode = "",
- bool disableWebPagePreview = false,
- GenericReply::Ptr replyMarkup = nullptr,
+ LinkPreviewOptions::Ptr linkPreviewOptions = nullptr,
+ InlineKeyboardMarkup::Ptr replyMarkup = nullptr,
const std::vector<MessageEntity::Ptr>& entities = std::vector<MessageEntity::Ptr>()) const;
/**
@@ -1566,27 +1733,42 @@ 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 A JSON-serialized list of 1-100 identifiers of 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 file from the Internet, or upload a new one using multipart/form-data. https://core.telegram.org/bots/api#sending-files
- * @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 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, .TGS, or .WEBM sticker using multipart/form-data. [More information on Sending Files »](https://core.telegram.org/bots/api#sending-files). Video and animated stickers can't be sent via an HTTP URL.
+ * @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 a reply keyboard or to force a reply from the user. Not supported for messages sent on behalf of a business account
* @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
+ * @param businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent
+ *
* @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,
+ std::int32_t messageThreadId = 0,
bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ const std::string& emoji = "",
+ const std::string& businessConnectionId = "") const;
/**
* @brief Use this method to get a sticker set.
@@ -1600,76 +1782,61 @@ public:
/**
* @brief Use this method to get information about custom emoji stickers by their identifiers.
*
- * @param customEmojiIds List of custom emoji identifiers. At most 200 custom emoji identifiers can be specified.
+ * @param customEmojiIds A JSON-serialized list of custom emoji identifiers. At most 200 custom emoji identifiers can be specified.
*
* @return Returns an Array of Sticker objects.
*/
std::vector<Sticker::Ptr> getCustomEmojiStickers(const std::vector<std::string>& customEmojiIds) const;
/**
- * @brief Use this method to upload a .PNG file with a sticker for later use in Api::createNewStickerSet and Api::addStickerToSet methods (can be used multiple times).
- *
+ * @brief Use this method to upload a file with a sticker for later use in the Api::createNewStickerSet, Api::addStickerToSet, or Api::replaceStickerInSet methods (the file can be used multiple times).
+ *
* @param userId User identifier of sticker file owner
- * @param pngSticker PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. https://core.telegram.org/bots/api#sending-files
- *
+ * @param sticker A file with the sticker in .WEBP, .PNG, .TGS, or .WEBM format. See https://core.telegram.org/stickers for technical requirements. https://core.telegram.org/bots/api#sending-files
+ * @param stickerFormat Format of the sticker, must be one of “static”, “animated”, “video”
+ *
* @return Returns the uploaded File on success.
*/
File::Ptr uploadStickerFile(std::int64_t userId,
- InputFile::Ptr pngSticker) const;
+ InputFile::Ptr sticker,
+ const std::string& stickerFormat) const;
/**
* @brief Use this method to create a new sticker set owned by a user.
- *
+ *
* The bot will be able to edit the sticker set thus created.
- * You must use exactly one of the fields pngSticker, tgsSticker, or webmSticker.
*
* @param userId User identifier of created sticker set owner
* @param name Short name of sticker set, to be used in t.me/addstickers/ URLs (e.g., animals). Can contain only English letters, digits and underscores. Must begin with a letter, can't contain consecutive underscores and must end in "_by_<bot_username>". <bot_username> is case insensitive. 1-64 characters.
* @param title Sticker set title, 1-64 characters
- * @param emojis One or more emoji corresponding to the sticker
- * @param maskPosition Optional. A JSON-serialized object for position where the mask should be placed on faces
- * @param pngSticker Optional. PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a fileId as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. https://core.telegram.org/bots/api#sending-files
- * @param tgsSticker Optional. TGS animation with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/stickers#animated-sticker-requirements for technical requirements
- * @param webmSticker Optional. WEBM video with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/stickers#video-sticker-requirements for technical requirements
- * @param stickerType Optional. Type of stickers in the set, pass “regular” or “mask”. Custom emoji sticker sets can't be created via the Bot API at the moment. By default, a regular sticker set is created.
+ * @param stickers A JSON-serialized list of 1-50 initial stickers to be added to the sticker set
+ * @param stickerType Optional. Type of stickers in the set, pass “regular”, “mask”, or “custom_emoji”. By default, a regular sticker set is created.
+ * @param needsRepainting Optional. Pass True if stickers in the sticker set must be repainted to the color of text when used in messages, the accent color if used as emoji status, white on chat photos, or another appropriate color based on context; for custom emoji sticker sets only
*
* @return Returns True on success.
*/
bool createNewStickerSet(std::int64_t userId,
const std::string& name,
const std::string& title,
- const std::string& emojis,
- MaskPosition::Ptr maskPosition = nullptr,
- boost::variant<InputFile::Ptr, std::string> pngSticker = "",
- InputFile::Ptr tgsSticker = nullptr,
- InputFile::Ptr webmSticker = nullptr,
- const std::string& stickerType = "") const;
+ const std::vector<InputSticker::Ptr>& stickers,
+ Sticker::Type stickerType = Sticker::Type::Regular,
+ bool needsRepainting = false) const;
/**
* @brief Use this method to add a new sticker to a set created by the bot.
- *
- * You must use exactly one of the fields pngSticker, tgsSticker, or webmSticker.
- * Animated stickers can be added to animated sticker sets and only to them.
- * Animated sticker sets can have up to 50 stickers.
- * Static sticker sets can have up to 120 stickers.
+ *
+ * Emoji sticker sets can have up to 200 stickers.
+ * Other sticker sets can have up to 120 stickers.
*
* @param userId User identifier of sticker set owner
* @param name Sticker set name
- * @param emojis One or more emoji corresponding to the sticker
- * @param maskPosition Optional. A JSON-serialized object for position where the mask should be placed on faces
- * @param pngSticker Optional. PNG image with the sticker, must be up to 512 kilobytes in size, dimensions must not exceed 512px, and either width or height must be exactly 512px. Pass a fileId as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. https://core.telegram.org/bots/api#sending-files
- * @param tgsSticker Optional. TGS animation with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/stickers#animated-sticker-requirements for technical requirements
- * @param webmSticker Optional. WEBM video with the sticker, uploaded using multipart/form-data. See https://core.telegram.org/stickers#video-sticker-requirements for technical requirements
+ * @param sticker A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set isn't changed.
*
* @return Returns True on success.
*/
bool addStickerToSet(std::int64_t userId,
const std::string& name,
- const std::string& emojis,
- MaskPosition::Ptr maskPosition = nullptr,
- boost::variant<InputFile::Ptr, std::string> pngSticker = "",
- InputFile::Ptr tgsSticker = nullptr,
- InputFile::Ptr webmSticker = nullptr) const;
+ InputSticker::Ptr sticker) const;
/**
* @brief Use this method to move a sticker in a set created by the bot to a specific position.
@@ -1692,20 +1859,108 @@ public:
bool deleteStickerFromSet(const std::string& sticker) const;
/**
- * @brief Use this method to set the thumbnail of a sticker set.
+ * @brief Use this method to replace an existing sticker in a sticker set with a new one.
+ *
+ * The method is equivalent to calling Api::deleteStickerFromSet, then Api::addStickerToSet, then Api::setStickerPositionInSet.
+ *
+ * @param userId User identifier of the sticker set owner
+ * @param name Sticker set name
+ * @param oldSticker File identifier of the replaced sticker
+ * @param sticker A JSON-serialized object with information about the added sticker. If exactly the same sticker had already been added to the set, then the set remains unchanged.
+ *
+ * @return Returns True on success.
+ */
+ bool replaceStickerInSet(std::int64_t userId,
+ const std::string& name,
+ const std::string& oldSticker,
+ InputSticker::Ptr sticker) const;
+
+ /**
+ * @brief Use this method to change the list of emoji assigned to a regular or custom emoji sticker.
+ *
+ * The sticker must belong to a sticker set created by the bot.
+ *
+ * @param sticker File identifier of the sticker
+ * @param emojiList A JSON-serialized list of 1-20 emoji associated with the sticker
+ *
+ * @return Returns True on success.
+ */
+ bool setStickerEmojiList(const std::string& sticker,
+ const std::vector<std::string>& emojiList) const;
+
+ /**
+ * @brief Use this method to change search keywords assigned to a regular or custom emoji sticker.
+ *
+ * The sticker must belong to a sticker set created by the bot.
+ *
+ * @param sticker File identifier of the sticker
+ * @param keywords Optional. A JSON-serialized list of 0-20 search keywords for the sticker with total length of up to 64 characters
+ *
+ * @return Returns True on success.
+ */
+ bool setStickerKeywords(const std::string& sticker,
+ const std::vector<std::string>& keywords = std::vector<std::string>()) const;
+
+ /**
+ * @brief Use this method to change the mask position of a mask sticker.
+ *
+ * The sticker must belong to a sticker set that was created by the bot.
+ *
+ * @param sticker File identifier of the sticker
+ * @param maskPosition A JSON-serialized object with the position where the mask should be placed on faces. Omit the parameter to remove the mask position.
+ *
+ * @return Returns True on success.
+ */
+ bool setStickerMaskPosition(const std::string& sticker,
+ MaskPosition::Ptr maskPosition = nullptr) const;
+
+ /**
+ * @brief Use this method to set the title of a created sticker set.
+ *
+ * @param name Sticker set name
+ * @param title Sticker set title, 1-64 characters
*
- * Animated thumbnails can be set for animated sticker sets only.
- * Video thumbnails can be set only for video sticker sets only.
+ * @return Returns True on success.
+ */
+ bool setStickerSetTitle(const std::string& name,
+ const std::string& title) const;
+
+ /**
+ * @brief Use this method to set the thumbnail of a regular or mask sticker set.
+ *
+ * The format of the thumbnail file must match the format of the stickers in the set.
*
* @param name Sticker set name
* @param userId User identifier of the sticker set owner
- * @param thumb Optional. A PNG image with the thumbnail, must be up to 128 kilobytes in size and have width and height exactly 100px, or a TGS animation with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements, or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a fileId as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. https://core.telegram.org/bots/api#sending-files. Animated sticker set thumbnails can't be uploaded via HTTP URL.
+ * @param format Format of the thumbnail, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, or “video” for a WEBM video
+ * @param thumbnail Optional. A .WEBP or .PNG image with the thumbnail, must be up to 128 kilobytes in size and have a width and height of exactly 100px, or a .TGS animation with a thumbnail up to 32 kilobytes in size (see https://core.telegram.org/stickers#animated-sticker-requirements for animated sticker technical requirements), or a WEBM video with the thumbnail up to 32 kilobytes in size; see https://core.telegram.org/stickers#video-sticker-requirements for video sticker technical requirements. Pass a fileId as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, or upload a new one using multipart/form-data. https://core.telegram.org/bots/api#sending-files. Animated and video sticker set thumbnails can't be uploaded via HTTP URL. If omitted, then the thumbnail is dropped and the first sticker is used as the thumbnail.
*
* @return Returns True on success.
*/
- bool setStickerSetThumb(const std::string& name,
- std::int64_t userId,
- boost::variant<InputFile::Ptr, std::string> thumb = "") const;
+ bool setStickerSetThumbnail(const std::string& name,
+ std::int64_t userId,
+ const std::string& format,
+ boost::variant<InputFile::Ptr, std::string> thumbnail = "") const;
+
+ /**
+ * @brief Use this method to set the thumbnail of a custom emoji sticker set.
+ *
+ * @param name Sticker set name
+ * @param customEmojiId Optional. Custom emoji identifier of a sticker from the sticker set; pass an empty string to drop the thumbnail and use the first sticker as the thumbnail.
+ *
+ * @return Returns True on success.
+ */
+ bool setCustomEmojiStickerSetThumbnail(const std::string& name,
+ const std::string& customEmojiId = "") const;
+
+ /**
+ * @brief Use this method to delete a sticker set that was created by the bot.
+ *
+ * @param name Sticker set name
+ *
+ * @return Returns True on success.
+ */
+ bool deleteStickerSet(const std::string& name) const;
/**
* @brief Use this method to send answers to an inline query.
@@ -1715,10 +1970,9 @@ public:
* @param inlineQueryId Unique identifier for the answered query
* @param results A JSON-serialized array of results for the inline query
* @param cacheTime Optional. The maximum amount of time in seconds that the result of the inline query may be cached on the server. Defaults to 300.
- * @param isPersonal Optional. Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query
+ * @param isPersonal Optional. Pass True if results may be cached on the server side only for the user that sent the query. By default, results may be returned to any user who sends the same query.
* @param nextOffset Optional. Pass the offset that a client should send in the next query with the same text to receive more results. Pass an empty string if there are no more results or if you don't support pagination. Offset length can't exceed 64 bytes.
- * @param switchPmText Optional. If passed, clients will display a button with specified text that switches the user to a private chat with the bot and sends the bot a start message with the parameter switchPmParameter
- * @param switchPmParameter Optional. Deep-linking parameter for the /start message sent to the bot when user presses the switch button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed. Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly. To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any. The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link. Once done, the bot can offer an InlineKeyboardMarkup button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.
+ * @param button Optional. A JSON-serialized object describing a button to be shown above inline query results
*
* @return On success, True is returned.
*/
@@ -1727,8 +1981,7 @@ public:
std::int32_t cacheTime = 300,
bool isPersonal = false,
const std::string& nextOffset = "",
- const std::string& switchPmText = "",
- const std::string& switchPmParameter = "") const;
+ InlineQueryResultsButton::Ptr button = nullptr) const;
/**
* @brief Use this method to set the result of an interaction with a Web App and send a corresponding message on behalf of the user to the chat from which the query originated.
@@ -1743,7 +1996,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
@@ -1763,16 +2016,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,
@@ -1794,15 +2046,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.
@@ -1902,26 +2153,26 @@ 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 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 replyParameters Optional. Description of the message to reply to
+ * @param replyMarkup Optional. A JSON-serialized object for an [inline keyboard](https://core.telegram.org/bots/features#inline-keyboards). If empty, one 'Play gameTitle' button will be shown. If not empty, the first button must launch the game. Not supported for messages sent on behalf of a business account.
* @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 businessConnectionId Optional. Unique identifier of the business connection on behalf of which the message will be sent
+ *
* @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,
+ std::int32_t messageThreadId = 0,
bool protectContent = false,
- std::int32_t messageThreadId = 0) const;
+ const std::string& businessConnectionId = "") 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 191db5a..661930e 100644
--- a/include/tgbot/TgTypeParser.h
+++ b/include/tgbot/TgTypeParser.h
@@ -8,11 +8,21 @@
#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"
#include "tgbot/types/Document.h"
+#include "tgbot/types/Story.h"
#include "tgbot/types/Video.h"
#include "tgbot/types/VideoNote.h"
#include "tgbot/types/Voice.h"
@@ -26,36 +36,45 @@
#include "tgbot/types/WebAppData.h"
#include "tgbot/types/ProximityAlertTriggered.h"
#include "tgbot/types/MessageAutoDeleteTimerChanged.h"
+#include "tgbot/types/ChatBoostAdded.h"
#include "tgbot/types/ForumTopicCreated.h"
#include "tgbot/types/ForumTopicClosed.h"
#include "tgbot/types/ForumTopicEdited.h"
#include "tgbot/types/ForumTopicReopened.h"
#include "tgbot/types/GeneralForumTopicHidden.h"
#include "tgbot/types/GeneralForumTopicUnhidden.h"
-#include "tgbot/types/UserShared.h"
+#include "tgbot/types/SharedUser.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"
#include "tgbot/types/InlineKeyboardMarkup.h"
#include "tgbot/types/InlineKeyboardButton.h"
#include "tgbot/types/LoginUrl.h"
+#include "tgbot/types/SwitchInlineQueryChosenChat.h"
#include "tgbot/types/CallbackQuery.h"
#include "tgbot/types/ForceReply.h"
#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"
@@ -63,10 +82,20 @@
#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/Birthdate.h"
+#include "tgbot/types/BusinessIntro.h"
+#include "tgbot/types/BusinessLocation.h"
+#include "tgbot/types/BusinessOpeningHoursInterval.h"
+#include "tgbot/types/BusinessOpeningHours.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"
@@ -77,10 +106,23 @@
#include "tgbot/types/BotCommandScopeChat.h"
#include "tgbot/types/BotCommandScopeChatAdministrators.h"
#include "tgbot/types/BotCommandScopeChatMember.h"
+#include "tgbot/types/BotName.h"
+#include "tgbot/types/BotDescription.h"
+#include "tgbot/types/BotShortDescription.h"
#include "tgbot/types/MenuButton.h"
#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/BusinessConnection.h"
+#include "tgbot/types/BusinessMessagesDeleted.h"
#include "tgbot/types/ResponseParameters.h"
#include "tgbot/types/InputMedia.h"
#include "tgbot/types/InputMediaPhoto.h"
@@ -91,7 +133,9 @@
#include "tgbot/types/Sticker.h"
#include "tgbot/types/StickerSet.h"
#include "tgbot/types/MaskPosition.h"
+#include "tgbot/types/InputSticker.h"
#include "tgbot/types/InlineQuery.h"
+#include "tgbot/types/InlineQueryResultsButton.h"
#include "tgbot/types/InlineQueryResult.h"
#include "tgbot/types/InlineQueryResultArticle.h"
#include "tgbot/types/InlineQueryResultPhoto.h"
@@ -131,6 +175,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"
@@ -184,9 +230,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;
@@ -199,6 +272,9 @@ public:
Document::Ptr parseJsonAndGetDocument(const boost::property_tree::ptree& data) const;
std::string parseDocument(const Document::Ptr& object) const;
+ Story::Ptr parseJsonAndGetStory(const boost::property_tree::ptree& data) const;
+ std::string parseStory(const Story::Ptr& object) const;
+
Video::Ptr parseJsonAndGetVideo(const boost::property_tree::ptree& data) const;
std::string parseVideo(const Video::Ptr& object) const;
@@ -238,6 +314,9 @@ public:
MessageAutoDeleteTimerChanged::Ptr parseJsonAndGetMessageAutoDeleteTimerChanged(const boost::property_tree::ptree& data) const;
std::string parseMessageAutoDeleteTimerChanged(const MessageAutoDeleteTimerChanged::Ptr& object) const;
+ ChatBoostAdded::Ptr parseJsonAndGetChatBoostAdded(const boost::property_tree::ptree& data) const;
+ std::string parseChatBoostAdded(const ChatBoostAdded::Ptr& object) const;
+
ForumTopicCreated::Ptr parseJsonAndGetForumTopicCreated(const boost::property_tree::ptree& data) const;
std::string parseForumTopicCreated(const ForumTopicCreated::Ptr& object) const;
@@ -256,8 +335,11 @@ 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;
+ SharedUser::Ptr parseJsonAndGetSharedUser(const boost::property_tree::ptree& data) const;
+ std::string parseSharedUser(const SharedUser::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;
@@ -277,6 +359,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;
@@ -292,8 +389,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;
@@ -313,6 +410,9 @@ public:
LoginUrl::Ptr parseJsonAndGetLoginUrl(const boost::property_tree::ptree& data) const;
std::string parseLoginUrl(const LoginUrl::Ptr& object) const;
+ SwitchInlineQueryChosenChat::Ptr parseJsonAndGetSwitchInlineQueryChosenChat(const boost::property_tree::ptree& data) const;
+ std::string parseSwitchInlineQueryChosenChat(const SwitchInlineQueryChosenChat::Ptr& object) const;
+
CallbackQuery::Ptr parseJsonAndGetCallbackQuery(const boost::property_tree::ptree& data) const;
std::string parseCallbackQuery(const CallbackQuery::Ptr& object) const;
@@ -328,6 +428,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;
@@ -349,18 +452,48 @@ 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;
ChatPermissions::Ptr parseJsonAndGetChatPermissions(const boost::property_tree::ptree& data) const;
std::string parseChatPermissions(const ChatPermissions::Ptr& object) const;
+ Birthdate::Ptr parseJsonAndGetBirthdate(const boost::property_tree::ptree& data) const;
+ std::string parseBirthdate(const Birthdate::Ptr& object) const;
+
+ BusinessIntro::Ptr parseJsonAndGetBusinessIntro(const boost::property_tree::ptree& data) const;
+ std::string parseBusinessIntro(const BusinessIntro::Ptr& object) const;
+
+ BusinessLocation::Ptr parseJsonAndGetBusinessLocation(const boost::property_tree::ptree& data) const;
+ std::string parseBusinessLocation(const BusinessLocation::Ptr& object) const;
+
+ BusinessOpeningHoursInterval::Ptr parseJsonAndGetBusinessOpeningHoursInterval(const boost::property_tree::ptree& data) const;
+ std::string parseBusinessOpeningHoursInterval(const BusinessOpeningHoursInterval::Ptr& object) const;
+
+ BusinessOpeningHours::Ptr parseJsonAndGetBusinessOpeningHours(const boost::property_tree::ptree& data) const;
+ std::string parseBusinessOpeningHours(const BusinessOpeningHours::Ptr& object) const;
+
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;
@@ -391,6 +524,15 @@ public:
BotCommandScopeChatMember::Ptr parseJsonAndGetBotCommandScopeChatMember(const boost::property_tree::ptree& data) const;
std::string parseBotCommandScopeChatMember(const BotCommandScopeChatMember::Ptr& object) const;
+ BotName::Ptr parseJsonAndGetBotName(const boost::property_tree::ptree& data) const;
+ std::string parseBotName(const BotName::Ptr& object) const;
+
+ BotDescription::Ptr parseJsonAndGetBotDescription(const boost::property_tree::ptree& data) const;
+ std::string parseBotDescription(const BotDescription::Ptr& object) const;
+
+ BotShortDescription::Ptr parseJsonAndGetBotShortDescription(const boost::property_tree::ptree& data) const;
+ std::string parseBotShortDescription(const BotShortDescription::Ptr& object) const;
+
MenuButton::Ptr parseJsonAndGetMenuButton(const boost::property_tree::ptree& data) const;
std::string parseMenuButton(const MenuButton::Ptr& object) const;
@@ -403,6 +545,36 @@ 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;
+
+ BusinessConnection::Ptr parseJsonAndGetBusinessConnection(const boost::property_tree::ptree& data) const;
+ std::string parseBusinessConnection(const BusinessConnection::Ptr& object) const;
+
+ BusinessMessagesDeleted::Ptr parseJsonAndGetBusinessMessagesDeleted(const boost::property_tree::ptree& data) const;
+ std::string parseBusinessMessagesDeleted(const BusinessMessagesDeleted::Ptr& object) const;
+
ResponseParameters::Ptr parseJsonAndGetResponseParameters(const boost::property_tree::ptree& data) const;
std::string parseResponseParameters(const ResponseParameters::Ptr& object) const;
@@ -433,9 +605,15 @@ public:
MaskPosition::Ptr parseJsonAndGetMaskPosition(const boost::property_tree::ptree& data) const;
std::string parseMaskPosition(const MaskPosition::Ptr& object) const;
+ InputSticker::Ptr parseJsonAndGetInputSticker(const boost::property_tree::ptree& data) const;
+ std::string parseInputSticker(const InputSticker::Ptr& object) const;
+
InlineQuery::Ptr parseJsonAndGetInlineQuery(const boost::property_tree::ptree& data) const;
std::string parseInlineQuery(const InlineQuery::Ptr& object) const;
+ InlineQueryResultsButton::Ptr parseJsonAndGetInlineQueryResultsButton(const boost::property_tree::ptree& data) const;
+ std::string parseInlineQueryResultsButton(const InlineQueryResultsButton::Ptr& object) const;
+
InlineQueryResult::Ptr parseJsonAndGetInlineQueryResult(const boost::property_tree::ptree& data) const;
std::string parseInlineQueryResult(const InlineQueryResult::Ptr& object) const;
@@ -597,10 +775,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/Animation.h b/include/tgbot/types/Animation.h
index 8d9688f..104b3e4 100644
--- a/include/tgbot/types/Animation.h
+++ b/include/tgbot/types/Animation.h
@@ -47,7 +47,7 @@ public:
/**
* @brief Optional. Animation thumbnail as defined by sender
*/
- PhotoSize::Ptr thumb;
+ PhotoSize::Ptr thumbnail;
/**
* @brief Optional. Original animation filename as defined by sender
diff --git a/include/tgbot/types/Audio.h b/include/tgbot/types/Audio.h
index 5095e5c..1554735 100644
--- a/include/tgbot/types/Audio.h
+++ b/include/tgbot/types/Audio.h
@@ -66,7 +66,7 @@ public:
/**
* @brief Optional. Thumbnail of the album cover to which the music file belongs
*/
- PhotoSize::Ptr thumb;
+ PhotoSize::Ptr thumbnail;
};
}
diff --git a/include/tgbot/types/Birthdate.h b/include/tgbot/types/Birthdate.h
new file mode 100644
index 0000000..af481cc
--- /dev/null
+++ b/include/tgbot/types/Birthdate.h
@@ -0,0 +1,34 @@
+#ifndef TGBOT_BIRTHDATE_H
+#define TGBOT_BIRTHDATE_H
+
+#include <cstdint>
+#include <memory>
+
+namespace TgBot {
+
+/**
+ * @ingroup types
+ */
+class Birthdate {
+
+public:
+ typedef std::shared_ptr<Birthdate> Ptr;
+
+ /**
+ * @brief Day of the user's birth; 1-31
+ */
+ std::uint8_t day;
+
+ /**
+ * @brief Month of the user's birth; 1-12
+ */
+ std::uint8_t month;
+
+ /**
+ * @brief Optional. Year of the user's birth
+ */
+ std::uint16_t year;
+};
+}
+
+#endif //TGBOT_BIRTHDATE_H
diff --git a/include/tgbot/types/BotDescription.h b/include/tgbot/types/BotDescription.h
new file mode 100644
index 0000000..1c769a4
--- /dev/null
+++ b/include/tgbot/types/BotDescription.h
@@ -0,0 +1,25 @@
+#ifndef TGBOT_BOTDESCRIPTION_H
+#define TGBOT_BOTDESCRIPTION_H
+
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents the bot's description.
+ *
+ * @ingroup types
+ */
+class BotDescription {
+public:
+ typedef std::shared_ptr<BotDescription> Ptr;
+
+ /**
+ * @brief The bot's description
+ */
+ std::string description;
+};
+}
+
+#endif //TGBOT_BOTDESCRIPTION_H
diff --git a/include/tgbot/types/BotName.h b/include/tgbot/types/BotName.h
new file mode 100644
index 0000000..d89ee5c
--- /dev/null
+++ b/include/tgbot/types/BotName.h
@@ -0,0 +1,25 @@
+#ifndef TGBOT_BOTNAME_H
+#define TGBOT_BOTNAME_H
+
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents the bot's name.
+ *
+ * @ingroup types
+ */
+class BotName {
+public:
+ typedef std::shared_ptr<BotName> Ptr;
+
+ /**
+ * @brief The bot's name
+ */
+ std::string name;
+};
+}
+
+#endif //TGBOT_BOTNAME_H
diff --git a/include/tgbot/types/BotShortDescription.h b/include/tgbot/types/BotShortDescription.h
new file mode 100644
index 0000000..d3e33b3
--- /dev/null
+++ b/include/tgbot/types/BotShortDescription.h
@@ -0,0 +1,25 @@
+#ifndef TGBOT_BOTSHORTDESCRIPTION_H
+#define TGBOT_BOTSHORTDESCRIPTION_H
+
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents the bot's short description.
+ *
+ * @ingroup types
+ */
+class BotShortDescription {
+public:
+ typedef std::shared_ptr<BotShortDescription> Ptr;
+
+ /**
+ * @brief The bot's short description
+ */
+ std::string shortDescription;
+};
+}
+
+#endif //TGBOT_BOTSHORTDESCRIPTION_H
diff --git a/include/tgbot/types/BusinessConnection.h b/include/tgbot/types/BusinessConnection.h
new file mode 100644
index 0000000..349590b
--- /dev/null
+++ b/include/tgbot/types/BusinessConnection.h
@@ -0,0 +1,57 @@
+#ifndef TGBOT_BUSINESSCONNECTION_H
+#define TGBOT_BUSINESSCONNECTION_H
+
+#include "tgbot/types/User.h"
+
+#include <cstdint>
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * @brief Describes the connection of the bot with a business account.
+ *
+ * @ingroup types
+ */
+class BusinessConnection {
+
+public:
+ typedef std::shared_ptr<BusinessConnection> Ptr;
+
+ /**
+ * @brief Unique identifier of the business connection
+ */
+ std::string id;
+
+ /**
+ * @brief Business account user that created the business connection
+ */
+ User::Ptr user;
+
+ /**
+ * @brief Identifier of a private chat with the user who created the business connection.
+ *
+ * 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 userChatId;
+
+ /**
+ * @brief Date the connection was established in Unix time
+ */
+ std::uint32_t date;
+
+ /**
+ * @brief True, if the bot can act on behalf of the business account in chats that were active in the last 24 hours
+ */
+ bool canReply;
+
+ /**
+ * @brief True, if the connection is active
+ */
+ bool isEnabled;
+};
+}
+
+#endif //TGBOT_BUSINESSCONNECTION_H
diff --git a/include/tgbot/types/BusinessIntro.h b/include/tgbot/types/BusinessIntro.h
new file mode 100644
index 0000000..7631870
--- /dev/null
+++ b/include/tgbot/types/BusinessIntro.h
@@ -0,0 +1,36 @@
+#ifndef TGBOT_BUSINESSINTRO_H
+#define TGBOT_BUSINESSINTRO_H
+
+#include "tgbot/types/Sticker.h"
+
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * @ingroup types
+ */
+class BusinessIntro {
+
+public:
+ typedef std::shared_ptr<BusinessIntro> Ptr;
+
+ /**
+ * @brief Optional. Title text of the business intro
+ */
+ std::string title;
+
+ /**
+ * @brief Optional. Message text of the business intro
+ */
+ std::string message;
+
+ /**
+ * @brief Optional. Sticker of the business intro
+ */
+ Sticker::Ptr sticker;
+};
+}
+
+#endif //TGBOT_BUSINESSINTRO_H
diff --git a/include/tgbot/types/BusinessLocation.h b/include/tgbot/types/BusinessLocation.h
new file mode 100644
index 0000000..09137a5
--- /dev/null
+++ b/include/tgbot/types/BusinessLocation.h
@@ -0,0 +1,31 @@
+#ifndef TGBOT_BUSINESSLOCATION_H
+#define TGBOT_BUSINESSLOCATION_H
+
+#include "tgbot/types/Location.h"
+
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * @ingroup types
+ */
+class BusinessLocation {
+
+public:
+ typedef std::shared_ptr<BusinessLocation> Ptr;
+
+ /**
+ * @brief Address of the business
+ */
+ std::string address;
+
+ /**
+ * @brief Optional. Location of the business
+ */
+ Location::Ptr location;
+};
+}
+
+#endif //TGBOT_BUSINESSLOCATION_H
diff --git a/include/tgbot/types/BusinessMessagesDeleted.h b/include/tgbot/types/BusinessMessagesDeleted.h
new file mode 100644
index 0000000..ee22639
--- /dev/null
+++ b/include/tgbot/types/BusinessMessagesDeleted.h
@@ -0,0 +1,42 @@
+#ifndef TGBOT_BUSINESSMESSAGESDELETED_H
+#define TGBOT_BUSINESSMESSAGESDELETED_H
+
+#include "tgbot/types/Chat.h"
+
+#include <cstdint>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace TgBot {
+
+/**
+ * @brief This object is received when messages are deleted from a connected business account.
+ *
+ * @ingroup types
+ */
+class BusinessMessagesDeleted {
+
+public:
+ typedef std::shared_ptr<BusinessMessagesDeleted> Ptr;
+
+ /**
+ * @brief Unique identifier of the business connection
+ */
+ std::string businessConnectionId;
+
+ /**
+ * @brief Information about a chat in the business account.
+ *
+ * The bot may not have access to the chat or the corresponding user.
+ */
+ Chat::Ptr chat;
+
+ /**
+ * @brief A JSON-serialized list of identifiers of deleted messages in the chat of the business account
+ */
+ std::vector<std::int32_t> messageIds;
+};
+}
+
+#endif //TGBOT_BUSINESSMESSAGESDELETED_H
diff --git a/include/tgbot/types/BusinessOpeningHours.h b/include/tgbot/types/BusinessOpeningHours.h
new file mode 100644
index 0000000..94d7457
--- /dev/null
+++ b/include/tgbot/types/BusinessOpeningHours.h
@@ -0,0 +1,32 @@
+#ifndef TGBOT_BUSINESSOPENINGHOURS_H
+#define TGBOT_BUSINESSOPENINGHOURS_H
+
+#include "tgbot/types/BusinessOpeningHoursInterval.h"
+
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace TgBot {
+
+/**
+ * @ingroup types
+ */
+class BusinessOpeningHours {
+
+public:
+ typedef std::shared_ptr<BusinessOpeningHours> Ptr;
+
+ /**
+ * @brief Unique name of the time zone for which the opening hours are defined
+ */
+ std::string timeZoneName;
+
+ /**
+ * @brief List of time intervals describing business opening hours
+ */
+ std::vector<BusinessOpeningHoursInterval::Ptr> openingHours;
+};
+}
+
+#endif //TGBOT_BUSINESSOPENINGHOURS_H
diff --git a/include/tgbot/types/BusinessOpeningHoursInterval.h b/include/tgbot/types/BusinessOpeningHoursInterval.h
new file mode 100644
index 0000000..500e46d
--- /dev/null
+++ b/include/tgbot/types/BusinessOpeningHoursInterval.h
@@ -0,0 +1,29 @@
+#ifndef TGBOT_BUSINESSOPENINGHOURSINTERVAL_H
+#define TGBOT_BUSINESSOPENINGHOURSINTERVAL_H
+
+#include <cstdint>
+#include <memory>
+
+namespace TgBot {
+
+/**
+ * @ingroup types
+ */
+class BusinessOpeningHoursInterval {
+
+public:
+ typedef std::shared_ptr<BusinessOpeningHoursInterval> Ptr;
+
+ /**
+ * @brief The minute's sequence number in a week, starting on Monday, marking the start of the time interval during which the business is open; 0 - 7 * 24 * 60
+ */
+ std::int32_t openingMinute;
+
+ /**
+ * @brief The minute's sequence number in a week, starting on Monday, marking the end of the time interval during which the business is open; 0 - 8 * 24 * 60
+ */
+ std::int32_t closingMinute;
+};
+}
+
+#endif //TGBOT_BUSINESSOPENINGHOURSINTERVAL_H
diff --git a/include/tgbot/types/Chat.h b/include/tgbot/types/Chat.h
index 2401300..411c01d 100644
--- a/include/tgbot/types/Chat.h
+++ b/include/tgbot/types/Chat.h
@@ -2,6 +2,12 @@
#define TGBOT_CHAT_H
#include "tgbot/types/ChatPhoto.h"
+#include "tgbot/types/Birthdate.h"
+#include "tgbot/types/BusinessIntro.h"
+#include "tgbot/types/BusinessLocation.h"
+#include "tgbot/types/BusinessOpeningHours.h"
+#include "tgbot/types/Chat.h"
+#include "tgbot/types/ReactionType.h"
#include "tgbot/types/ChatPermissions.h"
#include "tgbot/types/ChatLocation.h"
@@ -33,7 +39,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,111 +71,199 @@ 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. For private chats, the date of birth of the user.
+ *
+ * Returned only in Api::getChat.
+ */
+ Birthdate::Ptr birthdate;
+
+ /**
+ * @brief Optional. For private chats with business accounts, the intro of the business.
+ *
+ * Returned only in Api::getChat.
+ */
+ BusinessIntro::Ptr businessIntro;
+
+ /**
+ * @brief Optional. For private chats with business accounts, the location of the business.
+ *
+ * Returned only in Api::getChat.
+ */
+ BusinessLocation::Ptr businessLocation;
+
+ /**
+ * @brief Optional. For private chats with business accounts, the opening hours of the business.
+ *
+ * Returned only in Api::getChat.
+ */
+ BusinessOpeningHours::Ptr businessOpeningHours;
+
+ /**
+ * @brief Optional. For private chats, the personal channel of the user.
+ *
+ * Returned only in Api::getChat.
+ */
+ Chat::Ptr personalChat;
+
+ /**
+ * @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 chat or the other party in a private chat, in Unix time, if any.
+ *
+ * Returned only in Api::getChat.
+ */
+ std::uint32_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.
- *
+ * @brief Optional. For supergroups, the minimum allowed delay between consecutive messages sent by each unprivileged user; in seconds.
+ *
* Returned only in Api::getChat.
*/
std::int32_t slowModeDelay;
/**
+ * @brief Optional. For supergroups, the minimum number of boosts that a non-administrator user needs to add in order to ignore slow mode and chat permissions.
+ *
+ * Returned only in Api::getChat.
+ */
+ std::int32_t unrestrictBoostCount;
+
+ /**
* @brief Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds.
- *
+ *
* Returned only in Api::getChat.
*/
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.
*/
@@ -177,35 +271,50 @@ 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. For supergroups, the name of the group's custom emoji sticker set.
+ *
+ * Custom emoji from this set can be used by all users and bots in the group.
+ * Returned only in Api::getChat.
+ */
+ std::string customEmojiStickerSetName;
+
+ /**
* @brief Optional. Unique identifier for the linked chat, i.e. the discussion group identifier for a channel and vice versa; for supergroups and channel chats.
- *
+ *
* This identifier may be greater than 32 bits and some programming languages may have difficulty/silent defects in interpreting it.
* 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.
@@ -214,7 +323,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 d2ee3e5..3836070 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,9 +21,9 @@ public:
bool isAnonymous;
/**
- * @brief True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode.
- *
- * Implied by any other administrator privilege
+ * @brief True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode.
+ *
+ * Implied by any other administrator privilege.
*/
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,22 +58,37 @@ public:
bool canInviteUsers;
/**
- * @brief Optional. True, if the administrator can post in the channel; channels only
+ * @brief True, if the administrator can post stories to the chat
+ */
+ bool canPostStories;
+
+ /**
+ * @brief True, if the administrator can edit stories posted by other users
+ */
+ bool canEditStories;
+
+ /**
+ * @brief True, if the administrator can delete stories posted by other users
+ */
+ bool canDeleteStories;
+
+ /**
+ * @brief Optional. True, if the administrator can post messages in the channel, or access channel statistics; for channels only
*/
bool canPostMessages;
/**
- * @brief Optional. True, if the administrator can edit messages of other users and can pin messages; channels only
+ * @brief Optional. True, if the administrator can edit messages of other users and can pin messages; for channels only
*/
bool canEditMessages;
/**
- * @brief Optional. True, if the user is allowed to pin messages; groups and supergroups only
+ * @brief Optional. True, if the user is allowed to pin messages; for groups and supergroups only
*/
bool canPinMessages;
/**
- * @brief Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only
+ * @brief Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only
*/
bool canManageTopics;
};
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/ChatBoostAdded.h b/include/tgbot/types/ChatBoostAdded.h
new file mode 100644
index 0000000..93a8796
--- /dev/null
+++ b/include/tgbot/types/ChatBoostAdded.h
@@ -0,0 +1,26 @@
+#ifndef TGBOT_CHATBOOSTADDED_H
+#define TGBOT_CHATBOOSTADDED_H
+
+#include <cstdint>
+#include <memory>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents a service message about a user boosting a chat.
+ *
+ * @ingroup types
+ */
+class ChatBoostAdded {
+
+public:
+ typedef std::shared_ptr<ChatBoostAdded> Ptr;
+
+ /**
+ * @brief Number of boosts added by the user
+ */
+ std::int32_t boostCount;
+};
+}
+
+#endif //TGBOT_CHATBOOSTADDED_H
diff --git a/include/tgbot/types/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..1fe13db
--- /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 Information 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 d100f85..d9f7a45 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,9 +35,9 @@ public:
bool isAnonymous;
/**
- * @brief True, if the administrator can access the chat event log, chat statistics, message statistics in channels, see channel members, see anonymous administrators in supergroups and ignore slow mode.
- *
- * Implied by any other administrator privilege
+ * @brief True, if the administrator can access the chat event log, get boost list, see hidden supergroup and channel members, report spam messages and ignore slow mode.
+ *
+ * Implied by any other administrator privilege.
*/
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,22 +72,37 @@ public:
bool canInviteUsers;
/**
- * @brief Optional. True, if the administrator can post in the channel; channels only
+ * @brief True, if the administrator can post stories to the chat
+ */
+ bool canPostStories;
+
+ /**
+ * @brief True, if the administrator can edit stories posted by other users
+ */
+ bool canEditStories;
+
+ /**
+ * @brief True, if the administrator can delete stories posted by other users
+ */
+ bool canDeleteStories;
+
+ /**
+ * @brief Optional. True, if the administrator can post messages in the channel, or access channel statistics; for channels only
*/
bool canPostMessages;
/**
- * @brief Optional. True, if the administrator can edit messages of other users and can pin messages; channels only
+ * @brief Optional. True, if the administrator can edit messages of other users and can pin messages; for channels only
*/
bool canEditMessages;
/**
- * @brief Optional. True, if the user is allowed to pin messages; groups and supergroups only
+ * @brief Optional. True, if the user is allowed to pin messages; for groups and supergroups only
*/
bool canPinMessages;
/**
- * @brief Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; supergroups only
+ * @brief Optional. True, if the user is allowed to create, rename, close, and reopen forum topics; for supergroups only
*/
bool canManageTopics;
diff --git a/include/tgbot/types/ChatMemberBanned.h b/include/tgbot/types/ChatMemberBanned.h
index 90ae93e..1e0f251 100644
--- a/include/tgbot/types/ChatMemberBanned.h
+++ b/include/tgbot/types/ChatMemberBanned.h
@@ -24,7 +24,9 @@ public:
}
/**
- * @brief Date when restrictions will be lifted for this user; unix time
+ * @brief Date when restrictions will be lifted for this user; Unix time.
+ *
+ * If 0, then the user is banned forever
*/
std::uint32_t untilDate;
};
diff --git a/include/tgbot/types/ChatMemberRestricted.h b/include/tgbot/types/ChatMemberRestricted.h
index cbc198b..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;
@@ -101,8 +102,8 @@ public:
bool canManageTopics;
/**
- * @brief Date when restrictions will be lifted for this user; unix time.
- *
+ * @brief Date when restrictions will be lifted for this user; Unix time.
+ *
* If 0, then the user is restricted forever
*/
std::uint32_t untilDate;
diff --git a/include/tgbot/types/ChatMemberUpdated.h b/include/tgbot/types/ChatMemberUpdated.h
index 9d8ce2b..b45efb1 100644
--- a/include/tgbot/types/ChatMemberUpdated.h
+++ b/include/tgbot/types/ChatMemberUpdated.h
@@ -1,11 +1,12 @@
-#ifndef TGBOT_CPP_CHATMEMBERUPDATED_H
-#define TGBOT_CPP_CHATMEMBERUPDATED_H
+#ifndef TGBOT_CHATMEMBERUPDATED_H
+#define TGBOT_CHATMEMBERUPDATED_H
#include "tgbot/types/Chat.h"
#include "tgbot/types/User.h"
#include "tgbot/types/ChatMember.h"
#include "tgbot/types/ChatInviteLink.h"
+#include <cstdint>
#include <memory>
namespace TgBot {
@@ -49,7 +50,12 @@ public:
* @brief Optional. Chat invite link, which was used by the user to join the chat; for joining by invite link events only.
*/
ChatInviteLink::Ptr inviteLink;
+
+ /**
+ * @brief Optional. True, if the user joined the chat via a chat folder invite link
+ */
+ bool viaChatFolderInviteLink;
};
}
-#endif //TGBOT_CPP_CHATMEMBERUPDATED_H
+#endif //TGBOT_CHATMEMBERUPDATED_H
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/ChatShared.h b/include/tgbot/types/ChatShared.h
index 14b1566..6d410d3 100644
--- a/include/tgbot/types/ChatShared.h
+++ b/include/tgbot/types/ChatShared.h
@@ -1,17 +1,21 @@
#ifndef TGBOT_CHATSHARED_H
#define TGBOT_CHATSHARED_H
+#include "tgbot/types/PhotoSize.h"
+
#include <cstdint>
#include <memory>
+#include <string>
+#include <vector>
namespace TgBot {
/**
- * @brief This object contains information about the chat whose identifier was shared with the bot using a KeyboardButtonRequestChat button.
+ * @brief This object contains information about a chat that was shared with the bot using a KeyboardButtonRequestChat button.
*
* @ingroup types
*/
-class ChatShared {
+class ChatShared {
public:
typedef std::shared_ptr<ChatShared> Ptr;
@@ -23,13 +27,28 @@ public:
/**
* @brief Identifier of the shared chat.
- *
+ *
* The bot may not have access to the chat and could be unable to use this identifier, unless the chat 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;
+ std::int64_t chatId;
+
+ /**
+ * @brief Optional. Title of the chat, if the title was requested by the bot.
+ */
+ std::string title;
+
+ /**
+ * @brief Optional. Username of the chat, if the username was requested by the bot and available.
+ */
+ std::string username;
+
+ /**
+ * @brief Optional. Available sizes of the chat photo, if the photo was requested by the bot
+ */
+ std::vector<PhotoSize::Ptr> photo;
};
}
diff --git a/include/tgbot/types/Document.h b/include/tgbot/types/Document.h
index 0593076..c42fe9a 100644
--- a/include/tgbot/types/Document.h
+++ b/include/tgbot/types/Document.h
@@ -33,7 +33,7 @@ public:
/**
* @brief Optional. Document thumbnail as defined by sender
*/
- PhotoSize::Ptr thumb;
+ PhotoSize::Ptr thumbnail;
/**
* @brief Optional. Original filename as defined by sender
diff --git a/include/tgbot/types/EncryptedPassportElement.h b/include/tgbot/types/EncryptedPassportElement.h
index 3557f27..4547fd5 100644
--- a/include/tgbot/types/EncryptedPassportElement.h
+++ b/include/tgbot/types/EncryptedPassportElement.h
@@ -1,5 +1,5 @@
-#ifndef TGBOT_CPP_ENCRYPTEDPASSPORTELEMENT_H
-#define TGBOT_CPP_ENCRYPTEDPASSPORTELEMENT_H
+#ifndef TGBOT_ENCRYPTEDPASSPORTELEMENT_H
+#define TGBOT_ENCRYPTEDPASSPORTELEMENT_H
#include "tgbot/types/PassportFile.h"
@@ -10,7 +10,7 @@
namespace TgBot {
/**
- * @brief Contains information about documents or other Telegram Passport elements shared with the bot by the user.
+ * @brief Describes documents or other Telegram Passport elements shared with the bot by the user.
*
* @ingroup types
*/
@@ -20,65 +20,67 @@ public:
typedef std::shared_ptr<EncryptedPassportElement> Ptr;
/**
- * @brief Element type.
- * One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”.
+ * @brief Element type. One of “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport”, “address”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration”, “temporary_registration”, “phone_number”, “email”.
*/
std::string type;
/**
- * @brief Optional. Base64-encoded encrypted Telegram Passport element data provided by the user, available for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types.
- * Can be decrypted and verified using the accompanying @ref EncryptedCredentials.
+ * @brief Optional. Base64-encoded encrypted Telegram Passport element data provided by the user; available only for “personal_details”, “passport”, “driver_license”, “identity_card”, “internal_passport” and “address” types.
+ *
+ * Can be decrypted and verified using the accompanying EncryptedCredentials.
*/
std::string data;
/**
- * @brief Optional. User's verified phone number, available only for “phone_number” type
+ * @brief Optional. User's verified phone number; available only for “phone_number” type
*/
std::string phoneNumber;
/**
- * @brief Optional. User's verified email address, available only for “email” type
+ * @brief Optional. User's verified email address; available only for “email” type
*/
std::string email;
/**
- * @brief Optional. Array of encrypted files with documents provided by the user, available for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types.
- * Files can be decrypted and verified using the accompanying @ref EncryptedCredentials.
+ * @brief Optional. Array of encrypted files with documents provided by the user; available only for “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types.
+ *
+ * Files can be decrypted and verified using the accompanying EncryptedCredentials.
*/
std::vector<PassportFile::Ptr> files;
/**
- * @brief Optional. Encrypted file with the front side of the document, provided by the user.
- * Available for “passport”, “driver_license”, “identity_card” and “internal_passport”.
- * The file can be decrypted and verified using the accompanying @ref EncryptedCredentials.
+ * @brief Optional. Encrypted file with the front side of the document, provided by the user; available only for “passport”, “driver_license”, “identity_card” and “internal_passport”.
+ *
+ * The file can be decrypted and verified using the accompanying EncryptedCredentials.
*/
PassportFile::Ptr frontSide;
/**
- * @brief Optional. Encrypted file with the reverse side of the document, provided by the user.
- * Available for “driver_license” and “identity_card”.
- * The file can be decrypted and verified using the accompanying @ref EncryptedCredentials.
+ * @brief Optional. Encrypted file with the reverse side of the document, provided by the user; available only for “driver_license” and “identity_card”.
+ *
+ * The file can be decrypted and verified using the accompanying EncryptedCredentials.
*/
PassportFile::Ptr reverseSide;
/**
- * @brief Optional. Encrypted file with the selfie of the user holding a document, provided by the user; available for “passport”, “driver_license”, “identity_card” and “internal_passport”.
- * The file can be decrypted and verified using the accompanying @ref EncryptedCredentials.
+ * @brief Optional. Encrypted file with the selfie of the user holding a document, provided by the user; available if requested for “passport”, “driver_license”, “identity_card” and “internal_passport”.
+ *
+ * The file can be decrypted and verified using the accompanying EncryptedCredentials.
*/
PassportFile::Ptr selfie;
/**
- * @brief Optional. Array of encrypted files with translated versions of documents provided by the user.
- * Available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types.
- * Files can be decrypted and verified using the accompanying @ref EncryptedCredentials.
+ * @brief Optional. Array of encrypted files with translated versions of documents provided by the user; available if requested for “passport”, “driver_license”, “identity_card”, “internal_passport”, “utility_bill”, “bank_statement”, “rental_agreement”, “passport_registration” and “temporary_registration” types.
+ *
+ * Files can be decrypted and verified using the accompanying EncryptedCredentials.
*/
std::vector<PassportFile::Ptr> translation;
/**
- * @brief Base64-encoded element hash for using in @ref PassportElementErrorUnspecified
+ * @brief Base64-encoded element hash for using in PassportElementErrorUnspecified
*/
std::string hash;
};
}
-#endif //TGBOT_CPP_ENCRYPTEDPASSPORTELEMENT_H
+#endif //TGBOT_ENCRYPTEDPASSPORTELEMENT_H
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..131e1cb 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.
+ *
+ * Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message.
*/
- bool selective = 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..05d02f1
--- /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 message 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/InlineKeyboardButton.h b/include/tgbot/types/InlineKeyboardButton.h
index f216669..c71b5db 100644
--- a/include/tgbot/types/InlineKeyboardButton.h
+++ b/include/tgbot/types/InlineKeyboardButton.h
@@ -3,6 +3,7 @@
#include "tgbot/types/WebAppInfo.h"
#include "tgbot/types/LoginUrl.h"
+#include "tgbot/types/SwitchInlineQueryChosenChat.h"
#include "tgbot/types/CallbackGame.h"
#include <memory>
@@ -12,11 +13,13 @@ namespace TgBot {
/**
* @brief This object represents one button of an inline keyboard.
+ *
* You must use exactly one of the optional fields.
*
* @ingroup types
*/
class InlineKeyboardButton {
+
public:
typedef std::shared_ptr<InlineKeyboardButton> Ptr;
@@ -27,17 +30,19 @@ public:
/**
* @brief Optional. HTTP or tg:// URL to be opened when the button is pressed.
- * Links tg://user?id=<user_id> can be used to mention a user by their ID without using a username, if this is allowed by their privacy settings.
+ *
+ * Links tg://user?id=<user_id> can be used to mention a user by their identifier without using a username, if this is allowed by their privacy settings.
*/
std::string url;
/**
- * @brief Optional. Data to be sent in a callback query to the bot when button is pressed, 1-64 bytes
+ * @brief Optional. Data to be sent in a [callback query](https://core.telegram.org/bots/api#callbackquery) to the bot when button is pressed, 1-64 bytes
*/
std::string callbackData;
/**
- * @brief Optional. Description of the Web App that will be launched when the user presses the button.
+ * @brief Optional. Description of the [Web App](https://core.telegram.org/bots/webapps) that will be launched when the user presses the button.
+ *
* The Web App will be able to send an arbitrary message on behalf of the user using the method Api::answerWebAppQuery.
* Available only in private chats between a user and the bot.
*/
@@ -45,28 +50,32 @@ public:
/**
* @brief Optional. An HTTPS URL used to automatically authorize the user.
- * Can be used as a replacement for the Telegram Login Widget.
+ *
+ * Can be used as a replacement for the [Telegram Login Widget](https://core.telegram.org/widgets/login).
*/
LoginUrl::Ptr loginUrl;
/**
* @brief Optional. If set, pressing the button will prompt the user to select one of their chats, open that chat and insert the bot's username and the specified inline query in the input field.
- * May be empty, in which case just the bot's username will be inserted.
*
- * Note: This offers an easy way for users to start using your bot in inline mode when they are currently in a private chat with it.
- * Especially useful when combined with switch_pm… actions - in this case the user will be automatically returned to the chat they switched from, skipping the chat selection screen.
+ * May be empty, in which case just the bot's username will be inserted.
*/
std::string switchInlineQuery;
/**
* @brief Optional. If set, pressing the button will insert the bot's username and the specified inline query in the current chat's input field.
+ *
* May be empty, in which case only the bot's username will be inserted.
- *
* This offers a quick way for the user to open your bot in inline mode in the same chat - good for selecting something from multiple options.
*/
std::string switchInlineQueryCurrentChat;
/**
+ * @brief Optional. If set, pressing the button will prompt the user to select one of their chats of the specified type, open that chat and insert the bot's username and the specified inline query in the input field
+ */
+ SwitchInlineQueryChosenChat::Ptr switchInlineQueryChosenChat;
+
+ /**
* @brief Optional. Description of the game that will be launched when the user presses the button.
*
* NOTE: This type of button must always be the first button in the first row.
@@ -74,7 +83,7 @@ public:
CallbackGame::Ptr callbackGame;
/**
- * @brief Optional. Specify True, to send a Pay button.
+ * @brief Optional. Specify True, to send a [Pay button](https://core.telegram.org/bots/api#payments).
*
* NOTE: This type of button must always be the first button in the first row and can only be used in invoice messages.
*/
diff --git a/include/tgbot/types/InlineKeyboardMarkup.h b/include/tgbot/types/InlineKeyboardMarkup.h
index 6496aee..13466c5 100644
--- a/include/tgbot/types/InlineKeyboardMarkup.h
+++ b/include/tgbot/types/InlineKeyboardMarkup.h
@@ -10,16 +10,17 @@
namespace TgBot {
/**
- * @brief This object represents an inline keyboard that appears right next to the message it belongs to.
+ * @brief This object represents an [inline keyboard](https://core.telegram.org/bots/features#inline-keyboards) that appears right next to the message it belongs to.
*
* @ingroup types
*/
class InlineKeyboardMarkup : public GenericReply {
+
public:
typedef std::shared_ptr<InlineKeyboardMarkup> Ptr;
/**
- * @brief Array of button rows, each represented by an Array of InlineKeyboardButton objects.
+ * @brief Array of button rows, each represented by an Array of InlineKeyboardButton objects
*/
std::vector<std::vector<InlineKeyboardButton::Ptr>> inlineKeyboard;
diff --git a/include/tgbot/types/InlineQueryResult.h b/include/tgbot/types/InlineQueryResult.h
index dec086e..e204971 100644
--- a/include/tgbot/types/InlineQueryResult.h
+++ b/include/tgbot/types/InlineQueryResult.h
@@ -9,13 +9,36 @@
namespace TgBot {
/**
- * @brief This abstract class is base of all inline query results.
- *
- * This object represents one result of an inline query.
+ * @brief This object represents one result of an inline query.
+ *
+ * Telegram clients currently support results of the following 20 types:
+ * - InlineQueryResultCachedAudio
+ * - InlineQueryResultCachedDocument
+ * - InlineQueryResultCachedGif
+ * - InlineQueryResultCachedMpeg4Gif
+ * - InlineQueryResultCachedPhoto
+ * - InlineQueryResultCachedSticker
+ * - InlineQueryResultCachedVideo
+ * - InlineQueryResultCachedVoice
+ * - InlineQueryResultArticle
+ * - InlineQueryResultAudio
+ * - InlineQueryResultContact
+ * - InlineQueryResultGame
+ * - InlineQueryResultDocument
+ * - InlineQueryResultGif
+ * - InlineQueryResultLocation
+ * - InlineQueryResultMpeg4Gif
+ * - InlineQueryResultPhoto
+ * - InlineQueryResultVenue
+ * - InlineQueryResultVideo
+ * - InlineQueryResultVoice
+ *
+ * Note: All URLs passed in inline query results will be available to end users and therefore must be assumed to be public.
*
* @ingroup types
*/
class InlineQueryResult {
+
public:
typedef std::shared_ptr<InlineQueryResult> Ptr;
@@ -34,7 +57,7 @@ public:
std::string id;
/**
- * @brief Optional. Inline keyboard attached to the message
+ * @brief Optional. [Inline keyboard](https://core.telegram.org/bots/features#inline-keyboards) attached to the message
*/
InlineKeyboardMarkup::Ptr replyMarkup;
};
diff --git a/include/tgbot/types/InlineQueryResultArticle.h b/include/tgbot/types/InlineQueryResultArticle.h
index 509a8d2..5f61f17 100644
--- a/include/tgbot/types/InlineQueryResultArticle.h
+++ b/include/tgbot/types/InlineQueryResultArticle.h
@@ -53,17 +53,17 @@ public:
/**
* @brief Optional. Url of the thumbnail for the result
*/
- std::string thumbUrl;
+ std::string thumbnailUrl;
/**
* @brief Optional. Thumbnail width
*/
- std::int32_t thumbWidth;
+ std::int32_t thumbnailWidth;
/**
* @brief Optional. Thumbnail height
*/
- std::int32_t thumbHeight;
+ std::int32_t thumbnailHeight;
};
}
diff --git a/include/tgbot/types/InlineQueryResultAudio.h b/include/tgbot/types/InlineQueryResultAudio.h
index 7925c28..e4324d3 100644
--- a/include/tgbot/types/InlineQueryResultAudio.h
+++ b/include/tgbot/types/InlineQueryResultAudio.h
@@ -6,19 +6,22 @@
#include "tgbot/types/InputMessageContent.h"
#include <cstdint>
-#include <string>
#include <memory>
+#include <string>
+#include <vector>
namespace TgBot {
/**
* @brief Represents a link to an MP3 audio file.
+ *
* By default, this audio file will be sent by the user.
* Alternatively, you can use inputMessageContent to send a message with the specified content instead of the audio.
*
* @ingroup types
*/
class InlineQueryResultAudio : public InlineQueryResult {
+
public:
static const std::string TYPE;
@@ -45,7 +48,8 @@ public:
/**
* @brief Optional. Mode for parsing entities in the audio caption.
- * See https://core.telegram.org/bots/api#formatting-options for more details.
+ *
+ * See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
*/
std::string parseMode;
@@ -55,13 +59,13 @@ public:
std::vector<MessageEntity::Ptr> captionEntities;
/**
- * @brief Optional. Performer
- */
+ * @brief Optional. Performer
+ */
std::string performer;
/**
- * @brief Optional. Audio duration in seconds
- */
+ * @brief Optional. Audio duration in seconds
+ */
std::int32_t audioDuration;
/**
diff --git a/include/tgbot/types/InlineQueryResultCachedAudio.h b/include/tgbot/types/InlineQueryResultCachedAudio.h
index d26534b..303f4a0 100644
--- a/include/tgbot/types/InlineQueryResultCachedAudio.h
+++ b/include/tgbot/types/InlineQueryResultCachedAudio.h
@@ -5,20 +5,22 @@
#include "tgbot/types/MessageEntity.h"
#include "tgbot/types/InputMessageContent.h"
-#include <string>
#include <memory>
+#include <string>
#include <vector>
namespace TgBot {
/**
* @brief Represents a link to an MP3 audio file stored on the Telegram servers.
+ *
* By default, this audio file will be sent by the user.
* Alternatively, you can use inputMessageContent to send a message with the specified content instead of the audio.
*
* @ingroup types
*/
class InlineQueryResultCachedAudio : public InlineQueryResult {
+
public:
static const std::string TYPE;
@@ -40,7 +42,8 @@ public:
/**
* @brief Optional. Mode for parsing entities in the audio caption.
- * See https://core.telegram.org/bots/api#formatting-options for more details.
+ *
+ * See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
*/
std::string parseMode;
diff --git a/include/tgbot/types/InlineQueryResultCachedDocument.h b/include/tgbot/types/InlineQueryResultCachedDocument.h
index 4b3b42f..950369d 100644
--- a/include/tgbot/types/InlineQueryResultCachedDocument.h
+++ b/include/tgbot/types/InlineQueryResultCachedDocument.h
@@ -5,20 +5,22 @@
#include "tgbot/types/MessageEntity.h"
#include "tgbot/types/InputMessageContent.h"
-#include <string>
#include <memory>
+#include <string>
#include <vector>
namespace TgBot {
/**
* @brief Represents a link to a file stored on the Telegram servers.
+ *
* By default, this file will be sent by the user with an optional caption.
* Alternatively, you can use inputMessageContent to send a message with the specified content instead of the file.
*
* @ingroup types
*/
class InlineQueryResultCachedDocument : public InlineQueryResult {
+
public:
static const std::string TYPE;
@@ -50,7 +52,8 @@ public:
/**
* @brief Optional. Mode for parsing entities in the document caption.
- * See https://core.telegram.org/bots/api#formatting-options for more details.
+ *
+ * See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
*/
std::string parseMode;
diff --git a/include/tgbot/types/InlineQueryResultCachedSticker.h b/include/tgbot/types/InlineQueryResultCachedSticker.h
index 40d82f6..d566446 100644
--- a/include/tgbot/types/InlineQueryResultCachedSticker.h
+++ b/include/tgbot/types/InlineQueryResultCachedSticker.h
@@ -4,19 +4,21 @@
#include "tgbot/types/InlineQueryResult.h"
#include "tgbot/types/InputMessageContent.h"
-#include <string>
#include <memory>
+#include <string>
namespace TgBot {
/**
* @brief Represents a link to a sticker stored on the Telegram servers.
+ *
* By default, this sticker will be sent by the user.
* Alternatively, you can use inputMessageContent to send a message with the specified content instead of the sticker.
*
* @ingroup types
*/
class InlineQueryResultCachedSticker : public InlineQueryResult {
+
public:
static const std::string TYPE;
diff --git a/include/tgbot/types/InlineQueryResultCachedVoice.h b/include/tgbot/types/InlineQueryResultCachedVoice.h
index ec21f43..1a14df3 100644
--- a/include/tgbot/types/InlineQueryResultCachedVoice.h
+++ b/include/tgbot/types/InlineQueryResultCachedVoice.h
@@ -5,20 +5,22 @@
#include "tgbot/types/MessageEntity.h"
#include "tgbot/types/InputMessageContent.h"
-#include <string>
#include <memory>
+#include <string>
#include <vector>
namespace TgBot {
/**
* @brief Represents a link to a voice message stored on the Telegram servers.
+ *
* By default, this voice message will be sent by the user.
* Alternatively, you can use inputMessageContent to send a message with the specified content instead of the voice message.
*
* @ingroup types
*/
class InlineQueryResultCachedVoice : public InlineQueryResult {
+
public:
static const std::string TYPE;
@@ -34,7 +36,7 @@ public:
std::string voiceFileId;
/**
- * @brief Voice message title
+ * @brief Voice message title
*/
std::string title;
@@ -45,7 +47,8 @@ public:
/**
* @brief Optional. Mode for parsing entities in the voice message caption.
- * See https://core.telegram.org/bots/api#formatting-options for more details.
+ *
+ * See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
*/
std::string parseMode;
diff --git a/include/tgbot/types/InlineQueryResultContact.h b/include/tgbot/types/InlineQueryResultContact.h
index 32894c9..1773ade 100644
--- a/include/tgbot/types/InlineQueryResultContact.h
+++ b/include/tgbot/types/InlineQueryResultContact.h
@@ -5,19 +5,21 @@
#include "tgbot/types/InputMessageContent.h"
#include <cstdint>
-#include <string>
#include <memory>
+#include <string>
namespace TgBot {
/**
* @brief Represents a contact with a phone number.
+ *
* By default, this contact will be sent by the user.
* Alternatively, you can use inputMessageContent to send a message with the specified content instead of the contact.
*
* @ingroup types
*/
class InlineQueryResultContact : public InlineQueryResult {
+
public:
static const std::string TYPE;
@@ -43,7 +45,7 @@ public:
std::string lastName;
/**
- * @brief Optional. Additional data about the contact in the form of a vCard, 0-2048 bytes
+ * @brief Optional. Additional data about the contact in the form of a [vCard](https://en.wikipedia.org/wiki/VCard), 0-2048 bytes
*/
std::string vcard;
@@ -53,19 +55,19 @@ public:
InputMessageContent::Ptr inputMessageContent;
/**
- * @brief Optional. Url of the thumbnail for the result
- */
- std::string thumbUrl;
+ * @brief Optional. Url of the thumbnail for the result
+ */
+ std::string thumbnailUrl;
/**
- * @brief Optional. Thumbnail width
- */
- std::int32_t thumbWidth;
+ * @brief Optional. Thumbnail width
+ */
+ std::int32_t thumbnailWidth;
/**
- * @brief Optinal. Thumbnail height
- */
- std::int32_t thumbHeight;
+ * @brief Optional. Thumbnail height
+ */
+ std::int32_t thumbnailHeight;
};
}
diff --git a/include/tgbot/types/InlineQueryResultDocument.h b/include/tgbot/types/InlineQueryResultDocument.h
index 9e6758c..32f27c4 100644
--- a/include/tgbot/types/InlineQueryResultDocument.h
+++ b/include/tgbot/types/InlineQueryResultDocument.h
@@ -6,14 +6,15 @@
#include "tgbot/types/InputMessageContent.h"
#include <cstdint>
-#include <string>
#include <memory>
+#include <string>
#include <vector>
namespace TgBot {
/**
* @brief Represents a link to a file.
+ *
* By default, this file will be sent by the user with an optional caption.
* Alternatively, you can use inputMessageContent to send a message with the specified content instead of the file.
* Currently, only .PDF and .ZIP files can be sent using this method.
@@ -21,6 +22,7 @@ namespace TgBot {
* @ingroup types
*/
class InlineQueryResultDocument : public InlineQueryResult {
+
public:
static const std::string TYPE;
@@ -42,7 +44,8 @@ public:
/**
* @brief Optional. Mode for parsing entities in the document caption.
- * See https://core.telegram.org/bots/api#formatting-options for more details.
+ *
+ * See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
*/
std::string parseMode;
@@ -57,7 +60,7 @@ public:
std::string documentUrl;
/**
- * @brief Mime type of the content of the file, either “application/pdf” or “application/zip”
+ * @brief MIME type of the content of the file, either “application/pdf” or “application/zip”
*/
std::string mimeType;
@@ -72,19 +75,19 @@ public:
InputMessageContent::Ptr inputMessageContent;
/**
- * @brief Optional. URL of the thumbnail (jpeg only) for the file
- */
- std::string thumbUrl;
+ * @brief Optional. URL of the thumbnail (JPEG only) for the file
+ */
+ std::string thumbnailUrl;
/**
- * @brief Optional. Thumbnail width
- */
- std::int32_t thumbWidth;
+ * @brief Optional. Thumbnail width
+ */
+ std::int32_t thumbnailWidth;
/**
- * @brief Optinal. Thumbnail height
- */
- std::int32_t thumbHeight;
+ * @brief Optional. Thumbnail height
+ */
+ std::int32_t thumbnailHeight;
};
}
diff --git a/include/tgbot/types/InlineQueryResultGame.h b/include/tgbot/types/InlineQueryResultGame.h
index 7cee282..0a56c22 100644
--- a/include/tgbot/types/InlineQueryResultGame.h
+++ b/include/tgbot/types/InlineQueryResultGame.h
@@ -3,8 +3,8 @@
#include "tgbot/types/InlineQueryResult.h"
-#include <string>
#include <memory>
+#include <string>
namespace TgBot {
@@ -14,6 +14,7 @@ namespace TgBot {
* @ingroup types
*/
class InlineQueryResultGame : public InlineQueryResult {
+
public:
static const std::string TYPE;
diff --git a/include/tgbot/types/InlineQueryResultGif.h b/include/tgbot/types/InlineQueryResultGif.h
index 05abe36..a5115c9 100644
--- a/include/tgbot/types/InlineQueryResultGif.h
+++ b/include/tgbot/types/InlineQueryResultGif.h
@@ -53,13 +53,13 @@ public:
/**
* @brief URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result
*/
- std::string thumbUrl;
+ std::string thumbnailUrl;
/**
* @brief Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”.
* Defaults to “image/jpeg”
*/
- std::string thumbMimeType;
+ std::string thumbnailMimeType;
/**
* @brief Optional. Title for the result
diff --git a/include/tgbot/types/InlineQueryResultLocation.h b/include/tgbot/types/InlineQueryResultLocation.h
index a72350a..cf2f1e0 100644
--- a/include/tgbot/types/InlineQueryResultLocation.h
+++ b/include/tgbot/types/InlineQueryResultLocation.h
@@ -5,19 +5,21 @@
#include "tgbot/types/InputMessageContent.h"
#include <cstdint>
-#include <string>
#include <memory>
+#include <string>
namespace TgBot {
/**
* @brief Represents a location on a map.
+ *
* By default, the location will be sent by the user.
* Alternatively, you can use inputMessageContent to send a message with the specified content instead of the location.
*
* @ingroup types
*/
class InlineQueryResultLocation : public InlineQueryResult {
+
public:
static const std::string TYPE;
@@ -28,13 +30,13 @@ public:
}
/**
- * @brief Location latitude in degrees
- */
+ * @brief Location latitude in degrees
+ */
float latitude;
/**
- * @brief Location longitude in degrees
- */
+ * @brief Location longitude in degrees
+ */
float longitude;
/**
@@ -43,23 +45,25 @@ public:
std::string title;
/**
- * @brief Optional. The radius of uncertainty for the location, measured in meters; 0-1500
- */
+ * @brief Optional. The radius of uncertainty for the location, measured in meters; 0-1500
+ */
float horizontalAccuracy;
/**
- * @brief Optional. Period in seconds for which the location can be updated, should be between 60 and 86400.
- */
+ * @brief Optional. Period in seconds for which the location can be updated, should be between 60 and 86400.
+ */
std::int32_t livePeriod;
/**
* @brief Optional. For live locations, a direction in which the user is moving, in degrees.
+ *
* Must be between 1 and 360 if specified.
*/
std::int32_t heading;
/**
* @brief Optional. For live locations, a maximum distance for proximity alerts about approaching another chat member, in meters.
+ *
* Must be between 1 and 100000 if specified.
*/
std::int32_t proximityAlertRadius;
@@ -72,17 +76,17 @@ public:
/**
* @brief Optional. Url of the thumbnail for the result
*/
- std::string thumbUrl;
+ std::string thumbnailUrl;
/**
* @brief Optional. Thumbnail width
*/
- std::int32_t thumbWidth;
+ std::int32_t thumbnailWidth;
/**
- * @brief Optinal. Thumbnail height
+ * @brief Optional. Thumbnail height
*/
- std::int32_t thumbHeight;
+ std::int32_t thumbnailHeight;
};
}
diff --git a/include/tgbot/types/InlineQueryResultMpeg4Gif.h b/include/tgbot/types/InlineQueryResultMpeg4Gif.h
index 7543c00..cf6aed4 100644
--- a/include/tgbot/types/InlineQueryResultMpeg4Gif.h
+++ b/include/tgbot/types/InlineQueryResultMpeg4Gif.h
@@ -53,13 +53,13 @@ public:
/**
* @brief URL of the static (JPEG or GIF) or animated (MPEG4) thumbnail for the result
*/
- std::string thumbUrl;
+ std::string thumbnailUrl;
/**
* @brief Optional. MIME type of the thumbnail, must be one of “image/jpeg”, “image/gif”, or “video/mp4”.
* Defaults to “image/jpeg”
*/
- std::string thumbMimeType;
+ std::string thumbnailMimeType;
/**
* @brief Optional. Title for the result
diff --git a/include/tgbot/types/InlineQueryResultPhoto.h b/include/tgbot/types/InlineQueryResultPhoto.h
index b6ecd76..45e855e 100644
--- a/include/tgbot/types/InlineQueryResultPhoto.h
+++ b/include/tgbot/types/InlineQueryResultPhoto.h
@@ -39,7 +39,7 @@ public:
/**
* @brief URL of the thumbnail for the photo
*/
- std::string thumbUrl;
+ std::string thumbnailUrl;
/**
* @brief Optional. Width of the photo
diff --git a/include/tgbot/types/InlineQueryResultVenue.h b/include/tgbot/types/InlineQueryResultVenue.h
index 7a93591..8fc4ef8 100644
--- a/include/tgbot/types/InlineQueryResultVenue.h
+++ b/include/tgbot/types/InlineQueryResultVenue.h
@@ -5,19 +5,21 @@
#include "tgbot/types/InputMessageContent.h"
#include <cstdint>
-#include <string>
#include <memory>
+#include <string>
namespace TgBot {
/**
* @brief Represents a venue.
+ *
* By default, the venue will be sent by the user.
* Alternatively, you can use inputMessageContent to send a message with the specified content instead of the venue.
*
* @ingroup types
*/
class InlineQueryResultVenue : public InlineQueryResult {
+
public:
static const std::string TYPE;
@@ -28,13 +30,13 @@ public:
}
/**
- * @brief Latitude of the venue location in degrees
- */
+ * @brief Latitude of the venue location in degrees
+ */
float latitude;
/**
- * @brief Longitude of the venue location in degrees
- */
+ * @brief Longitude of the venue location in degrees
+ */
float longitude;
/**
@@ -43,29 +45,31 @@ public:
std::string title;
/**
- * @brief Address of the venue
- */
+ * @brief Address of the venue
+ */
std::string address;
/**
- * @brief Optional. Foursquare identifier of the venue if known
- */
+ * @brief Optional. Foursquare identifier of the venue if known
+ */
std::string foursquareId;
/**
* @brief Optional. Foursquare type of the venue, if known.
+ *
* (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.)
*/
std::string foursquareType;
/**
- * @brief Optional. Google Places identifier of the venue
- */
+ * @brief Optional. Google Places identifier of the venue
+ */
std::string googlePlaceId;
/**
* @brief Optional. Google Places type of the venue.
- * (See https://developers.google.com/places/web-service/supported_types.)
+ *
+ * (See [supported types](https://developers.google.com/places/web-service/supported_types).)
*/
std::string googlePlaceType;
@@ -77,17 +81,17 @@ public:
/**
* @brief Optional. Url of the thumbnail for the result
*/
- std::string thumbUrl;
+ std::string thumbnailUrl;
/**
* @brief Optional. Thumbnail width
*/
- std::int32_t thumbWidth;
+ std::int32_t thumbnailWidth;
/**
- * @brief Optinal. Thumbnail height
+ * @brief Optional. Thumbnail height
*/
- std::int32_t thumbHeight;
+ std::int32_t thumbnailHeight;
};
}
diff --git a/include/tgbot/types/InlineQueryResultVideo.h b/include/tgbot/types/InlineQueryResultVideo.h
index ead6303..7235058 100644
--- a/include/tgbot/types/InlineQueryResultVideo.h
+++ b/include/tgbot/types/InlineQueryResultVideo.h
@@ -44,7 +44,7 @@ public:
/**
* @brief URL of the thumbnail (jpeg only) for the video
*/
- std::string thumbUrl;
+ std::string thumbnailUrl;
/**
* @brief Title for the result
diff --git a/include/tgbot/types/InlineQueryResultVoice.h b/include/tgbot/types/InlineQueryResultVoice.h
index 335c2a7..e64b7fb 100644
--- a/include/tgbot/types/InlineQueryResultVoice.h
+++ b/include/tgbot/types/InlineQueryResultVoice.h
@@ -14,12 +14,14 @@ namespace TgBot {
/**
* @brief Represents a link to a voice recording in an .OGG container encoded with OPUS.
+ *
* By default, this voice recording will be sent by the user.
* Alternatively, you can use inputMessageContent to send a message with the specified content instead of the the voice message.
*
* @ingroup types
*/
class InlineQueryResultVoice : public InlineQueryResult {
+
public:
static const std::string TYPE;
@@ -46,7 +48,8 @@ public:
/**
* @brief Optional. Mode for parsing entities in the voice message caption.
- * See https://core.telegram.org/bots/api#formatting-options for more details.
+ *
+ * See [formatting options](https://core.telegram.org/bots/api#formatting-options) for more details.
*/
std::string parseMode;
diff --git a/include/tgbot/types/InlineQueryResultsButton.h b/include/tgbot/types/InlineQueryResultsButton.h
new file mode 100644
index 0000000..3b5f4e0
--- /dev/null
+++ b/include/tgbot/types/InlineQueryResultsButton.h
@@ -0,0 +1,46 @@
+#ifndef TGBOT_INLINEQUERYRESULTSBUTTON_H
+#define TGBOT_INLINEQUERYRESULTSBUTTON_H
+
+#include "tgbot/types/WebAppInfo.h"
+
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents a button to be shown above inline query results.
+ *
+ * You must use exactly one of the optional fields.
+ *
+ * @ingroup types
+ */
+class InlineQueryResultsButton {
+public:
+ typedef std::shared_ptr<InlineQueryResultsButton> Ptr;
+
+ /**
+ * @brief Label text on the button
+ */
+ std::string text;
+
+ /**
+ * @brief Optional. Description of the Web App (https://core.telegram.org/bots/webapps) that will be launched when the user presses the button.
+ *
+ * The Web App will be able to switch back to the inline mode using the method switchInlineQuery (https://core.telegram.org/bots/webapps#initializing-mini-apps) inside the Web App.
+ */
+ WebAppInfo::Ptr webApp;
+
+ /**
+ * @brief Optional. Deep-linking (https://core.telegram.org/bots/features#deep-linking) parameter for the /start message sent to the bot when a user presses the button. 1-64 characters, only A-Z, a-z, 0-9, _ and - are allowed.
+ *
+ * Example: An inline bot that sends YouTube videos can ask the user to connect the bot to their YouTube account to adapt search results accordingly.
+ * To do this, it displays a 'Connect your YouTube account' button above the results, or even before showing any.
+ * The user presses the button, switches to a private chat with the bot and, in doing so, passes a start parameter that instructs the bot to return an OAuth link.
+ * Once done, the bot can offer a switchInline button so that the user can easily return to the chat where they wanted to use the bot's inline capabilities.
+ */
+ std::string startParameter;
+};
+}
+
+#endif //TGBOT_INLINEQUERYRESULTSBUTTON_H
diff --git a/include/tgbot/types/InputMediaAnimation.h b/include/tgbot/types/InputMediaAnimation.h
index 1cc2621..b79f059 100644
--- a/include/tgbot/types/InputMediaAnimation.h
+++ b/include/tgbot/types/InputMediaAnimation.h
@@ -33,7 +33,7 @@ public:
* 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
*/
- std::string thumb;
+ std::string thumbnail;
/**
* @brief Optional. Animation width
diff --git a/include/tgbot/types/InputMediaAudio.h b/include/tgbot/types/InputMediaAudio.h
index b46936e..abfc023 100644
--- a/include/tgbot/types/InputMediaAudio.h
+++ b/include/tgbot/types/InputMediaAudio.h
@@ -32,7 +32,7 @@ public:
* 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
*/
- std::string thumb;
+ std::string thumbnail;
/**
* @brief Optional. Duration of the audio in seconds
diff --git a/include/tgbot/types/InputMediaDocument.h b/include/tgbot/types/InputMediaDocument.h
index 9a6ab10..12a02e9 100644
--- a/include/tgbot/types/InputMediaDocument.h
+++ b/include/tgbot/types/InputMediaDocument.h
@@ -32,7 +32,7 @@ public:
* 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
*/
- std::string thumb;
+ std::string thumbnail;
/**
* @brief Optional. Disables automatic server-side content type detection for files uploaded using multipart/form-data.
diff --git a/include/tgbot/types/InputMediaVideo.h b/include/tgbot/types/InputMediaVideo.h
index 2645c91..734e7bb 100644
--- a/include/tgbot/types/InputMediaVideo.h
+++ b/include/tgbot/types/InputMediaVideo.h
@@ -33,7 +33,7 @@ public:
* 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
*/
- std::string thumb;
+ std::string thumbnail;
/**
* @brief Optional. Video width
diff --git a/include/tgbot/types/InputSticker.h b/include/tgbot/types/InputSticker.h
new file mode 100644
index 0000000..e636ba6
--- /dev/null
+++ b/include/tgbot/types/InputSticker.h
@@ -0,0 +1,57 @@
+#ifndef TGBOT_INPUTSTICKER_H
+#define TGBOT_INPUTSTICKER_H
+
+#include "tgbot/types/MaskPosition.h"
+
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace TgBot {
+
+/**
+ * @brief This object describes a sticker to be added to a sticker set.
+ *
+ * @ingroup types
+ */
+class InputSticker {
+
+public:
+ typedef std::shared_ptr<InputSticker> Ptr;
+
+ /**
+ * @brief The added sticker.
+ *
+ * Pass a fileId as a String to send a file that already exists on the Telegram servers, pass an HTTP URL as a String for Telegram to get a file from the Internet, upload a new one using multipart/form-data, or pass “attach://<file_attach_name>” to upload a new one using multipart/form-data under <file_attach_name> name.
+ * Animated and video stickers can't be uploaded via HTTP URL.
+ * [More information on Sending Files »](https://core.telegram.org/bots/api#sending-files)
+ */
+ std::string sticker;
+
+ /**
+ * @brief Format of the added sticker, must be one of “static” for a .WEBP or .PNG image, “animated” for a .TGS animation, “video” for a WEBM video
+ */
+ std::string format;
+
+ /**
+ * @brief List of 1-20 emoji associated with the sticker
+ */
+ std::vector<std::string> emojiList;
+
+ /**
+ * @brief Optional. Position where the mask should be placed on faces.
+ *
+ * For “mask” stickers only.
+ */
+ MaskPosition::Ptr maskPosition;
+
+ /**
+ * @brief Optional. List of 0-20 search keywords for the sticker with total length of up to 64 characters.
+ *
+ * For “regular” and “custom_emoji” stickers only.
+ */
+ std::vector<std::string> keywords;
+};
+}
+
+#endif //TGBOT_INPUTSTICKER_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..bf611ef 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,12 @@ 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::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 +29,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/KeyboardButtonRequestChat.h b/include/tgbot/types/KeyboardButtonRequestChat.h
index 9e446d8..0b3d9ea 100644
--- a/include/tgbot/types/KeyboardButtonRequestChat.h
+++ b/include/tgbot/types/KeyboardButtonRequestChat.h
@@ -10,7 +10,9 @@ namespace TgBot {
/**
* @brief This object defines the criteria used to request a suitable chat.
- * The identifier of the selected chat will be shared with the bot when the corresponding button is pressed.
+ *
+ * Information about the selected chat will be shared with the bot when the corresponding button is pressed.
+ * The bot will be granted requested rights in the сhat if appropriate [More about requesting chats »](https://core.telegram.org/bots/features#chat-and-user-selection)
*
* @ingroup types
*/
@@ -21,7 +23,7 @@ public:
/**
* @brief Signed 32-bit identifier of the request, which will be received back in the ChatShared object.
- *
+ *
* Must be unique within the message
*/
std::int32_t requestId;
@@ -33,47 +35,62 @@ public:
/**
* @brief Optional. Pass True to request a forum supergroup, pass False to request a non-forum chat.
- *
+ *
* If not specified, no additional restrictions are applied.
*/
bool chatIsForum;
/**
* @brief Optional. Pass True to request a supergroup or a channel with a username, pass False to request a chat without a username.
- *
+ *
* If not specified, no additional restrictions are applied.
*/
bool chatHasUsername;
/**
* @brief Optional. Pass True to request a chat owned by the user.
- *
+ *
* Otherwise, no additional restrictions are applied.
*/
bool chatIsCreated;
/**
* @brief Optional. A JSON-serialized object listing the required administrator rights of the user in the chat.
- *
- * The rights must be a superset of bot_administrator_rights.
+ *
+ * The rights must be a superset of botAdministratorRights.
* If not specified, no additional restrictions are applied.
*/
ChatAdministratorRights::Ptr userAdministratorRights;
/**
* @brief Optional. A JSON-serialized object listing the required administrator rights of the bot in the chat.
- *
- * The rights must be a subset of user_administrator_rights.
+ *
+ * The rights must be a subset of userAdministratorRights.
* If not specified, no additional restrictions are applied.
*/
ChatAdministratorRights::Ptr botAdministratorRights;
/**
* @brief Optional. Pass True to request a chat with the bot as a member.
- *
+ *
* Otherwise, no additional restrictions are applied.
*/
bool botIsMember;
+
+ /**
+ * @brief Optional. Pass True to request the chat's title
+ */
+ bool requestTitle;
+
+ /**
+ * @brief Optional. Pass True to request the chat's username
+ */
+ bool requestUsername;
+
+ /**
+ * @brief Optional. Pass True to request the chat's photo
+ */
+ bool requestPhoto;
};
}
diff --git a/include/tgbot/types/KeyboardButtonRequestUser.h b/include/tgbot/types/KeyboardButtonRequestUser.h
deleted file mode 100644
index 3463e49..0000000
--- a/include/tgbot/types/KeyboardButtonRequestUser.h
+++ /dev/null
@@ -1,43 +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.
- *
- * @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..c124c6a
--- /dev/null
+++ b/include/tgbot/types/KeyboardButtonRequestUsers.h
@@ -0,0 +1,67 @@
+#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.
+ *
+ * Information about 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;
+
+ /**
+ * @brief Optional. Pass True to request the users' first and last name
+ */
+ bool requestName;
+
+ /**
+ * @brief Optional. Pass True to request the users' username
+ */
+ bool requestUsername;
+
+ /**
+ * @brief Optional. Pass True to request the users' photo
+ */
+ bool requestPhoto;
+};
+}
+
+#endif //TGBOT_KEYBOARDBUTTONREQUESTUSERS_H
diff --git a/include/tgbot/types/LinkPreviewOptions.h b/include/tgbot/types/LinkPreviewOptions.h
new file mode 100644
index 0000000..b4c5325
--- /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 supposed to be shrunk; ignored if the URL isn't explicitly specified or media size change isn't supported for the preview
+ */
+ bool preferSmallMedia;
+
+ /**
+ * @brief Optional. True, if the media in the link preview is supposed 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/Location.h b/include/tgbot/types/Location.h
index 9454272..ea98bbb 100644
--- a/include/tgbot/types/Location.h
+++ b/include/tgbot/types/Location.h
@@ -1,6 +1,7 @@
-#ifndef TGBOT_CPP_LOCATION_H
-#define TGBOT_CPP_LOCATION_H
+#ifndef TGBOT_LOCATION_H
+#define TGBOT_LOCATION_H
+#include <cstdint>
#include <memory>
namespace TgBot {
@@ -16,14 +17,14 @@ public:
typedef std::shared_ptr<Location> Ptr;
/**
- * @brief Longitude as defined by sender
+ * @brief Latitude as defined by sender
*/
- float longitude;
+ float latitude;
/**
- * @brief Latitude as defined by sender
+ * @brief Longitude as defined by sender
*/
- float latitude;
+ float longitude;
/**
* @brief Optional. The radius of uncertainty for the location, measured in meters; 0-1500
@@ -31,24 +32,26 @@ public:
float horizontalAccuracy;
/**
- * @brief Optional. Time relative to the message sending date, during which the location can be updated, in seconds.
+ * @brief Optional. Time relative to the message sending date, during which the location can be updated; in seconds.
+ *
* For active live locations only.
*/
std::int32_t livePeriod;
/**
* @brief Optional. The direction in which user is moving, in degrees; 1-360.
+ *
* For active live locations only.
*/
std::int32_t heading;
/**
- * @brief Optional. Maximum distance for proximity alerts about approaching another chat member, in meters.
+ * @brief Optional. The maximum distance for proximity alerts about approaching another chat member, in meters.
+ *
* For sent live locations only.
*/
std::int32_t proximityAlertRadius;
};
-
}
-#endif //TGBOT_CPP_LOCATION_H
+#endif //TGBOT_LOCATION_H
diff --git a/include/tgbot/types/Message.h b/include/tgbot/types/Message.h
index 8ed8300..d56f7c4 100644
--- a/include/tgbot/types/Message.h
+++ b/include/tgbot/types/Message.h
@@ -3,8 +3,13 @@
#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/Story.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"
@@ -22,17 +27,22 @@
#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"
#include "tgbot/types/ProximityAlertTriggered.h"
+#include "tgbot/types/ChatBoostAdded.h"
#include "tgbot/types/ForumTopicCreated.h"
#include "tgbot/types/ForumTopicEdited.h"
#include "tgbot/types/ForumTopicClosed.h"
#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"
@@ -41,9 +51,9 @@
#include "tgbot/types/InlineKeyboardMarkup.h"
#include <cstdint>
+#include <memory>
#include <string>
#include <vector>
-#include <memory>
namespace TgBot {
@@ -53,6 +63,7 @@ namespace TgBot {
* @ingroup types
*/
class Message {
+
public:
typedef std::shared_ptr<Message> Ptr;
@@ -68,58 +79,54 @@ 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
- */
- std::int32_t date;
-
- /**
- * @brief Conversation the message belongs to
+ * @brief Optional. If the sender of the message boosted the chat, the number of boosts added by the user
*/
- Chat::Ptr chat;
-
- /**
- * @brief Optional. For forwarded messages, sender of the original message
- */
- User::Ptr forwardFrom;
+ std::int32_t senderBoostCount;
/**
- * @brief Optional. For messages forwarded from channels or from anonymous administrators, information about the original sender chat
+ * @brief Optional. The bot that actually sent the message on behalf of the business account.
+ *
+ * Available only for outgoing messages sent on behalf of the connected business account.
*/
- Chat::Ptr forwardFromChat;
+ User::Ptr senderBusinessBot;
/**
- * @brief Optional. For messages forwarded from channels, identifier of the original message in the channel
+ * @brief Date the message was sent in Unix time.
+ *
+ * It is always a positive number, representing a valid date.
*/
- std::int32_t forwardFromMessageId;
+ std::uint32_t date;
/**
- * @brief Optional. For forwarded messages that were originally sent in channels or by an anonymous chat administrator, signature of the message sender if present
+ * @brief Optional. Unique identifier of the business connection from which the message was received.
+ *
+ * If non-empty, the message belongs to a chat of the corresponding business account that is independent from any potential bot chat which might share the same identifier.
*/
- std::string forwardSignature;
+ std::string businessConnectionId;
/**
- * @brief Optional. Sender's name for messages forwarded from users who disallow adding a link to their account in forwarded messages
+ * @brief Chat the message belongs to
*/
- std::string forwardSenderName;
+ Chat::Ptr chat;
/**
- * @brief Optional. For forwarded messages, date the original message was sent in Unix time
+ * @brief Optional. Information about the original message for forwarded messages
*/
- std::int32_t forwardDate;
+ MessageOrigin::Ptr forwardOrigin;
/**
* @brief Optional. True, if the message is sent to a forum topic
@@ -132,13 +139,28 @@ 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. For replies to a story, the original story
+ */
+ Story::Ptr replyToStory;
+
+ /**
* @brief Optional. Bot through which the message was sent
*/
User::Ptr viaBot;
@@ -146,7 +168,7 @@ public:
/**
* @brief Optional. Date the message was last edited in Unix time
*/
- std::int32_t editDate;
+ std::uint32_t editDate;
/**
* @brief Optional. True, if the message can't be forwarded
@@ -154,10 +176,15 @@ public:
bool hasProtectedContent;
/**
+ * @brief Optional. True, if the message was sent by an implicit action, for example, as an away or a greeting business message, or as a scheduled message
+ */
+ bool isFromOffline;
+
+ /**
* @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
*/
@@ -174,8 +201,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;
@@ -201,12 +233,17 @@ public:
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, 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;
@@ -219,7 +256,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
*/
@@ -241,7 +278,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;
@@ -252,7 +291,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;
@@ -294,7 +333,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.
*/
@@ -302,7 +341,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.
*/
@@ -331,29 +370,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.
+ *
+ * Note that the Message object in this field will not contain further replyToMessage fields even if it itself is 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
@@ -362,13 +401,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 added to the attachment menu to write messages
+ * @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;
@@ -379,12 +418,17 @@ public:
/**
* @brief Optional. Service message.
- *
+ *
* A user in the chat triggered another user's proximity alert while sharing Live Location.
*/
ProximityAlertTriggered::Ptr proximityAlertTriggered;
/**
+ * @brief Optional. Service message: user boosted the chat
+ */
+ ChatBoostAdded::Ptr boostAdded;
+
+ /**
* @brief Optional. Service message: forum topic created
*/
ForumTopicCreated::Ptr forumTopicCreated;
@@ -415,6 +459,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;
@@ -441,7 +505,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/PollAnswer.h b/include/tgbot/types/PollAnswer.h
index 4476d63..af96377 100644
--- a/include/tgbot/types/PollAnswer.h
+++ b/include/tgbot/types/PollAnswer.h
@@ -1,8 +1,10 @@
-#ifndef TGBOT_CPP_POLLANSWER_H
-#define TGBOT_CPP_POLLANSWER_H
+#ifndef TGBOT_POLLANSWER_H
+#define TGBOT_POLLANSWER_H
+#include "tgbot/types/Chat.h"
#include "tgbot/types/User.h"
+#include <cstdint>
#include <string>
#include <memory>
#include <vector>
@@ -25,16 +27,22 @@ public:
std::string pollId;
/**
- * @brief The user, who changed the answer to the poll
+ * @brief Optional. The chat that changed the answer to the poll, if the voter is anonymous
+ */
+ Chat::Ptr voterChat;
+
+ /**
+ * @brief Optional. The user that changed the answer to the poll, if the voter isn't anonymous
*/
User::Ptr user;
/**
- * @brief 0-based identifiers of answer options, chosen by the user.
- * May be empty if the user retracted their vote.
+ * @brief 0-based identifiers of chosen answer options.
+ *
+ * May be empty if the vote was retracted.
*/
std::vector<std::int32_t> optionIds;
};
}
-#endif //TGBOT_CPP_POLLANSWER_H
+#endif //TGBOT_POLLANSWER_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/ReplyKeyboardMarkup.h b/include/tgbot/types/ReplyKeyboardMarkup.h
index d40d767..f70b2fc 100644
--- a/include/tgbot/types/ReplyKeyboardMarkup.h
+++ b/include/tgbot/types/ReplyKeyboardMarkup.h
@@ -11,7 +11,7 @@
namespace TgBot {
/**
- * @brief This object represents a custom keyboard with reply options (see https://core.telegram.org/bots/features#keyboards for details and examples).
+ * @brief This object represents a [custom keyboard](https://core.telegram.org/bots/features#keyboards) with reply options (see [Introduction to bots](https://core.telegram.org/bots/features#keyboards) for details and examples).
*
* @ingroup types
*/
@@ -27,21 +27,21 @@ public:
/**
* @brief Optional. Requests clients to always show the keyboard when the regular keyboard is hidden.
- *
+ *
* Defaults to false, in which case the custom keyboard can be hidden and opened with a keyboard icon.
*/
bool isPersistent;
/**
* @brief Optional. Requests clients to resize the keyboard vertically for optimal fit (e.g., make the keyboard smaller if there are just two rows of buttons).
- *
+ *
* Defaults to false, in which case the custom keyboard is always of the same height as the app's standard keyboard.
*/
bool resizeKeyboard;
/**
* @brief Optional. Requests clients to hide the keyboard as soon as it's been used.
- *
+ *
* The keyboard will still be available, but clients will automatically display the usual letter-keyboard in the chat - the user can press a special button in the input field to see the custom keyboard again.
* Defaults to false.
*/
@@ -54,9 +54,8 @@ public:
/**
* @brief Optional. Use this parameter if you want to show the keyboard to specific users only.
- *
- * Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply (has replyToMessageId), sender of the original message.
- *
+ *
+ * Targets: 1) users that are @mentioned in the text of the Message object; 2) if the bot's message is a reply to a message in the same chat and forum topic, sender of the original message.
* Example: A user requests to change the bot's language, bot replies to the request with a keyboard to select the new language.
* Other users in the group don't see the keyboard.
*/
diff --git a/include/tgbot/types/ReplyKeyboardRemove.h b/include/tgbot/types/ReplyKeyboardRemove.h
index 4522bda..3a2bb94 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 to a message in the same chat and forum topic, sender of the original message.
* Example: A user votes in a poll, bot returns confirmation message in reply to the vote and removes the keyboard for that user, while still showing the keyboard with poll options to users who haven't voted yet.
*/
- bool selective = 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..537de07
--- /dev/null
+++ b/include/tgbot/types/ReplyParameters.h
@@ -0,0 +1,72 @@
+#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).
+ *
+ * Not supported for messages sent on behalf of a business account.
+ */
+ 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.
+ *
+ * Always False for replies in another chat or forum topic.
+ * Always True for messages sent on behalf of a business account.
+ */
+ 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/SharedUser.h b/include/tgbot/types/SharedUser.h
new file mode 100644
index 0000000..680b38b
--- /dev/null
+++ b/include/tgbot/types/SharedUser.h
@@ -0,0 +1,54 @@
+#ifndef TGBOT_SHAREDUSER_H
+#define TGBOT_SHAREDUSER_H
+
+#include "tgbot/types/PhotoSize.h"
+
+#include <cstdint>
+#include <memory>
+#include <string>
+#include <vector>
+
+namespace TgBot {
+
+/**
+ * @brief This object contains information about a user that was shared with the bot using a KeyboardButtonRequestUser button.
+ *
+ * @ingroup types
+ */
+class SharedUser {
+
+public:
+ typedef std::shared_ptr<SharedUser> Ptr;
+
+ /**
+ * @brief Identifier of the shared 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 64-bit integers or double-precision float types are safe for storing these identifiers.
+ * 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.
+ */
+ std::int64_t userId;
+
+ /**
+ * @brief Optional. First name of the user, if the name was requested by the bot
+ */
+ std::string firstName;
+
+ /**
+ * @brief Optional. Last name of the user, if the name was requested by the bot
+ */
+ std::string lastName;
+
+ /**
+ * @brief Optional. Username of the user, if the username was requested by the bot
+ */
+ std::string username;
+
+ /**
+ * @brief Optional. Available sizes of the chat photo, if the photo was requested by the bot
+ */
+ std::vector<PhotoSize::Ptr> photo;
+};
+}
+
+#endif //TGBOT_SHAREDUSER_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/Sticker.h b/include/tgbot/types/Sticker.h
index 7ec0140..ab7f167 100644
--- a/include/tgbot/types/Sticker.h
+++ b/include/tgbot/types/Sticker.h
@@ -68,7 +68,7 @@ public:
/**
* @brief Optional. Sticker thumbnail in the .WEBP or .JPG format
*/
- PhotoSize::Ptr thumb;
+ PhotoSize::Ptr thumbnail;
/**
* @brief Optional. Emoji associated with the sticker
@@ -96,6 +96,11 @@ public:
std::string customEmojiId;
/**
+ * @brief Optional. True, if the sticker must be repainted to a text color in messages, the color of the Telegram Premium badge in emoji status, white color on chat photos, or another appropriate color in other places
+ */
+ bool needsRepainting = true;
+
+ /**
* @brief Optional. File size in bytes
*/
std::int32_t fileSize;
diff --git a/include/tgbot/types/StickerSet.h b/include/tgbot/types/StickerSet.h
index 006b1d1..db424dc 100644
--- a/include/tgbot/types/StickerSet.h
+++ b/include/tgbot/types/StickerSet.h
@@ -16,6 +16,7 @@ namespace TgBot {
* @ingroup types
*/
class StickerSet {
+
public:
typedef std::shared_ptr<StickerSet> Ptr;
@@ -37,19 +38,9 @@ public:
std::string title;
/**
- * @brief Type of stickers in the set, currently one of “regular”, “mask”, “custom_emoji”
- */
- Type type;
-
- /**
- * @brief True, if the sticker set contains animated stickers
- */
- bool isAnimated;
-
- /**
- * @brief True, if the sticker set contains video stickers
+ * @brief Type of stickers in the set, currently one of Type::Regular, Type::Mask, Type::CustomEmoji”
*/
- bool isVideo;
+ Type stickerType;
/**
* @brief List of all set stickers
@@ -59,7 +50,7 @@ public:
/**
* @brief Optional. Sticker set thumbnail in the .WEBP, .TGS, or .WEBM format
*/
- PhotoSize::Ptr thumb;
+ PhotoSize::Ptr thumbnail;
};
}
diff --git a/include/tgbot/types/Story.h b/include/tgbot/types/Story.h
new file mode 100644
index 0000000..4ed8c67
--- /dev/null
+++ b/include/tgbot/types/Story.h
@@ -0,0 +1,33 @@
+#ifndef TGBOT_STORY_H
+#define TGBOT_STORY_H
+
+#include "tgbot/types/Chat.h"
+
+#include <cstdint>
+#include <memory>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents a story.
+ *
+ * @ingroup types
+ */
+class Story {
+
+public:
+ typedef std::shared_ptr<Story> Ptr;
+
+ /**
+ * @brief Chat that posted the story
+ */
+ Chat::Ptr chat;
+
+ /**
+ * @brief Unique identifier for the story in the chat
+ */
+ std::int32_t id;
+};
+}
+
+#endif //TGBOT_STORY_H
diff --git a/include/tgbot/types/SwitchInlineQueryChosenChat.h b/include/tgbot/types/SwitchInlineQueryChosenChat.h
new file mode 100644
index 0000000..b0ecf2c
--- /dev/null
+++ b/include/tgbot/types/SwitchInlineQueryChosenChat.h
@@ -0,0 +1,46 @@
+#ifndef TGBOT_SWITCHINLINEQUERYCHOSENCHAT_H
+#define TGBOT_SWITCHINLINEQUERYCHOSENCHAT_H
+
+#include <memory>
+#include <string>
+
+namespace TgBot {
+
+/**
+ * @brief This object represents an inline button that switches the current user to inline mode in a chosen chat, with an optional default inline query.
+ *
+ * @ingroup types
+ */
+class SwitchInlineQueryChosenChat {
+
+public:
+ typedef std::shared_ptr<SwitchInlineQueryChosenChat> Ptr;
+
+ /**
+ * @brief Optional. The default inline query to be inserted in the input field. If left empty, only the bot's username will be inserted
+ */
+ std::string query;
+
+ /**
+ * @brief Optional. True, if private chats with users can be chosen
+ */
+ bool allowUserChats;
+
+ /**
+ * @brief Optional. True, if private chats with bots can be chosen
+ */
+ bool allowBotChats;
+
+ /**
+ * @brief Optional. True, if group and supergroup chats can be chosen
+ */
+ bool allowGroupChats;
+
+ /**
+ * @brief Optional. True, if channel chats can be chosen
+ */
+ bool allowChannelChats;
+};
+}
+
+#endif //TGBOT_SWITCHINLINEQUERYCHOSENCHAT_H
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..a7ad470 100644
--- a/include/tgbot/types/Update.h
+++ b/include/tgbot/types/Update.h
@@ -1,7 +1,11 @@
-#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/BusinessConnection.h"
+#include "tgbot/types/BusinessMessagesDeleted.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 +15,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 +24,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 +36,83 @@ 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 identifier becomes especially handy if you're using [webhooks](https://core.telegram.org/bots/api#setwebhook), since it allows you to ignore repeated updates or to restore the correct update sequence, should they get out of order.
* If there are no new updates for at least a week, then identifier of the next update will be chosen randomly instead of sequentially.
*/
std::int32_t updateId;
/**
- * @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.
+ *
+ * This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot.
+ */
Message::Ptr editedMessage;
/**
- * @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.
+ *
+ * This update may at times be triggered by changes to message fields that are either unavailable or not actively used by your bot.
+ */
Message::Ptr editedChannelPost;
/**
- * @brief Optional. New incoming inline query
+ * @brief Optional. The bot was connected to or disconnected from a business account, or a user edited an existing connection with the bot
+ */
+ BusinessConnection::Ptr businessConnection;
+
+ /**
+ * @brief Optional. New non-service message from a connected business account
+ */
+ Message::Ptr businessMessage;
+
+ /**
+ * @brief Optional. New version of a message from a connected business account
+ */
+ Message::Ptr editedBusinessMessage;
+
+ /**
+ * @brief Optional. Messages were deleted from a connected business account
+ */
+ BusinessMessagesDeleted::Ptr deletedBusinessMessages;
+
+ /**
+ * @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.
+ * The updates are grouped and can be sent with delay up to a few minutes.
+ */
+ 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 +123,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
+ *
+ * Bots receive only updates about manually 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/User.h b/include/tgbot/types/User.h
index 328c0a2..6b28e1d 100644
--- a/include/tgbot/types/User.h
+++ b/include/tgbot/types/User.h
@@ -2,8 +2,8 @@
#define TGBOT_USER_H
#include <cstdint>
-#include <string>
#include <memory>
+#include <string>
namespace TgBot {
@@ -12,14 +12,14 @@ namespace TgBot {
*
* @ingroup types
*/
-class User {
+class User {
public:
typedef std::shared_ptr<User> Ptr;
/**
* @brief Unique identifier for this user or bot.
- *
+ *
* 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.
*/
@@ -46,7 +46,7 @@ public:
std::string username;
/**
- * @brief Optional. IETF language tag of the user's language
+ * @brief Optional. [IETF language tag](https://en.wikipedia.org/wiki/IETF_language_tag) of the user's language
*/
std::string languageCode;
@@ -62,21 +62,31 @@ public:
/**
* @brief Optional. True, if the bot can be invited to groups.
+ *
* Returned only in Api::getMe.
*/
bool canJoinGroups;
/**
- * @brief Optional. True, if privacy mode is disabled for the bot.
+ * @brief Optional. True, if [privacy mode](https://core.telegram.org/bots/features#privacy-mode) is disabled for the bot.
+ *
* Returned only in Api::getMe.
*/
bool canReadAllGroupMessages;
/**
* @brief Optional. True, if the bot supports inline queries.
+ *
* Returned only in Api::getMe.
*/
bool supportsInlineQueries;
+
+ /**
+ * @brief Optional. True, if the bot can be connected to a Telegram Business account to receive its messages.
+ *
+ * Returned only in Api::getMe.
+ */
+ bool canConnectToBusiness;
};
}
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..343ac82
--- /dev/null
+++ b/include/tgbot/types/UsersShared.h
@@ -0,0 +1,34 @@
+#ifndef TGBOT_USERSSHARED_H
+#define TGBOT_USERSSHARED_H
+
+#include "tgbot/types/SharedUser.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 Information about users shared with the bot.
+ */
+ std::vector<SharedUser::Ptr> users;
+};
+}
+
+#endif //TGBOT_USERSSHARED_H
diff --git a/include/tgbot/types/Video.h b/include/tgbot/types/Video.h
index 95590ad..c23bf44 100644
--- a/include/tgbot/types/Video.h
+++ b/include/tgbot/types/Video.h
@@ -48,7 +48,7 @@ public:
/**
* @brief Optional. Video thumbnail
*/
- PhotoSize::Ptr thumb;
+ PhotoSize::Ptr thumbnail;
/**
* @brief Optional. Original filename as defined by sender
diff --git a/include/tgbot/types/VideoNote.h b/include/tgbot/types/VideoNote.h
index 755e3d0..462b117 100644
--- a/include/tgbot/types/VideoNote.h
+++ b/include/tgbot/types/VideoNote.h
@@ -43,7 +43,7 @@ public:
/**
* @brief Optional. Video thumbnail
*/
- PhotoSize::Ptr thumb;
+ PhotoSize::Ptr thumbnail;
/**
* @brief Optional. File size
diff --git a/include/tgbot/types/WebAppInfo.h b/include/tgbot/types/WebAppInfo.h
index 1e9d314..1bdcf0a 100644
--- a/include/tgbot/types/WebAppInfo.h
+++ b/include/tgbot/types/WebAppInfo.h
@@ -7,7 +7,9 @@
namespace TgBot {
/**
- * @brief Contains information about a Web App.
+ * @brief Describes a Web App.
+ *
+ * https://core.telegram.org/bots/webapps
*
* @ingroup types
*/
@@ -17,7 +19,7 @@ public:
typedef std::shared_ptr<WebAppInfo> Ptr;
/**
- * @brief An HTTPS URL of a Web App to be opened with additional data as specified in https://core.telegram.org/bots/webapps#initializing-web-apps
+ * @brief An HTTPS URL of a Web App to be opened with additional data as specified in Initializing Web Apps (https://core.telegram.org/bots/webapps#initializing-mini-apps)
*/
std::string url;
};
diff --git a/include/tgbot/types/WriteAccessAllowed.h b/include/tgbot/types/WriteAccessAllowed.h
index d01aa31..d8ad61e 100644
--- a/include/tgbot/types/WriteAccessAllowed.h
+++ b/include/tgbot/types/WriteAccessAllowed.h
@@ -2,19 +2,33 @@
#define TGBOT_WRITEACCESSALLOWED_H
#include <memory>
+#include <string>
namespace TgBot {
/**
- * @brief This object represents a service message about a user allowing a bot added to the attachment menu to write messages.
- *
- * Currently holds no information.
+ * @brief This object represents a service message about a user allowing a bot to write messages after adding it to the attachment menu, launching a Web App from a link, or accepting an explicit request from a Web App sent by the method requestWriteAccess.
*
* @ingroup types
*/
class WriteAccessAllowed {
public:
typedef std::shared_ptr<WriteAccessAllowed> Ptr;
+
+ /**
+ * @brief Optional. True, if the access was granted after the user accepted an explicit request from a Web App sent by the method requestWriteAccess (https://core.telegram.org/bots/webapps#initializing-mini-apps)
+ */
+ bool fromRequest;
+
+ /**
+ * @brief Optional. Name of the Web App, if the access was granted when the Web App was launched from a link
+ */
+ std::string webAppName;
+
+ /**
+ * @brief Optional. True, if the access was granted when the bot was added to the attachment or side menu
+ */
+ bool fromAttachmentMenu;
};
}
diff --git a/samples/inline-keyboard/src/main.cpp b/samples/inline-keyboard/src/main.cpp
index 2e3ec68..b84d363 100644
--- a/samples/inline-keyboard/src/main.cpp
+++ b/samples/inline-keyboard/src/main.cpp
@@ -25,16 +25,16 @@ int main() {
keyboard->inlineKeyboard.push_back(row0);
bot.getEvents().onCommand("start", [&bot, &keyboard](Message::Ptr message) {
- bot.getApi().sendMessage(message->chat->id, "Hi!", false, 0, keyboard);
+ bot.getApi().sendMessage(message->chat->id, "Hi!", nullptr, nullptr, keyboard);
});
bot.getEvents().onCommand("check", [&bot, &keyboard](Message::Ptr message) {
string response = "ok";
- bot.getApi().sendMessage(message->chat->id, response, false, 0, keyboard, "Markdown");
+ bot.getApi().sendMessage(message->chat->id, response, nullptr, nullptr, keyboard, "Markdown");
});
bot.getEvents().onCallbackQuery([&bot, &keyboard](CallbackQuery::Ptr query) {
if (StringTools::startsWith(query->data, "check")) {
string response = "ok";
- bot.getApi().sendMessage(query->message->chat->id, response, false, 0, keyboard, "Markdown");
+ bot.getApi().sendMessage(query->message->chat->id, response, nullptr, nullptr, keyboard, "Markdown");
}
});
diff --git a/samples/receive-file/src/main.cpp b/samples/receive-file/src/main.cpp
index 7a0e8ff..5972534 100644
--- a/samples/receive-file/src/main.cpp
+++ b/samples/receive-file/src/main.cpp
@@ -20,12 +20,13 @@ int main() {
bot.getEvents().onAnyMessage([&bot](Message::Ptr message) {
printf("User wrote %s\n", message->text.c_str());
- File::Ptr file = bot.getApi().getFile(message->document->fileId);
- string fileContent = bot.getApi().downloadFile(file->filePath);
-
if (StringTools::startsWith(message->text, "/start")) {
return;
}
+
+ File::Ptr file = bot.getApi().getFile(message->document->fileId);
+ string fileContent = bot.getApi().downloadFile(file->filePath);
+
bot.getApi().sendMessage(message->chat->id, "Your file content: " + fileContent);
});
diff --git a/samples/reply-keyboard/src/main.cpp b/samples/reply-keyboard/src/main.cpp
index 9478368..877302b 100644
--- a/samples/reply-keyboard/src/main.cpp
+++ b/samples/reply-keyboard/src/main.cpp
@@ -54,10 +54,10 @@ int main() {
}, keyboardWithLayout);
bot.getEvents().onCommand("start", [&bot, &keyboardOneCol](Message::Ptr message) {
- bot.getApi().sendMessage(message->chat->id, "/start for one column keyboard\n/layout for a more complex keyboard", false, 0, keyboardOneCol);
+ bot.getApi().sendMessage(message->chat->id, "/start for one column keyboard\n/layout for a more complex keyboard", nullptr, nullptr, keyboardOneCol);
});
bot.getEvents().onCommand("layout", [&bot, &keyboardWithLayout](Message::Ptr message) {
- bot.getApi().sendMessage(message->chat->id, "/start for one column keyboard\n/layout for a more complex keyboard", false, 0, keyboardWithLayout);
+ bot.getApi().sendMessage(message->chat->id, "/start for one column keyboard\n/layout for a more complex keyboard", nullptr, nullptr, keyboardWithLayout);
});
bot.getEvents().onAnyMessage([&bot](Message::Ptr message) {
printf("User wrote %s\n", message->text.c_str());
diff --git a/src/Api.cpp b/src/Api.cpp
index f3f8124..2c4b82a 100644
--- a/src/Api.cpp
+++ b/src/Api.cpp
@@ -112,18 +112,21 @@ 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,
+ std::int32_t messageThreadId,
bool protectContent,
- std::int32_t messageThreadId) const {
+ const std::string& businessConnectionId) const {
std::vector<HttpReqArg> args;
args.reserve(11);
+ if (!businessConnectionId.empty()) {
+ args.emplace_back("business_connection_id", businessConnectionId);
+ }
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
args.emplace_back("message_thread_id", messageThreadId);
@@ -135,8 +138,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 +147,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 +182,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 +219,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 +247,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,21 +257,59 @@ 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 hasSpoiler) const {
+ bool protectContent,
+ bool hasSpoiler,
+ const std::string& businessConnectionId) const {
std::vector<HttpReqArg> args;
args.reserve(12);
+ if (!businessConnectionId.empty()) {
+ args.emplace_back("business_connection_id", businessConnectionId);
+ }
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
args.emplace_back("message_thread_id", messageThreadId);
@@ -274,11 +338,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));
@@ -293,18 +354,21 @@ Message::Ptr Api::sendAudio(boost::variant<std::int64_t, std::string> chatId,
std::int32_t duration,
const std::string& performer,
const std::string& title,
- boost::variant<InputFile::Ptr, std::string> thumb,
- std::int32_t replyToMessageId,
+ boost::variant<InputFile::Ptr, std::string> thumbnail,
+ ReplyParameters::Ptr replyParameters,
GenericReply::Ptr replyMarkup,
const std::string& parseMode,
bool disableNotification,
const std::vector<MessageEntity::Ptr>& captionEntities,
- bool allowSendingWithoutReply,
+ std::int32_t messageThreadId,
bool protectContent,
- std::int32_t messageThreadId) const {
+ const std::string& businessConnectionId) const {
std::vector<HttpReqArg> args;
args.reserve(15);
+ if (!businessConnectionId.empty()) {
+ args.emplace_back("business_connection_id", businessConnectionId);
+ }
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
args.emplace_back("message_thread_id", messageThreadId);
@@ -333,13 +397,13 @@ Message::Ptr Api::sendAudio(boost::variant<std::int64_t, std::string> chatId,
if (!title.empty()) {
args.emplace_back("title", title);
}
- if (thumb.which() == 0) { // InputFile::Ptr
- auto file = boost::get<InputFile::Ptr>(thumb);
- args.emplace_back("thumb", file->data, true, file->mimeType, file->fileName);
+ if (thumbnail.which() == 0) { // InputFile::Ptr
+ auto file = boost::get<InputFile::Ptr>(thumbnail);
+ args.emplace_back("thumbnail", file->data, true, file->mimeType, file->fileName);
} else { // std::string
- auto thumbStr = boost::get<std::string>(thumb);
- if (!thumbStr.empty()) {
- args.emplace_back("thumb", thumbStr);
+ auto thumbnailStr = boost::get<std::string>(thumbnail);
+ if (!thumbnailStr.empty()) {
+ args.emplace_back("thumbnail", thumbnailStr);
}
}
if (disableNotification) {
@@ -348,11 +412,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));
@@ -363,20 +424,23 @@ Message::Ptr Api::sendAudio(boost::variant<std::int64_t, std::string> chatId,
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> thumb,
+ 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,
+ std::int32_t messageThreadId,
bool protectContent,
- std::int32_t messageThreadId) const {
+ const std::string& businessConnectionId) const {
std::vector<HttpReqArg> args;
args.reserve(13);
+ if (!businessConnectionId.empty()) {
+ args.emplace_back("business_connection_id", businessConnectionId);
+ }
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
args.emplace_back("message_thread_id", messageThreadId);
@@ -387,13 +451,13 @@ Message::Ptr Api::sendDocument(boost::variant<std::int64_t, std::string> chatId,
} else { // std::string
args.emplace_back("document", boost::get<std::string>(document));
}
- if (thumb.which() == 0) { // InputFile::Ptr
- auto file = boost::get<InputFile::Ptr>(thumb);
- args.emplace_back("thumb", file->data, true, file->mimeType, file->fileName);
+ if (thumbnail.which() == 0) { // InputFile::Ptr
+ auto file = boost::get<InputFile::Ptr>(thumbnail);
+ args.emplace_back("thumbnail", file->data, true, file->mimeType, file->fileName);
} else { // std::string
- auto thumbStr = boost::get<std::string>(thumb);
- if (!thumbStr.empty()) {
- args.emplace_back("thumb", thumbStr);
+ auto thumbnailStr = boost::get<std::string>(thumbnail);
+ if (!thumbnailStr.empty()) {
+ args.emplace_back("thumbnail", thumbnailStr);
}
}
if (!caption.empty()) {
@@ -414,11 +478,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));
@@ -433,20 +494,23 @@ Message::Ptr Api::sendVideo(boost::variant<std::int64_t, std::string> chatId,
std::int32_t duration,
std::int32_t width,
std::int32_t height,
- boost::variant<InputFile::Ptr, std::string> thumb,
+ 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::string& businessConnectionId) const {
std::vector<HttpReqArg> args;
args.reserve(17);
+ if (!businessConnectionId.empty()) {
+ args.emplace_back("business_connection_id", businessConnectionId);
+ }
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
args.emplace_back("message_thread_id", messageThreadId);
@@ -466,13 +530,13 @@ Message::Ptr Api::sendVideo(boost::variant<std::int64_t, std::string> chatId,
if (height != 0) {
args.emplace_back("height", height);
}
- if (thumb.which() == 0) { // InputFile::Ptr
- auto file = boost::get<InputFile::Ptr>(thumb);
- args.emplace_back("thumb", file->data, true, file->mimeType, file->fileName);
+ if (thumbnail.which() == 0) { // InputFile::Ptr
+ auto file = boost::get<InputFile::Ptr>(thumbnail);
+ args.emplace_back("thumbnail", file->data, true, file->mimeType, file->fileName);
} else { // std::string
- auto thumbStr = boost::get<std::string>(thumb);
- if (!thumbStr.empty()) {
- args.emplace_back("thumb", thumbStr);
+ auto thumbnailStr = boost::get<std::string>(thumbnail);
+ if (!thumbnailStr.empty()) {
+ args.emplace_back("thumbnail", thumbnailStr);
}
}
if (!caption.empty()) {
@@ -496,11 +560,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));
@@ -514,20 +575,23 @@ Message::Ptr Api::sendAnimation(boost::variant<std::int64_t, std::string> chatId
std::int32_t duration,
std::int32_t width,
std::int32_t height,
- boost::variant<InputFile::Ptr, std::string> thumb,
+ 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::string& businessConnectionId) const {
std::vector<HttpReqArg> args;
args.reserve(16);
+ if (!businessConnectionId.empty()) {
+ args.emplace_back("business_connection_id", businessConnectionId);
+ }
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
args.emplace_back("message_thread_id", messageThreadId);
@@ -547,13 +611,13 @@ Message::Ptr Api::sendAnimation(boost::variant<std::int64_t, std::string> chatId
if (height != 0) {
args.emplace_back("height", height);
}
- if (thumb.which() == 0) { // InputFile::Ptr
- auto file = boost::get<InputFile::Ptr>(thumb);
- args.emplace_back("thumb", file->data, true, file->mimeType, file->fileName);
+ if (thumbnail.which() == 0) { // InputFile::Ptr
+ auto file = boost::get<InputFile::Ptr>(thumbnail);
+ args.emplace_back("thumbnail", file->data, true, file->mimeType, file->fileName);
} else { // std::string
- auto thumbStr = boost::get<std::string>(thumb);
- if (!thumbStr.empty()) {
- args.emplace_back("thumb", thumbStr);
+ auto thumbnailStr = boost::get<std::string>(thumbnail);
+ if (!thumbnailStr.empty()) {
+ args.emplace_back("thumbnail", thumbnailStr);
}
}
if (!caption.empty()) {
@@ -574,11 +638,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,17 +652,20 @@ 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,
+ std::int32_t messageThreadId,
bool protectContent,
- std::int32_t messageThreadId) const {
+ const std::string& businessConnectionId) const {
std::vector<HttpReqArg> args;
args.reserve(12);
+ if (!businessConnectionId.empty()) {
+ args.emplace_back("business_connection_id", businessConnectionId);
+ }
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
args.emplace_back("message_thread_id", messageThreadId);
@@ -630,11 +694,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,18 +706,21 @@ 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> thumb,
+ boost::variant<InputFile::Ptr, std::string> thumbnail,
GenericReply::Ptr replyMarkup,
- bool allowSendingWithoutReply,
+ std::int32_t messageThreadId,
bool protectContent,
- std::int32_t messageThreadId) const {
+ const std::string& businessConnectionId) const {
std::vector<HttpReqArg> args;
args.reserve(11);
+ if (!businessConnectionId.empty()) {
+ args.emplace_back("business_connection_id", businessConnectionId);
+ }
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
args.emplace_back("message_thread_id", messageThreadId);
@@ -673,13 +737,13 @@ Message::Ptr Api::sendVideoNote(boost::variant<std::int64_t, std::string> chatId
if (length) {
args.emplace_back("length", length);
}
- if (thumb.which() == 0) { // InputFile::Ptr
- auto file = boost::get<InputFile::Ptr>(thumb);
- args.emplace_back("thumb", file->data, true, file->mimeType, file->fileName);
+ if (thumbnail.which() == 0) { // InputFile::Ptr
+ auto file = boost::get<InputFile::Ptr>(thumbnail);
+ args.emplace_back("thumbnail", file->data, true, file->mimeType, file->fileName);
} else { // std::string
- auto thumbStr = boost::get<std::string>(thumb);
- if (!thumbStr.empty()) {
- args.emplace_back("thumb", thumbStr);
+ auto thumbnailStr = boost::get<std::string>(thumbnail);
+ if (!thumbnailStr.empty()) {
+ args.emplace_back("thumbnail", thumbnailStr);
}
}
if (disableNotification) {
@@ -688,11 +752,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,13 +765,16 @@ 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,
+ ReplyParameters::Ptr replyParameters,
+ std::int32_t messageThreadId,
bool protectContent,
- std::int32_t messageThreadId) const {
+ const std::string& businessConnectionId) const {
std::vector<HttpReqArg> args;
args.reserve(7);
+ if (!businessConnectionId.empty()) {
+ args.emplace_back("business_connection_id", businessConnectionId);
+ }
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
args.emplace_back("message_thread_id", messageThreadId);
@@ -722,11 +786,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,18 +797,21 @@ 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,
+ std::int32_t messageThreadId,
bool protectContent,
- std::int32_t messageThreadId) const {
+ const std::string& businessConnectionId) const {
std::vector<HttpReqArg> args;
args.reserve(13);
+ if (!businessConnectionId.empty()) {
+ args.emplace_back("business_connection_id", businessConnectionId);
+ }
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
args.emplace_back("message_thread_id", messageThreadId);
@@ -772,11 +836,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));
@@ -797,8 +858,14 @@ Message::Ptr Api::editMessageLiveLocation(float latitude,
std::vector<HttpReqArg> args;
args.reserve(9);
- if ((boost::get<std::int64_t>(chatId) != 0) || (boost::get<std::string>(chatId) != "")) {
- args.emplace_back("chat_id", chatId);
+ if (chatId.which() == 0) { // std::int64_t
+ if (boost::get<std::int64_t>(chatId) != 0) {
+ args.emplace_back("chat_id", chatId);
+ }
+ } else { // std::string
+ if (boost::get<std::string>(chatId) != "") {
+ args.emplace_back("chat_id", chatId);
+ }
}
if (messageId) {
args.emplace_back("message_id", messageId);
@@ -831,8 +898,14 @@ Message::Ptr Api::stopMessageLiveLocation(boost::variant<std::int64_t, std::stri
std::vector<HttpReqArg> args;
args.reserve(4);
- if ((boost::get<std::int64_t>(chatId) != 0) || (boost::get<std::string>(chatId) != "")) {
- args.emplace_back("chat_id", chatId);
+ if (chatId.which() == 0) { // std::int64_t
+ if (boost::get<std::int64_t>(chatId) != 0) {
+ args.emplace_back("chat_id", chatId);
+ }
+ } else { // std::string
+ if (boost::get<std::string>(chatId) != "") {
+ args.emplace_back("chat_id", chatId);
+ }
}
if (messageId) {
args.emplace_back("message_id", messageId);
@@ -855,16 +928,19 @@ 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,
+ std::int32_t messageThreadId,
bool protectContent,
- std::int32_t messageThreadId) const {
+ const std::string& businessConnectionId) const {
std::vector<HttpReqArg> args;
args.reserve(15);
+ if (!businessConnectionId.empty()) {
+ args.emplace_back("business_connection_id", businessConnectionId);
+ }
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
args.emplace_back("message_thread_id", messageThreadId);
@@ -891,11 +967,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));
@@ -910,14 +983,17 @@ 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,
+ std::int32_t messageThreadId,
bool protectContent,
- std::int32_t messageThreadId) const {
+ const std::string& businessConnectionId) const {
std::vector<HttpReqArg> args;
args.reserve(11);
+ if (!businessConnectionId.empty()) {
+ args.emplace_back("business_connection_id", businessConnectionId);
+ }
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
args.emplace_back("message_thread_id", messageThreadId);
@@ -936,11 +1012,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));
@@ -953,7 +1026,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,
@@ -965,12 +1038,15 @@ Message::Ptr Api::sendPoll(boost::variant<std::int64_t, std::string> chatId,
std::int32_t openPeriod,
std::int32_t closeDate,
bool isClosed,
- bool allowSendingWithoutReply,
+ std::int32_t messageThreadId,
bool protectContent,
- std::int32_t messageThreadId) const {
+ const std::string& businessConnectionId) const {
std::vector<HttpReqArg> args;
args.reserve(19);
+ if (!businessConnectionId.empty()) {
+ args.emplace_back("business_connection_id", businessConnectionId);
+ }
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
args.emplace_back("message_thread_id", messageThreadId);
@@ -1016,11 +1092,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));
@@ -1031,15 +1104,18 @@ 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,
+ std::int32_t messageThreadId,
bool protectContent,
- std::int32_t messageThreadId) const {
+ const std::string& businessConnectionId) const {
std::vector<HttpReqArg> args;
args.reserve(8);
+ if (!businessConnectionId.empty()) {
+ args.emplace_back("business_connection_id", businessConnectionId);
+ }
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
args.emplace_back("message_thread_id", messageThreadId);
@@ -1053,11 +1129,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));
@@ -1066,12 +1139,35 @@ 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 {
+ std::int32_t messageThreadId,
+ const std::string& businessConnectionId) const {
std::vector<HttpReqArg> args;
- args.reserve(3);
+ args.reserve(4);
+ if (!businessConnectionId.empty()) {
+ args.emplace_back("business_connection_id", businessConnectionId);
+ }
args.emplace_back("chat_id", chatId);
args.emplace_back("action", action);
if (messageThreadId != 0) {
@@ -1144,7 +1240,7 @@ bool Api::unbanChatMember(boost::variant<std::int64_t, std::string> chatId,
bool Api::restrictChatMember(boost::variant<std::int64_t, std::string> chatId,
std::int64_t userId,
TgBot::ChatPermissions::Ptr permissions,
- std::int64_t untilDate,
+ std::uint32_t untilDate,
bool useIndependentChatPermissions) const {
std::vector<HttpReqArg> args;
args.reserve(5);
@@ -1152,10 +1248,10 @@ bool Api::restrictChatMember(boost::variant<std::int64_t, std::string> chatId,
args.emplace_back("chat_id", chatId);
args.emplace_back("user_id", userId);
args.emplace_back("permissions", _tgTypeParser.parseChatPermissions(permissions));
- if (useIndependentChatPermissions) {
+ if (useIndependentChatPermissions != false) {
args.emplace_back("use_independent_chat_permissions", useIndependentChatPermissions);
}
- if (untilDate) {
+ if (untilDate != 0) {
args.emplace_back("until_date", untilDate);
}
@@ -1175,46 +1271,58 @@ bool Api::promoteChatMember(boost::variant<std::int64_t, std::string> chatId,
bool canManageChat,
bool canManageVideoChats,
bool canRestrictMembers,
- bool canManageTopics) const {
+ bool canManageTopics,
+ bool canPostStories,
+ bool canEditStories,
+ bool canDeleteStories) const {
std::vector<HttpReqArg> args;
- args.reserve(14);
+ args.reserve(17);
args.emplace_back("chat_id", chatId);
args.emplace_back("user_id", userId);
- if (isAnonymous) {
+ if (isAnonymous != false) {
args.emplace_back("is_anonymous", isAnonymous);
}
- if (canManageChat) {
+ if (canManageChat != false) {
args.emplace_back("can_manage_chat", canManageChat);
}
- if (canPostMessages) {
+ if (canPostMessages != false) {
args.emplace_back("can_post_messages", canPostMessages);
}
- if (canEditMessages) {
+ if (canEditMessages != false) {
args.emplace_back("can_edit_messages", canEditMessages);
}
- if (canDeleteMessages) {
+ if (canDeleteMessages != false) {
args.emplace_back("can_delete_messages", canDeleteMessages);
}
- if (canManageVideoChats) {
+ if (canPostStories != false) {
+ args.emplace_back("can_post_stories", canPostStories);
+ }
+ if (canEditStories != false) {
+ args.emplace_back("can_edit_stories", canEditStories);
+ }
+ if (canDeleteStories != false) {
+ args.emplace_back("can_delete_stories", canDeleteStories);
+ }
+ if (canManageVideoChats != false) {
args.emplace_back("can_manage_video_chats", canManageVideoChats);
}
- if (canRestrictMembers) {
+ if (canRestrictMembers != false) {
args.emplace_back("can_restrict_members", canRestrictMembers);
}
- if (canPromoteMembers) {
+ if (canPromoteMembers != false) {
args.emplace_back("can_promote_members", canPromoteMembers);
}
- if (canChangeInfo) {
+ if (canChangeInfo != false) {
args.emplace_back("can_change_info", canChangeInfo);
}
- if (canInviteUsers) {
+ if (canInviteUsers != false) {
args.emplace_back("can_invite_users", canInviteUsers);
}
- if (canPinMessages) {
+ if (canPinMessages != false) {
args.emplace_back("can_pin_messages", canPinMessages);
}
- if (canManageTopics) {
+ if (canManageTopics != false) {
args.emplace_back("can_manage_topics", canManageTopics);
}
@@ -1539,7 +1647,7 @@ ForumTopic::Ptr Api::createForumTopic(boost::variant<std::int64_t, std::string>
bool Api::editForumTopic(boost::variant<std::int64_t, std::string> chatId,
std::int32_t messageThreadId,
const std::string& name,
- boost::variant<std::int8_t, std::string> iconCustomEmojiId) const {
+ boost::variant<std::int32_t, std::string> iconCustomEmojiId) const {
std::vector<HttpReqArg> args;
args.reserve(4);
@@ -1548,8 +1656,14 @@ bool Api::editForumTopic(boost::variant<std::int64_t, std::string> chatId,
if (!name.empty()) {
args.emplace_back("name", name);
}
- if (iconCustomEmojiId.which() == 1) { // std::string
- args.emplace_back("icon_custom_emoji_id", boost::get<std::string>(iconCustomEmojiId));
+ if (iconCustomEmojiId.which() == 0) { // std::int32_t
+ if (boost::get<std::int32_t>(iconCustomEmojiId) != 0) {
+ args.emplace_back("icon_custom_emoji_id", iconCustomEmojiId);
+ }
+ } else { // std::string
+ if (boost::get<std::string>(iconCustomEmojiId) != "") {
+ args.emplace_back("icon_custom_emoji_id", iconCustomEmojiId);
+ }
}
return sendRequest("editForumTopic", args).get<bool>("", false);
@@ -1646,6 +1760,15 @@ bool Api::unhideGeneralForumTopic(boost::variant<std::int64_t, std::string> chat
return sendRequest("unhideGeneralForumTopic", args).get<bool>("", false);
}
+bool Api::unpinAllGeneralForumTopicMessages(boost::variant<std::int64_t, std::string> chatId) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(1);
+
+ args.emplace_back("chat_id", chatId);
+
+ return sendRequest("unpinAllGeneralForumTopicMessages", args).get<bool>("", false);
+}
+
bool Api::answerCallbackQuery(const std::string& callbackQueryId,
const std::string& text,
bool showAlert,
@@ -1671,6 +1794,26 @@ 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));
+}
+
+BusinessConnection::Ptr Api::getBusinessConnection(const std::string& businessConnectionId) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(1);
+
+ args.emplace_back("business_connection_id", businessConnectionId);
+
+ return _tgTypeParser.parseJsonAndGetBusinessConnection(sendRequest("getBusinessConnection", args));
+}
+
bool Api::setMyCommands(const std::vector<BotCommand::Ptr>& commands,
BotCommandScope::Ptr scope,
const std::string& languageCode) const {
@@ -1689,7 +1832,7 @@ bool Api::setMyCommands(const std::vector<BotCommand::Ptr>& commands,
}
bool Api::deleteMyCommands(BotCommandScope::Ptr scope,
- const std::string& languageCode) const {
+ const std::string& languageCode) const {
std::vector<HttpReqArg> args;
args.reserve(2);
@@ -1707,7 +1850,7 @@ std::vector<BotCommand::Ptr> Api::getMyCommands(BotCommandScope::Ptr scope,
const std::string& languageCode) const {
std::vector<HttpReqArg> args;
args.reserve(2);
-;
+
if (scope != nullptr) {
args.emplace_back("scope", _tgTypeParser.parseBotCommandScope(scope));
}
@@ -1718,6 +1861,84 @@ std::vector<BotCommand::Ptr> Api::getMyCommands(BotCommandScope::Ptr scope,
return _tgTypeParser.parseJsonAndGetArray<BotCommand>(&TgTypeParser::parseJsonAndGetBotCommand, sendRequest("getMyCommands", args));
}
+bool Api::setMyName(const std::string& name,
+ const std::string& languageCode) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(2);
+
+ if (!name.empty()) {
+ args.emplace_back("name", name);
+ }
+ if (!languageCode.empty()) {
+ args.emplace_back("language_code", languageCode);
+ }
+
+ return sendRequest("setMyName", args).get<bool>("", false);
+}
+
+BotName::Ptr Api::getMyName(const std::string& languageCode) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(1);
+
+ if (!languageCode.empty()) {
+ args.emplace_back("language_code", languageCode);
+ }
+
+ return _tgTypeParser.parseJsonAndGetBotName(sendRequest("getMyName", args));
+}
+
+bool Api::setMyDescription(const std::string& description,
+ const std::string& languageCode) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(2);
+
+ if (!description.empty()) {
+ args.emplace_back("description", description);
+ }
+ if (!languageCode.empty()) {
+ args.emplace_back("language_code", languageCode);
+ }
+
+ return sendRequest("setMyDescription", args).get<bool>("", false);
+}
+
+BotDescription::Ptr Api::getMyDescription(const std::string& languageCode) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(1);
+
+ if (!languageCode.empty()) {
+ args.emplace_back("language_code", languageCode);
+ }
+
+ return _tgTypeParser.parseJsonAndGetBotDescription(sendRequest("getMyDescription", args));
+}
+
+bool Api::setMyShortDescription(const std::string& shortDescription,
+ const std::string& languageCode) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(2);
+
+ if (!shortDescription.empty()) {
+ args.emplace_back("short_description", shortDescription);
+ }
+ if (!languageCode.empty()) {
+ args.emplace_back("language_code", languageCode);
+ }
+
+ return sendRequest("setMyShortDescription", args).get<bool>("", false);
+}
+
+BotShortDescription::Ptr Api::getMyShortDescription(const std::string& languageCode) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(1);
+
+ if (!languageCode.empty()) {
+ args.emplace_back("language_code", languageCode);
+ }
+
+ return _tgTypeParser.parseJsonAndGetBotShortDescription(sendRequest("getMyShortDescription", args));
+}
+
bool Api::setChatMenuButton(std::int64_t chatId,
MenuButton::Ptr menuButton) const {
std::vector<HttpReqArg> args;
@@ -1775,14 +1996,20 @@ Message::Ptr Api::editMessageText(const std::string& text,
std::int32_t messageId,
const std::string& inlineMessageId,
const std::string& parseMode,
- bool disableWebPagePreview,
- GenericReply::Ptr replyMarkup,
+ LinkPreviewOptions::Ptr linkPreviewOptions,
+ InlineKeyboardMarkup::Ptr replyMarkup,
const std::vector<MessageEntity::Ptr>& entities) const {
std::vector<HttpReqArg> args;
args.reserve(8);
- if ((boost::get<std::int64_t>(chatId) != 0) || (boost::get<std::string>(chatId) != "")) {
- args.emplace_back("chat_id", chatId);
+ if (chatId.which() == 0) { // std::int64_t
+ if (boost::get<std::int64_t>(chatId) != 0) {
+ args.emplace_back("chat_id", chatId);
+ }
+ } else { // std::string
+ if (boost::get<std::string>(chatId) != "") {
+ args.emplace_back("chat_id", chatId);
+ }
}
if (messageId) {
args.emplace_back("message_id", messageId);
@@ -1797,11 +2024,11 @@ 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.parseGenericReply(replyMarkup));
+ args.emplace_back("reply_markup", _tgTypeParser.parseInlineKeyboardMarkup(replyMarkup));
}
boost::property_tree::ptree p = sendRequest("editMessageText", args);
@@ -1822,8 +2049,14 @@ Message::Ptr Api::editMessageCaption(boost::variant<std::int64_t, std::string> c
std::vector<HttpReqArg> args;
args.reserve(7);
- if ((boost::get<std::int64_t>(chatId) != 0) || (boost::get<std::string>(chatId) != "")) {
- args.emplace_back("chat_id", chatId);
+ if (chatId.which() == 0) { // std::int64_t
+ if (boost::get<std::int64_t>(chatId) != 0) {
+ args.emplace_back("chat_id", chatId);
+ }
+ } else { // std::string
+ if (boost::get<std::string>(chatId) != "") {
+ args.emplace_back("chat_id", chatId);
+ }
}
if (messageId) {
args.emplace_back("message_id", messageId);
@@ -1861,10 +2094,16 @@ Message::Ptr Api::editMessageMedia(InputMedia::Ptr media,
std::vector<HttpReqArg> args;
args.reserve(5);
- args.emplace_back("media", _tgTypeParser.parseInputMedia(media));
- if ((boost::get<std::int64_t>(chatId) != 0) || (boost::get<std::string>(chatId) != "")) {
- args.emplace_back("chat_id", chatId);
+ if (chatId.which() == 0) { // std::int64_t
+ if (boost::get<std::int64_t>(chatId) != 0) {
+ args.emplace_back("chat_id", chatId);
+ }
+ } else { // std::string
+ if (boost::get<std::string>(chatId) != "") {
+ args.emplace_back("chat_id", chatId);
+ }
}
+ args.emplace_back("media", _tgTypeParser.parseInputMedia(media));
if (messageId) {
args.emplace_back("message_id", messageId);
}
@@ -1891,8 +2130,14 @@ Message::Ptr Api::editMessageReplyMarkup(boost::variant<std::int64_t, std::strin
std::vector<HttpReqArg> args;
args.reserve(4);
- if ((boost::get<std::int64_t>(chatId) != 0) || (boost::get<std::string>(chatId) != "")) {
- args.emplace_back("chat_id", chatId);
+ if (chatId.which() == 0) { // std::int64_t
+ if (boost::get<std::int64_t>(chatId) != 0) {
+ args.emplace_back("chat_id", chatId);
+ }
+ } else { // std::string
+ if (boost::get<std::string>(chatId) != "") {
+ args.emplace_back("chat_id", chatId);
+ }
}
if (messageId) {
args.emplace_back("message_id", messageId);
@@ -1938,17 +2183,37 @@ 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,
+ std::int32_t messageThreadId,
bool protectContent,
- std::int32_t messageThreadId) const {
+ const std::string& emoji,
+ const std::string& businessConnectionId) const {
std::vector<HttpReqArg> args;
- args.reserve(8);
+ args.reserve(9);
+ if (!businessConnectionId.empty()) {
+ args.emplace_back("business_connection_id", businessConnectionId);
+ }
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
args.emplace_back("message_thread_id", messageThreadId);
@@ -1959,17 +2224,17 @@ Message::Ptr Api::sendSticker(boost::variant<std::int64_t, std::string> chatId,
} else { // std::string
args.emplace_back("sticker", boost::get<std::string>(sticker));
}
+ if (!emoji.empty()) {
+ args.emplace_back("emoji", emoji);
+ }
if (disableNotification) {
args.emplace_back("disable_notification", disableNotification);
}
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));
@@ -1991,7 +2256,8 @@ std::vector<Sticker::Ptr> Api::getCustomEmojiStickers(const std::vector<std::str
std::vector<HttpReqArg> args;
args.reserve(1);
- args.emplace_back("custom_emoji_ids", _tgTypeParser.parseArray<std::string>([] (const std::string& customEmojiId) -> std::string {
+ args.emplace_back("custom_emoji_ids", _tgTypeParser.parseArray<std::string>(
+ [] (const std::string& customEmojiId) -> std::string {
return "\"" + StringTools::escapeJsonString(customEmojiId) + "\"";
}, customEmojiIds));
@@ -1999,12 +2265,14 @@ std::vector<Sticker::Ptr> Api::getCustomEmojiStickers(const std::vector<std::str
}
File::Ptr Api::uploadStickerFile(std::int64_t userId,
- const InputFile::Ptr pngSticker) const {
+ InputFile::Ptr sticker,
+ const std::string& stickerFormat) const {
std::vector<HttpReqArg> args;
- args.reserve(2);
+ args.reserve(3);
args.emplace_back("user_id", userId);
- args.emplace_back("png_sticker", pngSticker->data, true, pngSticker->mimeType, pngSticker->fileName);
+ args.emplace_back("sticker", sticker->data, true, sticker->mimeType, sticker->fileName);
+ args.emplace_back("sticker_format", stickerFormat);
return _tgTypeParser.parseJsonAndGetFile(sendRequest("uploadStickerFile", args));
}
@@ -2012,70 +2280,39 @@ File::Ptr Api::uploadStickerFile(std::int64_t userId,
bool Api::createNewStickerSet(std::int64_t userId,
const std::string& name,
const std::string& title,
- const std::string& emojis,
- MaskPosition::Ptr maskPosition,
- boost::variant<InputFile::Ptr, std::string> pngSticker,
- InputFile::Ptr tgsSticker,
- InputFile::Ptr webmSticker,
- const std::string& stickerType) const {
+ const std::vector<InputSticker::Ptr>& stickers,
+ Sticker::Type stickerType,
+ bool needsRepainting) const {
std::vector<HttpReqArg> args;
- args.reserve(10);
+ args.reserve(6);
args.emplace_back("user_id", userId);
args.emplace_back("name", name);
args.emplace_back("title", title);
- if (pngSticker.which() == 0) { // InputFile::Ptr
- auto file = boost::get<InputFile::Ptr>(pngSticker);
- args.emplace_back("png_sticker", file->data, true, file->mimeType, file->fileName);
- } else { // std::string
- args.emplace_back("png_sticker", boost::get<std::string>(pngSticker));
- }
- if (tgsSticker != nullptr) {
- args.emplace_back("tgs_sticker", tgsSticker->data, true, tgsSticker->mimeType, tgsSticker->fileName);
+ args.emplace_back("stickers", _tgTypeParser.parseArray<InputSticker>(&TgTypeParser::parseInputSticker, stickers));
+ if (stickerType == Sticker::Type::Regular) {
+ args.emplace_back("sticker_type", "regular");
+ } else if (stickerType == Sticker::Type::Mask) {
+ args.emplace_back("sticker_type", "mask");
+ } else if (stickerType == Sticker::Type::CustomEmoji) {
+ args.emplace_back("sticker_type", "custom_emoji");
}
- if (webmSticker != nullptr) {
- args.emplace_back("webm_sticker", webmSticker->data, true, webmSticker->mimeType, webmSticker->fileName);
- }
- if (!stickerType.empty()) {
- args.emplace_back("sticker_type", stickerType);
- }
- args.emplace_back("emojis", emojis);
- if (maskPosition != nullptr) {
- args.emplace_back("mask_position", _tgTypeParser.parseMaskPosition(maskPosition));
+ if (needsRepainting) {
+ args.emplace_back("needs_repainting", needsRepainting);
}
return sendRequest("createNewStickerSet", args).get<bool>("", false);
}
bool Api::addStickerToSet(std::int64_t userId,
- const std::string& name,
- const std::string& emojis,
- MaskPosition::Ptr maskPosition,
- boost::variant<InputFile::Ptr, std::string> pngSticker,
- InputFile::Ptr tgsSticker,
- InputFile::Ptr webmSticker) const {
+ const std::string& name,
+ InputSticker::Ptr sticker) const {
std::vector<HttpReqArg> args;
- args.reserve(7);
+ args.reserve(3);
args.emplace_back("user_id", userId);
args.emplace_back("name", name);
-
- if (pngSticker.which() == 0) { // InputFile::Ptr
- auto file = boost::get<InputFile::Ptr>(pngSticker);
- args.emplace_back("png_sticker", file->data, true, file->mimeType, file->fileName);
- } else { // std::string
- args.emplace_back("png_sticker", boost::get<std::string>(pngSticker));
- }
- if (tgsSticker != nullptr) {
- args.emplace_back("tgs_sticker", tgsSticker->data, true, tgsSticker->mimeType, tgsSticker->fileName);
- }
- if (webmSticker != nullptr) {
- args.emplace_back("webm_sticker", webmSticker->data, true, webmSticker->mimeType, webmSticker->fileName);
- }
- args.emplace_back("emojis", emojis);
- if (maskPosition != nullptr) {
- args.emplace_back("mask_position", _tgTypeParser.parseMaskPosition(maskPosition));
- }
+ args.emplace_back("sticker", _tgTypeParser.parseInputSticker(sticker));
return sendRequest("addStickerToSet", args).get<bool>("", false);
}
@@ -2100,22 +2337,119 @@ bool Api::deleteStickerFromSet(const std::string& sticker) const {
return sendRequest("deleteStickerFromSet", args).get<bool>("", false);
}
-bool Api::setStickerSetThumb(const std::string& name,
- std::int64_t userId,
- boost::variant<InputFile::Ptr, std::string> thumb) const {
+bool Api::replaceStickerInSet(std::int64_t userId,
+ const std::string& name,
+ const std::string& oldSticker,
+ InputSticker::Ptr sticker) const {
std::vector<HttpReqArg> args;
- args.reserve(3);
+ args.reserve(4);
+
+ args.emplace_back("user_id", userId);
+ args.emplace_back("name", name);
+ args.emplace_back("old_sticker", oldSticker);
+ args.emplace_back("sticker", _tgTypeParser.parseInputSticker(sticker));
+
+ return sendRequest("replaceStickerInSet", args).get<bool>("", false);
+}
+
+bool Api::setStickerEmojiList(const std::string& sticker,
+ const std::vector<std::string>& emojiList) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(2);
+
+ args.emplace_back("sticker", sticker);
+ args.emplace_back("emoji_list", _tgTypeParser.parseArray<std::string>(
+ [](const std::string& emoji)->std::string {
+ return "\"" + StringTools::escapeJsonString(emoji) + "\"";
+ }, emojiList));
+
+ return sendRequest("setStickerEmojiList", args).get<bool>("", false);
+}
+
+bool Api::setStickerKeywords(const std::string& sticker,
+ const std::vector<std::string>& keywords) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(2);
+
+ args.emplace_back("sticker", sticker);
+ if (!keywords.empty()) {
+ args.emplace_back("keywords", _tgTypeParser.parseArray<std::string>(
+ [](const std::string& keyword)->std::string {
+ return "\"" + StringTools::escapeJsonString(keyword) + "\"";
+ }, keywords));
+ }
+
+ return sendRequest("setStickerKeywords", args).get<bool>("", false);
+}
+
+bool Api::setStickerMaskPosition(const std::string& sticker,
+ MaskPosition::Ptr maskPosition) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(2);
+
+ args.emplace_back("sticker", sticker);
+ if (maskPosition != nullptr) {
+ args.emplace_back("mask_position", _tgTypeParser.parseMaskPosition(maskPosition));
+ }
+
+ return sendRequest("setStickerMaskPosition", args).get<bool>("", false);
+}
+
+bool Api::setStickerSetTitle(const std::string& name,
+ const std::string& title) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(2);
+
+ args.emplace_back("name", name);
+ args.emplace_back("title", title);
+
+ return sendRequest("setStickerSetTitle", args).get<bool>("", false);
+}
+
+bool Api::setStickerSetThumbnail(const std::string& name,
+ std::int64_t userId,
+ const std::string& format,
+ boost::variant<InputFile::Ptr, std::string> thumbnail) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(4);
args.emplace_back("name", name);
args.emplace_back("user_id", userId);
- if (thumb.which() == 0) { // InputFile::Ptr
- auto file = boost::get<InputFile::Ptr>(thumb);
- args.emplace_back("thumb", file->data, true, file->mimeType, file->fileName);
+ args.emplace_back("format", format);
+ if (thumbnail.which() == 0) { // InputFile::Ptr
+ if (boost::get<InputFile::Ptr>(thumbnail) != nullptr) {
+ auto file = boost::get<InputFile::Ptr>(thumbnail);
+ args.emplace_back("thumbnail", file->data, true, file->mimeType, file->fileName);
+ }
} else { // std::string
- args.emplace_back("thumb", boost::get<std::string>(thumb));
+ if (boost::get<std::string>(thumbnail) != "") {
+ args.emplace_back("thumbnail", boost::get<std::string>(thumbnail));
+ }
+ }
+
+ return sendRequest("setStickerSetThumbnail", args).get<bool>("", false);
+}
+
+bool Api::setCustomEmojiStickerSetThumbnail(const std::string& name,
+ const std::string& customEmojiId) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(2);
+
+ args.emplace_back("name", name);
+ if (!customEmojiId.empty()) {
+ args.emplace_back("custom_emoji_id", customEmojiId);
}
- return sendRequest("setStickerSetThumb", args).get<bool>("", false);
+ return sendRequest("setCustomEmojiStickerSetThumbnail", args).get<bool>("", false);
+}
+
+bool Api::deleteStickerSet(const std::string& name) const {
+ std::vector<HttpReqArg> args;
+ args.reserve(1);
+
+ args.emplace_back("name", name);
+
+ return sendRequest("deleteStickerSet", args).get<bool>("", false);
}
bool Api::answerInlineQuery(const std::string& inlineQueryId,
@@ -2123,27 +2457,23 @@ bool Api::answerInlineQuery(const std::string& inlineQueryId,
std::int32_t cacheTime,
bool isPersonal,
const std::string& nextOffset,
- const std::string& switchPmText,
- const std::string& switchPmParameter) const {
+ InlineQueryResultsButton::Ptr button) const {
std::vector<HttpReqArg> args;
- args.reserve(7);
+ args.reserve(6);
args.emplace_back("inline_query_id", inlineQueryId);
args.emplace_back("results", _tgTypeParser.parseArray<InlineQueryResult>(&TgTypeParser::parseInlineQueryResult, results));
- if (cacheTime) {
+ if (cacheTime != 300) {
args.emplace_back("cache_time", cacheTime);
}
- if (isPersonal) {
+ if (isPersonal != false) {
args.emplace_back("is_personal", isPersonal);
}
if (!nextOffset.empty()) {
args.emplace_back("next_offset", nextOffset);
}
- if (!switchPmText.empty()) {
- args.emplace_back("switch_pm_text", switchPmText);
- }
- if (!switchPmParameter.empty()) {
- args.emplace_back("switch_pm_parameter", switchPmParameter);
+ if (button != nullptr) {
+ args.emplace_back("button", _tgTypeParser.parseInlineQueryResultsButton(button));
}
return sendRequest("answerInlineQuery", args).get<bool>("", false);
@@ -2179,17 +2509,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) {
@@ -2252,11 +2581,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));
@@ -2387,15 +2713,18 @@ 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,
+ std::int32_t messageThreadId,
bool protectContent,
- std::int32_t messageThreadId) const {
+ const std::string& businessConnectionId) const {
std::vector<HttpReqArg> args;
args.reserve(8);
+ if (!businessConnectionId.empty()) {
+ args.emplace_back("business_connection_id", businessConnectionId);
+ }
args.emplace_back("chat_id", chatId);
if (messageThreadId != 0) {
args.emplace_back("message_thread_id", messageThreadId);
@@ -2407,11 +2736,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 9e04851..d3e9bd9 100644
--- a/src/TgTypeParser.cpp
+++ b/src/TgTypeParser.cpp
@@ -9,6 +9,12 @@ 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->businessConnection = tryParseJson<BusinessConnection>(&TgTypeParser::parseJsonAndGetBusinessConnection, data, "business_connection");
+ result->businessMessage = tryParseJson<Message>(&TgTypeParser::parseJsonAndGetMessage, data, "business_message");
+ result->editedBusinessMessage = tryParseJson<Message>(&TgTypeParser::parseJsonAndGetMessage, data, "edited_business_message");
+ result->deletedBusinessMessages = tryParseJson<BusinessMessagesDeleted>(&TgTypeParser::parseJsonAndGetBusinessMessagesDeleted, data, "deleted_business_messages");
+ 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 +25,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 +41,12 @@ 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, "business_connection", parseBusinessConnection(object->businessConnection));
+ appendToJson(result, "business_message", parseMessage(object->businessMessage));
+ appendToJson(result, "edited_business_message", parseMessage(object->editedBusinessMessage));
+ appendToJson(result, "deleted_business_messages", parseBusinessMessagesDeleted(object->deletedBusinessMessages));
+ 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 +57,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;
@@ -61,8 +77,7 @@ WebhookInfo::Ptr TgTypeParser::parseJsonAndGetWebhookInfo(const boost::property_
result->allowedUpdates = parseJsonAndGetArray<std::string>(
[] (const boost::property_tree::ptree& innerData)->std::string {
return innerData.get<std::string>("");
- }
- , data, "allowed_updates");
+ }, data, "allowed_updates");
return result;
}
@@ -80,11 +95,10 @@ std::string TgTypeParser::parseWebhookInfo(const WebhookInfo::Ptr& object) const
appendToJson(result, "last_error_message", object->lastErrorMessage);
appendToJson(result, "last_synchronization_error_date", object->lastSynchronizationErrorDate);
appendToJson(result, "max_connections", object->maxConnections);
- appendToJson(result, "allowed_updates",
- parseArray<std::string>([] (const std::string& s)->std::string {
+ appendToJson(result, "allowed_updates", parseArray<std::string>(
+ [] (const std::string& s)->std::string {
return s;
- }
- , object->allowedUpdates));
+ }, object->allowedUpdates));
removeLastComma(result);
result += '}';
return result;
@@ -103,6 +117,7 @@ User::Ptr TgTypeParser::parseJsonAndGetUser(const boost::property_tree::ptree& d
result->canJoinGroups = data.get<bool>("can_join_groups", false);
result->canReadAllGroupMessages = data.get<bool>("can_read_all_group_messages", false);
result->supportsInlineQueries = data.get<bool>("supports_inline_queries", false);
+ result->canConnectToBusiness = data.get<bool>("can_connect_to_business", false);
return result;
}
@@ -123,6 +138,7 @@ std::string TgTypeParser::parseUser(const User::Ptr& object) const {
appendToJson(result, "can_join_groups", object->canJoinGroups);
appendToJson(result, "can_read_all_group_messages", object->canReadAllGroupMessages);
appendToJson(result, "supports_inline_queries", object->supportsInlineQueries);
+ appendToJson(result, "can_connect_to_business", object->canConnectToBusiness);
removeLastComma(result);
result += '}';
return result;
@@ -151,7 +167,18 @@ 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->birthdate = tryParseJson<Birthdate>(&TgTypeParser::parseJsonAndGetBirthdate, data, "birthdate");
+ result->businessIntro = tryParseJson<BusinessIntro>(&TgTypeParser::parseJsonAndGetBusinessIntro, data, "business_intro");
+ result->businessLocation = tryParseJson<BusinessLocation>(&TgTypeParser::parseJsonAndGetBusinessLocation, data, "business_location");
+ result->businessOpeningHours = tryParseJson<BusinessOpeningHours>(&TgTypeParser::parseJsonAndGetBusinessOpeningHours, data, "business_opening_hours");
+ result->personalChat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "personal_chat");
+ 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::uint32_t>("emoji_status_expiration_date", 0);
result->bio = data.get<std::string>("bio", "");
result->hasPrivateForwards = data.get<bool>("has_private_forwards", false);
result->hasRestrictedVoiceAndVideoMessages = data.get<bool>("has_restricted_voice_and_video_messages", false);
@@ -162,12 +189,15 @@ Chat::Ptr TgTypeParser::parseJsonAndGetChat(const boost::property_tree::ptree& d
result->pinnedMessage = tryParseJson<Message>(&TgTypeParser::parseJsonAndGetMessage, data, "pinned_message");
result->permissions = tryParseJson<ChatPermissions>(&TgTypeParser::parseJsonAndGetChatPermissions, data, "permissions");
result->slowModeDelay = data.get<std::int32_t>("slow_mode_delay", 0);
+ result->unrestrictBoostCount = data.get<std::int32_t>("unrestrict_boost_count", 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->customEmojiStickerSetName = data.get<std::string>("custom_emoji_sticker_set_name", "");
result->linkedChatId = data.get<std::int64_t>("linked_chat_id", 0);
result->location = tryParseJson<ChatLocation>(&TgTypeParser::parseJsonAndGetChatLocation, data, "location");
return result;
@@ -195,11 +225,22 @@ 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, "birthdate", parseBirthdate(object->birthdate));
+ appendToJson(result, "business_intro", parseBusinessIntro(object->businessIntro));
+ appendToJson(result, "business_location", parseBusinessLocation(object->businessLocation));
+ appendToJson(result, "business_opening_hours", parseBusinessOpeningHours(object->businessOpeningHours));
+ appendToJson(result, "personal_chat", parseChat(object->personalChat));
+ 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);
appendToJson(result, "has_private_forwards", object->hasPrivateForwards);
appendToJson(result, "has_restricted_voice_and_video_messages", object->hasRestrictedVoiceAndVideoMessages);
@@ -210,12 +251,15 @@ std::string TgTypeParser::parseChat(const Chat::Ptr& object) const {
appendToJson(result, "pinned_message", parseMessage(object->pinnedMessage));
appendToJson(result, "permissions", parseChatPermissions(object->permissions));
appendToJson(result, "slow_mode_delay", object->slowModeDelay);
+ appendToJson(result, "unrestrict_boost_count", object->unrestrictBoostCount);
appendToJson(result, "message_auto_delete_time", object->messageAutoDeleteTime);
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, "custom_emoji_sticker_set_name", object->customEmojiStickerSetName);
appendToJson(result, "linked_chat_id", object->linkedChatId);
appendToJson(result, "location", parseChatLocation(object->location));
removeLastComma(result);
@@ -229,29 +273,33 @@ 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::int32_t>("date", 0);
+ result->senderBoostCount = data.get<std::int32_t>("sender_boost_count", 0);
+ result->senderBusinessBot = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "sender_business_bot");
+ result->date = data.get<std::uint32_t>("date", 0);
+ result->businessConnectionId = data.get<std::string>("business_connection_id", "");
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::int32_t>("forward_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->replyToStory = tryParseJson<Story>(&TgTypeParser::parseJsonAndGetStory, data, "reply_to_story");
result->viaBot = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "via_bot");
- result->editDate = data.get<std::int32_t>("edit_date", 0);
+ result->editDate = data.get<std::uint32_t>("edit_date", 0);
result->hasProtectedContent = data.get<bool>("has_protected_content", false);
+ result->isFromOffline = data.get<bool>("is_from_offline", 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");
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");
@@ -278,18 +326,23 @@ 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");
result->passportData = tryParseJson<PassportData>(&TgTypeParser::parseJsonAndGetPassportData, data, "passport_data");
result->proximityAlertTriggered = tryParseJson<ProximityAlertTriggered>(&TgTypeParser::parseJsonAndGetProximityAlertTriggered, data, "proximity_alert_triggered");
+ result->boostAdded = tryParseJson<ChatBoostAdded>(&TgTypeParser::parseJsonAndGetChatBoostAdded, data, "boost_added");
result->forumTopicCreated = tryParseJson<ForumTopicCreated>(&TgTypeParser::parseJsonAndGetForumTopicCreated, data, "forum_topic_created");
result->forumTopicEdited = tryParseJson<ForumTopicEdited>(&TgTypeParser::parseJsonAndGetForumTopicEdited, data, "forum_topic_edited");
result->forumTopicClosed = tryParseJson<ForumTopicClosed>(&TgTypeParser::parseJsonAndGetForumTopicClosed, data, "forum_topic_closed");
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");
@@ -309,29 +362,33 @@ std::string TgTypeParser::parseMessage(const Message::Ptr& object) const {
appendToJson(result, "message_thread_id", object->messageThreadId);
appendToJson(result, "from", parseUser(object->from));
appendToJson(result, "sender_chat", parseChat(object->senderChat));
+ appendToJson(result, "sender_boost_count", object->senderBoostCount);
+ appendToJson(result, "sender_business_bot", parseUser(object->senderBusinessBot));
appendToJson(result, "date", object->date);
+ appendToJson(result, "business_connection_id", object->businessConnectionId);
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, "reply_to_story", parseStory(object->replyToStory));
appendToJson(result, "via_bot", parseUser(object->viaBot));
appendToJson(result, "edit_date", object->editDate);
appendToJson(result, "has_protected_content", object->hasProtectedContent);
+ appendToJson(result, "is_from_offline", object->isFromOffline);
appendToJson(result, "media_group_id", object->mediaGroupId);
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));
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));
@@ -358,18 +415,23 @@ 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));
appendToJson(result, "passport_data", parsePassportData(object->passportData));
appendToJson(result, "proximity_alert_triggered", parseProximityAlertTriggered(object->proximityAlertTriggered));
+ appendToJson(result, "boost_added", parseChatBoostAdded(object->boostAdded));
appendToJson(result, "forum_topic_created", parseForumTopicCreated(object->forumTopicCreated));
appendToJson(result, "forum_topic_edited", parseForumTopicEdited(object->forumTopicEdited));
appendToJson(result, "forum_topic_closed", parseForumTopicClosed(object->forumTopicClosed));
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));
@@ -399,6 +461,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", "");
@@ -426,6 +510,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") {
@@ -476,6 +562,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) {
@@ -498,6 +586,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", "");
@@ -531,7 +863,7 @@ Animation::Ptr TgTypeParser::parseJsonAndGetAnimation(const boost::property_tree
result->width = data.get<std::int32_t>("width", 0);
result->height = data.get<std::int32_t>("height", 0);
result->duration = data.get<std::int32_t>("duration", 0);
- result->thumb = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumb");
+ result->thumbnail = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumbnail");
result->fileName = data.get<std::string>("file_name", "");
result->mimeType = data.get<std::string>("mime_type", "");
result->fileSize = data.get<std::int64_t>("file_size", 0);
@@ -549,7 +881,7 @@ std::string TgTypeParser::parseAnimation(const Animation::Ptr& object) const {
appendToJson(result, "width", object->width);
appendToJson(result, "height", object->height);
appendToJson(result, "duration", object->duration);
- appendToJson(result, "thumb", parsePhotoSize(object->thumb));
+ appendToJson(result, "thumbnail", parsePhotoSize(object->thumbnail));
appendToJson(result, "file_name", object->fileName);
appendToJson(result, "mime_type", object->mimeType);
appendToJson(result, "file_size", object->fileSize);
@@ -568,7 +900,7 @@ Audio::Ptr TgTypeParser::parseJsonAndGetAudio(const boost::property_tree::ptree&
result->fileName = data.get<std::string>("file_name", "");
result->mimeType = data.get<std::string>("mime_type", "");
result->fileSize = data.get<std::int64_t>("file_size", 0);
- result->thumb = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumb");
+ result->thumbnail = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumbnail");
return result;
}
@@ -586,7 +918,7 @@ std::string TgTypeParser::parseAudio(const Audio::Ptr& object) const {
appendToJson(result, "file_name", object->fileName);
appendToJson(result, "mime_type", object->mimeType);
appendToJson(result, "file_size", object->fileSize);
- appendToJson(result, "thumb", parsePhotoSize(object->thumb));
+ appendToJson(result, "thumbnail", parsePhotoSize(object->thumbnail));
removeLastComma(result);
result += '}';
return result;
@@ -596,7 +928,7 @@ Document::Ptr TgTypeParser::parseJsonAndGetDocument(const boost::property_tree::
auto result(std::make_shared<Document>());
result->fileId = data.get<std::string>("file_id", "");
result->fileUniqueId = data.get<std::string>("file_unique_id", "");
- result->thumb = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumb");
+ result->thumbnail = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumbnail");
result->fileName = data.get<std::string>("file_name", "");
result->mimeType = data.get<std::string>("mime_type", "");
result->fileSize = data.get<std::int64_t>("file_size", 0);
@@ -611,7 +943,7 @@ std::string TgTypeParser::parseDocument(const Document::Ptr& object) const {
result += '{';
appendToJson(result, "file_id", object->fileId);
appendToJson(result, "file_unique_id", object->fileUniqueId);
- appendToJson(result, "thumb", parsePhotoSize(object->thumb));
+ appendToJson(result, "thumbnail", parsePhotoSize(object->thumbnail));
appendToJson(result, "file_name", object->fileName);
appendToJson(result, "mime_type", object->mimeType);
appendToJson(result, "file_size", object->fileSize);
@@ -620,6 +952,26 @@ std::string TgTypeParser::parseDocument(const Document::Ptr& object) const {
return result;
}
+Story::Ptr TgTypeParser::parseJsonAndGetStory(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<Story>());
+ result->chat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "chat");
+ result->id = data.get<std::int32_t>("id", 0);
+ return result;
+}
+
+std::string TgTypeParser::parseStory(const Story::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "chat", parseChat(object->chat));
+ appendToJson(result, "id", object->id);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
Video::Ptr TgTypeParser::parseJsonAndGetVideo(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<Video>());
result->fileId = data.get<std::string>("file_id", "");
@@ -627,7 +979,7 @@ Video::Ptr TgTypeParser::parseJsonAndGetVideo(const boost::property_tree::ptree&
result->width = data.get<std::int32_t>("width", 0);
result->height = data.get<std::int32_t>("height", 0);
result->duration = data.get<std::int32_t>("duration", 0);
- result->thumb = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumb");
+ result->thumbnail = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumbnail");
result->fileName = data.get<std::string>("file_name", "");
result->mimeType = data.get<std::string>("mime_type", "");
result->fileSize = data.get<std::int64_t>("file_size", 0);
@@ -645,7 +997,7 @@ std::string TgTypeParser::parseVideo(const Video::Ptr& object) const {
appendToJson(result, "width", object->width);
appendToJson(result, "height", object->height);
appendToJson(result, "duration", object->duration);
- appendToJson(result, "thumb", parsePhotoSize(object->thumb));
+ appendToJson(result, "thumbnail", parsePhotoSize(object->thumbnail));
appendToJson(result, "file_name", object->fileName);
appendToJson(result, "mime_type", object->mimeType);
appendToJson(result, "file_size", object->fileSize);
@@ -660,8 +1012,8 @@ VideoNote::Ptr TgTypeParser::parseJsonAndGetVideoNote(const boost::property_tree
result->fileUniqueId = data.get<std::string>("file_unique_id", "");
result->length = data.get<std::int32_t>("length", 0);
result->duration = data.get<std::int32_t>("duration", 0);
- result->thumb = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumb");
- result->fileSize = data.get("file_size", 0);
+ result->thumbnail = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumbnail");
+ result->fileSize = data.get<std::int32_t>("file_size", 0);
return result;
}
@@ -675,7 +1027,7 @@ std::string TgTypeParser::parseVideoNote(const VideoNote::Ptr& object) const {
appendToJson(result, "file_unique_id", object->fileUniqueId);
appendToJson(result, "length", object->length);
appendToJson(result, "duration", object->duration);
- appendToJson(result, "thumb", parsePhotoSize(object->thumb));
+ appendToJson(result, "thumbnail", parsePhotoSize(object->thumbnail));
appendToJson(result, "file_size", object->fileSize);
removeLastComma(result);
result += '}';
@@ -710,11 +1062,11 @@ std::string TgTypeParser::parseVoice(const Voice::Ptr& object) const {
Contact::Ptr TgTypeParser::parseJsonAndGetContact(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<Contact>());
- result->phoneNumber = data.get<std::string>("phone_number");
- result->firstName = data.get<std::string>("first_name");
- result->lastName = data.get("last_name", "");
- result->userId = data.get("user_id", 0);
- result->vcard = data.get("vcard", "");
+ result->phoneNumber = data.get<std::string>("phone_number", "");
+ result->firstName = data.get<std::string>("first_name", "");
+ result->lastName = data.get<std::string>("last_name", "");
+ result->userId = data.get<std::int64_t>("user_id", 0);
+ result->vcard = data.get<std::string>("vcard", "");
return result;
}
@@ -756,8 +1108,8 @@ std::string TgTypeParser::parseDice(const Dice::Ptr& object) const {
PollOption::Ptr TgTypeParser::parseJsonAndGetPollOption(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<PollOption>());
- result->text = data.get("text", "");
- result->voterCount = data.get("voter_count", 0);
+ result->text = data.get<std::string>("text", "");
+ result->voterCount = data.get<std::int32_t>("voter_count", 0);
return result;
}
@@ -777,6 +1129,7 @@ std::string TgTypeParser::parsePollOption(const PollOption::Ptr& object) const {
PollAnswer::Ptr TgTypeParser::parseJsonAndGetPollAnswer(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<PollAnswer>());
result->pollId = data.get<std::string>("poll_id", "");
+ result->voterChat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "voter_chat");
result->user = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "user");
result->optionIds = parseJsonAndGetArray<std::int32_t>(
[] (const boost::property_tree::ptree& innerData)->std::int32_t {
@@ -792,8 +1145,10 @@ std::string TgTypeParser::parsePollAnswer(const PollAnswer::Ptr& object) const {
std::string result;
result += '{';
appendToJson(result, "poll_id", object->pollId);
+ appendToJson(result, "voter_chat", parseChat(object->voterChat));
appendToJson(result, "user", parseUser(object->user));
- appendToJson(result, "option_ids", parseArray<std::int32_t>([] (std::int32_t i)->std::int32_t {
+ appendToJson(result, "option_ids", parseArray<std::int32_t>(
+ [] (std::int32_t i)->std::int32_t {
return i;
}, object->optionIds));
removeLastComma(result);
@@ -808,7 +1163,7 @@ Poll::Ptr TgTypeParser::parseJsonAndGetPoll(const boost::property_tree::ptree& d
result->options = parseJsonAndGetArray<PollOption>(&TgTypeParser::parseJsonAndGetPollOption, data, "options");
result->totalVoterCount = data.get<std::int32_t>("total_voter_count", 0);
result->isClosed = data.get<bool>("is_closed", false);
- result->isAnonymous = data.get<bool>("is_anonymous", true);
+ result->isAnonymous = data.get<bool>("is_anonymous", false);
result->type = data.get<std::string>("type", "");
result->allowsMultipleAnswers = data.get<bool>("allows_multiple_answers", false);
result->correctOptionId = data.get<std::int32_t>("correct_option_id", 0);
@@ -834,7 +1189,7 @@ std::string TgTypeParser::parsePoll(const Poll::Ptr& object) const {
appendToJson(result, "type", object->type);
appendToJson(result, "allows_multiple_answers", object->allowsMultipleAnswers);
appendToJson(result, "correct_option_id", object->correctOptionId);
- appendToJson(result, "explanation", object->correctOptionId);
+ appendToJson(result, "explanation", object->explanation);
appendToJson(result, "explanation_entities", parseArray(&TgTypeParser::parseMessageEntity, object->explanationEntities));
appendToJson(result, "open_period", object->openPeriod);
appendToJson(result, "close_date", object->closeDate);
@@ -845,8 +1200,8 @@ std::string TgTypeParser::parsePoll(const Poll::Ptr& object) const {
Location::Ptr TgTypeParser::parseJsonAndGetLocation(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<Location>());
- result->longitude = data.get<float>("longitude", 0);
result->latitude = data.get<float>("latitude", 0);
+ result->longitude = data.get<float>("longitude", 0);
result->horizontalAccuracy = data.get<float>("horizontal_accuracy", 0);
result->livePeriod = data.get<std::int32_t>("live_period", 0);
result->heading = data.get<std::int32_t>("heading", 0);
@@ -860,8 +1215,8 @@ std::string TgTypeParser::parseLocation(const Location::Ptr& object) const {
}
std::string result;
result += '{';
- appendToJson(result, "longitude", object->longitude);
appendToJson(result, "latitude", object->latitude);
+ appendToJson(result, "longitude", object->longitude);
appendToJson(result, "horizontal_accuracy", object->horizontalAccuracy);
appendToJson(result, "live_period", object->livePeriod);
appendToJson(result, "heading", object->heading);
@@ -961,6 +1316,24 @@ std::string TgTypeParser::parseMessageAutoDeleteTimerChanged(const MessageAutoDe
return result;
}
+ChatBoostAdded::Ptr TgTypeParser::parseJsonAndGetChatBoostAdded(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<ChatBoostAdded>());
+ result->boostCount = data.get<std::int32_t>("boost_count", 0);
+ return result;
+}
+
+std::string TgTypeParser::parseChatBoostAdded(const ChatBoostAdded::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "boost_count", object->boostCount);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
ForumTopicCreated::Ptr TgTypeParser::parseJsonAndGetForumTopicCreated(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<ForumTopicCreated>());
result->name = data.get<std::string>("name", "");
@@ -983,7 +1356,7 @@ std::string TgTypeParser::parseForumTopicCreated(const ForumTopicCreated::Ptr& o
return result;
}
-ForumTopicClosed::Ptr TgTypeParser::parseJsonAndGetForumTopicClosed(const boost::property_tree::ptree& data) const {
+ForumTopicClosed::Ptr TgTypeParser::parseJsonAndGetForumTopicClosed(const boost::property_tree::ptree& /*data*/) const {
auto result(std::make_shared<ForumTopicClosed>());
return result;
}
@@ -994,7 +1367,7 @@ std::string TgTypeParser::parseForumTopicClosed(const ForumTopicClosed::Ptr& obj
}
std::string result;
result += '{';
- //removeLastComma(result);
+ // removeLastComma(result);
result += '}';
return result;
}
@@ -1019,7 +1392,7 @@ std::string TgTypeParser::parseForumTopicEdited(const ForumTopicEdited::Ptr& obj
return result;
}
-ForumTopicReopened::Ptr TgTypeParser::parseJsonAndGetForumTopicReopened(const boost::property_tree::ptree& data) const {
+ForumTopicReopened::Ptr TgTypeParser::parseJsonAndGetForumTopicReopened(const boost::property_tree::ptree& /*data*/) const {
auto result(std::make_shared<ForumTopicReopened>());
return result;
}
@@ -1030,12 +1403,12 @@ std::string TgTypeParser::parseForumTopicReopened(const ForumTopicReopened::Ptr&
}
std::string result;
result += '{';
- //removeLastComma(result);
+ // removeLastComma(result);
result += '}';
return result;
}
-GeneralForumTopicHidden::Ptr TgTypeParser::parseJsonAndGetGeneralForumTopicHidden(const boost::property_tree::ptree& data) const {
+GeneralForumTopicHidden::Ptr TgTypeParser::parseJsonAndGetGeneralForumTopicHidden(const boost::property_tree::ptree& /*data*/) const {
auto result(std::make_shared<GeneralForumTopicHidden>());
return result;
}
@@ -1046,12 +1419,12 @@ std::string TgTypeParser::parseGeneralForumTopicHidden(const GeneralForumTopicHi
}
std::string result;
result += '{';
- //removeLastComma(result);
+ // removeLastComma(result);
result += '}';
return result;
}
-GeneralForumTopicUnhidden::Ptr TgTypeParser::parseJsonAndGetGeneralForumTopicUnhidden(const boost::property_tree::ptree& data) const {
+GeneralForumTopicUnhidden::Ptr TgTypeParser::parseJsonAndGetGeneralForumTopicUnhidden(const boost::property_tree::ptree& /*data*/) const {
auto result(std::make_shared<GeneralForumTopicUnhidden>());
return result;
}
@@ -1062,26 +1435,52 @@ std::string TgTypeParser::parseGeneralForumTopicUnhidden(const GeneralForumTopic
}
std::string result;
result += '{';
- //removeLastComma(result);
+ // removeLastComma(result);
result += '}';
return result;
}
-UserShared::Ptr TgTypeParser::parseJsonAndGetUserShared(const boost::property_tree::ptree& data) const {
- auto result(std::make_shared<UserShared>());
- result->requestId = data.get<std::int32_t>("request_id", 0);
+SharedUser::Ptr TgTypeParser::parseJsonAndGetSharedUser(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<SharedUser>());
result->userId = data.get<std::int64_t>("user_id", 0);
+ result->firstName = data.get<std::string>("first_name", "");
+ result->lastName = data.get<std::string>("last_name", "");
+ result->username = data.get<std::string>("username", "");
+ result->photo = parseJsonAndGetArray<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "photo");
return result;
}
-std::string TgTypeParser::parseUserShared(const UserShared::Ptr& object) const {
+std::string TgTypeParser::parseSharedUser(const SharedUser::Ptr& object) const {
if (!object) {
return "";
}
std::string result;
result += '{';
- appendToJson(result, "request_id", object->requestId);
appendToJson(result, "user_id", object->userId);
+ appendToJson(result, "first_name", object->firstName);
+ appendToJson(result, "last_name", object->lastName);
+ appendToJson(result, "username", object->username);
+ appendToJson(result, "photo", parseArray(&TgTypeParser::parsePhotoSize, object->photo));
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+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->users = parseJsonAndGetArray<SharedUser>(&TgTypeParser::parseJsonAndGetSharedUser, data, "users");
+ return result;
+}
+
+std::string TgTypeParser::parseUsersShared(const UsersShared::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "request_id", object->requestId);
+ appendToJson(result, "users", parseArray(&TgTypeParser::parseSharedUser, object->users));
removeLastComma(result);
result += '}';
return result;
@@ -1090,7 +1489,10 @@ std::string TgTypeParser::parseUserShared(const UserShared::Ptr& object) const {
ChatShared::Ptr TgTypeParser::parseJsonAndGetChatShared(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<ChatShared>());
result->requestId = data.get<std::int32_t>("request_id", 0);
- result->userId = data.get<std::int64_t>("user_id", 0);
+ result->chatId = data.get<std::int64_t>("chat_id", 0);
+ result->title = data.get<std::string>("title", "");
+ result->username = data.get<std::string>("username", "");
+ result->photo = parseJsonAndGetArray<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "photo");
return result;
}
@@ -1101,7 +1503,10 @@ std::string TgTypeParser::parseChatShared(const ChatShared::Ptr& object) const {
std::string result;
result += '{';
appendToJson(result, "request_id", object->requestId);
- appendToJson(result, "user_id", object->userId);
+ appendToJson(result, "chat_id", object->chatId);
+ appendToJson(result, "title", object->title);
+ appendToJson(result, "username", object->username);
+ appendToJson(result, "photo", parseArray(&TgTypeParser::parsePhotoSize, object->photo));
removeLastComma(result);
result += '}';
return result;
@@ -1109,6 +1514,9 @@ std::string TgTypeParser::parseChatShared(const ChatShared::Ptr& object) const {
WriteAccessAllowed::Ptr TgTypeParser::parseJsonAndGetWriteAccessAllowed(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<WriteAccessAllowed>());
+ result->fromRequest = data.get<bool>("from_request", false);
+ result->webAppName = data.get<std::string>("web_app_name", "");
+ result->fromAttachmentMenu = data.get<bool>("from_attachment_menu", false);
return result;
}
@@ -1118,7 +1526,10 @@ std::string TgTypeParser::parseWriteAccessAllowed(const WriteAccessAllowed::Ptr&
}
std::string result;
result += '{';
- //removeLastComma(result);
+ appendToJson(result, "from_request", object->fromRequest);
+ appendToJson(result, "web_app_name", object->webAppName);
+ appendToJson(result, "from_attachment_menu", object->fromAttachmentMenu);
+ removeLastComma(result);
result += '}';
return result;
}
@@ -1141,7 +1552,7 @@ std::string TgTypeParser::parseVideoChatScheduled(const VideoChatScheduled::Ptr&
return result;
}
-VideoChatStarted::Ptr TgTypeParser::parseJsonAndGetVideoChatStarted(const boost::property_tree::ptree& data) const {
+VideoChatStarted::Ptr TgTypeParser::parseJsonAndGetVideoChatStarted(const boost::property_tree::ptree& /*data*/) const {
auto result(std::make_shared<VideoChatStarted>());
return result;
}
@@ -1152,6 +1563,7 @@ std::string TgTypeParser::parseVideoChatStarted(const VideoChatStarted::Ptr& obj
}
std::string result;
result += '{';
+ // removeLastComma(result);
result += '}';
return result;
}
@@ -1192,9 +1604,149 @@ 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");
+ result->totalCount = data.get<std::int32_t>("total_count", 0);
result->photos = parseJsonAndGet2DArray<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "photos");
return result;
}
@@ -1299,7 +1851,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);
@@ -1315,7 +1867,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);
@@ -1326,15 +1878,19 @@ 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);
+ result->requestName = data.get<bool>("request_name", false);
+ result->requestUsername = data.get<bool>("request_username", false);
+ result->requestPhoto = data.get<bool>("request_photo", false);
return result;
}
-std::string TgTypeParser::parseKeyboardButtonRequestUser(const KeyboardButtonRequestUser::Ptr& object) const {
+std::string TgTypeParser::parseKeyboardButtonRequestUsers(const KeyboardButtonRequestUsers::Ptr& object) const {
if (!object) {
return "";
}
@@ -1343,6 +1899,10 @@ 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);
+ appendToJson(result, "request_name", object->requestName);
+ appendToJson(result, "request_username", object->requestUsername);
+ appendToJson(result, "request_photo", object->requestPhoto);
removeLastComma(result);
result += '}';
return result;
@@ -1358,6 +1918,9 @@ KeyboardButtonRequestChat::Ptr TgTypeParser::parseJsonAndGetKeyboardButtonReques
result->userAdministratorRights = tryParseJson<ChatAdministratorRights>(&TgTypeParser::parseJsonAndGetChatAdministratorRights, data, "user_administrator_rights");
result->botAdministratorRights = tryParseJson<ChatAdministratorRights>(&TgTypeParser::parseJsonAndGetChatAdministratorRights, data, "bot_administrator_rights");
result->botIsMember = data.get<bool>("bot_is_member", false);
+ result->requestTitle = data.get<bool>("request_title", false);
+ result->requestUsername = data.get<bool>("request_username", false);
+ result->requestPhoto = data.get<bool>("request_photo", false);
return result;
}
@@ -1375,6 +1938,9 @@ std::string TgTypeParser::parseKeyboardButtonRequestChat(const KeyboardButtonReq
appendToJson(result, "user_administrator_rights", parseChatAdministratorRights(object->userAdministratorRights));
appendToJson(result, "bot_administrator_rights", parseChatAdministratorRights(object->botAdministratorRights));
appendToJson(result, "bot_is_member", object->botIsMember);
+ appendToJson(result, "request_title", object->requestTitle);
+ appendToJson(result, "request_username", object->requestUsername);
+ appendToJson(result, "request_photo", object->requestPhoto);
removeLastComma(result);
result += '}';
return result;
@@ -1400,6 +1966,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;
}
@@ -1456,10 +2023,12 @@ InlineKeyboardButton::Ptr TgTypeParser::parseJsonAndGetInlineKeyboardButton(cons
result->loginUrl = tryParseJson<LoginUrl>(&TgTypeParser::parseJsonAndGetLoginUrl, data, "login_url");
result->switchInlineQuery = data.get<std::string>("switch_inline_query", "");
result->switchInlineQueryCurrentChat = data.get<std::string>("switch_inline_query_current_chat", "");
+ result->switchInlineQueryChosenChat = tryParseJson<SwitchInlineQueryChosenChat>(&TgTypeParser::parseJsonAndGetSwitchInlineQueryChosenChat, data, "switch_inline_query_chosen_chat");
result->callbackGame = tryParseJson<CallbackGame>(&TgTypeParser::parseJsonAndGetCallbackGame, data, "callback_game");
result->pay = data.get<bool>("pay", false);
return result;
}
+
std::string TgTypeParser::parseInlineKeyboardButton(const InlineKeyboardButton::Ptr& object) const {
if (!object) {
return "";
@@ -1473,6 +2042,7 @@ std::string TgTypeParser::parseInlineKeyboardButton(const InlineKeyboardButton::
appendToJson(result, "login_url", parseLoginUrl(object->loginUrl));
appendToJson(result, "switch_inline_query", object->switchInlineQuery);
appendToJson(result, "switch_inline_query_current_chat", object->switchInlineQueryCurrentChat);
+ appendToJson(result, "switch_inline_query_chosen_chat", parseSwitchInlineQueryChosenChat(object->switchInlineQueryChosenChat));
appendToJson(result, "callback_game", parseCallbackGame(object->callbackGame));
appendToJson(result, "pay", object->pay);
removeLastComma(result);
@@ -1504,15 +2074,41 @@ std::string TgTypeParser::parseLoginUrl(const LoginUrl::Ptr& object) const {
return result;
}
+SwitchInlineQueryChosenChat::Ptr TgTypeParser::parseJsonAndGetSwitchInlineQueryChosenChat(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<SwitchInlineQueryChosenChat>());
+ result->query = data.get<std::string>("query", "");
+ result->allowUserChats = data.get<bool>("allow_user_chats", false);
+ result->allowBotChats = data.get<bool>("allow_bot_chats", false);
+ result->allowGroupChats = data.get<bool>("allow_group_chats", false);
+ result->allowChannelChats = data.get<bool>("allow_channel_chats", false);
+ return result;
+}
+
+std::string TgTypeParser::parseSwitchInlineQueryChosenChat(const SwitchInlineQueryChosenChat::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "query", object->query);
+ appendToJson(result, "allow_user_chats", object->allowUserChats);
+ appendToJson(result, "allow_bot_chats", object->allowBotChats);
+ appendToJson(result, "allow_group_chats", object->allowGroupChats);
+ appendToJson(result, "allow_channel_chats", object->allowChannelChats);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
CallbackQuery::Ptr TgTypeParser::parseJsonAndGetCallbackQuery(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<CallbackQuery>());
- result->id = data.get<std::string>("id");
+ result->id = data.get<std::string>("id", "");
result->from = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "from");
result->message = tryParseJson<Message>(&TgTypeParser::parseJsonAndGetMessage, data, "message");
result->inlineMessageId = data.get<std::string>("inline_message_id", "");
- result->chatInstance = data.get<std::string>("chat_instance");
- result->gameShortName = data.get<std::string>("game_short_name", "");
+ result->chatInstance = data.get<std::string>("chat_instance", "");
result->data = data.get<std::string>("data", "");
+ result->gameShortName = data.get<std::string>("game_short_name", "");
return result;
}
@@ -1520,7 +2116,6 @@ std::string TgTypeParser::parseCallbackQuery(const CallbackQuery::Ptr& object) c
if (!object) {
return "";
}
-
std::string result;
result += '{';
appendToJson(result, "id", object->id);
@@ -1528,8 +2123,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;
@@ -1537,6 +2132,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;
@@ -1624,6 +2220,9 @@ ChatAdministratorRights::Ptr TgTypeParser::parseJsonAndGetChatAdministratorRight
result->canPromoteMembers = data.get<bool>("can_promote_members", false);
result->canChangeInfo = data.get<bool>("can_change_info", false);
result->canInviteUsers = data.get<bool>("can_invite_users", false);
+ result->canPostStories = data.get<bool>("can_post_stories", false);
+ result->canEditStories = data.get<bool>("can_edit_stories", false);
+ result->canDeleteStories = data.get<bool>("can_delete_stories", false);
result->canPostMessages = data.get<bool>("can_post_messages", false);
result->canEditMessages = data.get<bool>("can_edit_messages", false);
result->canPinMessages = data.get<bool>("can_pin_messages", false);
@@ -1645,6 +2244,9 @@ std::string TgTypeParser::parseChatAdministratorRights(const ChatAdministratorRi
appendToJson(result, "can_promote_members", object->canPromoteMembers);
appendToJson(result, "can_change_info", object->canChangeInfo);
appendToJson(result, "can_invite_users", object->canInviteUsers);
+ appendToJson(result, "can_post_stories", object->canPostStories);
+ appendToJson(result, "can_edit_stories", object->canEditStories);
+ appendToJson(result, "can_delete_stories", object->canDeleteStories);
appendToJson(result, "can_post_messages", object->canPostMessages);
appendToJson(result, "can_edit_messages", object->canEditMessages);
appendToJson(result, "can_pin_messages", object->canPinMessages);
@@ -1654,6 +2256,36 @@ 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<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;
+}
+
ChatMember::Ptr TgTypeParser::parseJsonAndGetChatMember(const boost::property_tree::ptree& data) const {
std::string status = data.get<std::string>("status", "");
ChatMember::Ptr result;
@@ -1711,8 +2343,8 @@ std::string TgTypeParser::parseChatMember(const ChatMember::Ptr& object) const {
ChatMemberOwner::Ptr TgTypeParser::parseJsonAndGetChatMemberOwner(const boost::property_tree::ptree& data) const {
// NOTE: This function will be called by parseJsonAndGetChatMember().
auto result(std::make_shared<ChatMemberOwner>());
- result->customTitle = data.get<std::string>("custom_title", "");
result->isAnonymous = data.get<bool>("is_anonymous", false);
+ result->customTitle = data.get<std::string>("custom_title", "");
return result;
}
@@ -1723,8 +2355,8 @@ std::string TgTypeParser::parseChatMemberOwner(const ChatMemberOwner::Ptr& objec
// This function will be called by parseChatMember(), so I don't add
// curly brackets to the result std::string.
std::string result;
- appendToJson(result, "custom_title", object->customTitle);
appendToJson(result, "is_anonymous", object->isAnonymous);
+ appendToJson(result, "custom_title", object->customTitle);
// The last comma will be erased by parseChatMember().
return result;
}
@@ -1741,6 +2373,9 @@ ChatMemberAdministrator::Ptr TgTypeParser::parseJsonAndGetChatMemberAdministrato
result->canPromoteMembers = data.get<bool>("can_promote_members", false);
result->canChangeInfo = data.get<bool>("can_change_info", false);
result->canInviteUsers = data.get<bool>("can_invite_users", false);
+ result->canPostStories = data.get<bool>("can_post_stories", false);
+ result->canEditStories = data.get<bool>("can_edit_stories", false);
+ result->canDeleteStories = data.get<bool>("can_delete_stories", false);
result->canPostMessages = data.get<bool>("can_post_messages", false);
result->canEditMessages = data.get<bool>("can_edit_messages", false);
result->canPinMessages = data.get<bool>("can_pin_messages", false);
@@ -1765,6 +2400,9 @@ std::string TgTypeParser::parseChatMemberAdministrator(const ChatMemberAdministr
appendToJson(result, "can_promote_members", object->canPromoteMembers);
appendToJson(result, "can_change_info", object->canChangeInfo);
appendToJson(result, "can_invite_users", object->canInviteUsers);
+ appendToJson(result, "can_post_stories", object->canPostStories);
+ appendToJson(result, "can_edit_stories", object->canEditStories);
+ appendToJson(result, "can_delete_stories", object->canDeleteStories);
appendToJson(result, "can_post_messages", object->canPostMessages);
appendToJson(result, "can_edit_messages", object->canEditMessages);
appendToJson(result, "can_pin_messages", object->canPinMessages);
@@ -1774,7 +2412,7 @@ std::string TgTypeParser::parseChatMemberAdministrator(const ChatMemberAdministr
return result;
}
-ChatMemberMember::Ptr TgTypeParser::parseJsonAndGetChatMemberMember(const boost::property_tree::ptree& data) const {
+ChatMemberMember::Ptr TgTypeParser::parseJsonAndGetChatMemberMember(const boost::property_tree::ptree& /*data*/) const {
// NOTE: This function will be called by parseJsonAndGetChatMember().
auto result(std::make_shared<ChatMemberMember>());
return result;
@@ -1840,7 +2478,7 @@ std::string TgTypeParser::parseChatMemberRestricted(const ChatMemberRestricted::
return result;
}
-ChatMemberLeft::Ptr TgTypeParser::parseJsonAndGetChatMemberLeft(const boost::property_tree::ptree& data) const {
+ChatMemberLeft::Ptr TgTypeParser::parseJsonAndGetChatMemberLeft(const boost::property_tree::ptree& /*data*/) const {
// NOTE: This function will be called by parseJsonAndGetChatMember().
auto result(std::make_shared<ChatMemberLeft>());
return result;
@@ -1860,7 +2498,7 @@ std::string TgTypeParser::parseChatMemberLeft(const ChatMemberLeft::Ptr& object)
ChatMemberBanned::Ptr TgTypeParser::parseJsonAndGetChatMemberBanned(const boost::property_tree::ptree& data) const {
// NOTE: This function will be called by parseJsonAndGetChatMember().
auto result(std::make_shared<ChatMemberBanned>());
- result->untilDate = data.get<uint32_t>("until_date", 0);
+ result->untilDate = data.get<std::uint32_t>("until_date", 0);
return result;
}
@@ -1876,34 +2514,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<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;
-}
-
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");
@@ -1976,6 +2586,110 @@ std::string TgTypeParser::parseChatPermissions(const ChatPermissions::Ptr& objec
return result;
}
+Birthdate::Ptr TgTypeParser::parseJsonAndGetBirthdate(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<Birthdate>());
+ result->day = data.get<std::uint8_t>("day", 0);
+ result->month = data.get<std::uint8_t>("month", 0);
+ result->year = data.get<std::uint16_t>("year", 0);
+ return result;
+}
+
+std::string TgTypeParser::parseBirthdate(const Birthdate::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "day", object->day);
+ appendToJson(result, "month", object->month);
+ appendToJson(result, "year", object->year);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+BusinessIntro::Ptr TgTypeParser::parseJsonAndGetBusinessIntro(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<BusinessIntro>());
+ result->title = data.get<std::string>("title", "");
+ result->message = data.get<std::string>("message", "");
+ result->sticker = tryParseJson<Sticker>(&TgTypeParser::parseJsonAndGetSticker, data, "sticker");
+ return result;
+}
+
+std::string TgTypeParser::parseBusinessIntro(const BusinessIntro::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "title", object->title);
+ appendToJson(result, "message", object->message);
+ appendToJson(result, "sticker", parseSticker(object->sticker));
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+BusinessLocation::Ptr TgTypeParser::parseJsonAndGetBusinessLocation(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<BusinessLocation>());
+ result->address = data.get<std::string>("address", "");
+ result->location = tryParseJson<Location>(&TgTypeParser::parseJsonAndGetLocation, data, "location");
+ return result;
+}
+
+std::string TgTypeParser::parseBusinessLocation(const BusinessLocation::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "address", object->address);
+ appendToJson(result, "location", parseLocation(object->location));
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+BusinessOpeningHoursInterval::Ptr TgTypeParser::parseJsonAndGetBusinessOpeningHoursInterval(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<BusinessOpeningHoursInterval>());
+ result->openingMinute = data.get<std::int32_t>("opening_minute", 0);
+ result->closingMinute = data.get<std::int32_t>("closing_minute", 0);
+ return result;
+}
+
+std::string TgTypeParser::parseBusinessOpeningHoursInterval(const BusinessOpeningHoursInterval::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "opening_minute", object->openingMinute);
+ appendToJson(result, "closing_minute", object->closingMinute);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+BusinessOpeningHours::Ptr TgTypeParser::parseJsonAndGetBusinessOpeningHours(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<BusinessOpeningHours>());
+ result->timeZoneName = data.get<std::string>("time_zone_name", "");
+ result->openingHours = parseJsonAndGetArray<BusinessOpeningHoursInterval>(&TgTypeParser::parseJsonAndGetBusinessOpeningHoursInterval, data, "opening_hours");
+ return result;
+}
+
+std::string TgTypeParser::parseBusinessOpeningHours(const BusinessOpeningHours::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "time_zone_name", object->timeZoneName);
+ appendToJson(result, "opening_hours", parseArray(&TgTypeParser::parseBusinessOpeningHoursInterval, object->openingHours));
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
ChatLocation::Ptr TgTypeParser::parseJsonAndGetChatLocation(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<ChatLocation>());
result->location = tryParseJson<Location>(&TgTypeParser::parseJsonAndGetLocation, data, "location");
@@ -1996,6 +2710,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);
@@ -2022,12 +2884,15 @@ std::string TgTypeParser::parseForumTopic(const ForumTopic::Ptr& object) const {
BotCommand::Ptr TgTypeParser::parseJsonAndGetBotCommand(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<BotCommand>());
- result->command = data.get("command", "");
- result->description = data.get("description", "");
+ result->command = data.get<std::string>("command", "");
+ result->description = data.get<std::string>("description", "");
return result;
}
std::string TgTypeParser::parseBotCommand(const BotCommand::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
std::string result;
result += '{';
appendToJson(result, "command", object->command);
@@ -2093,7 +2958,7 @@ std::string TgTypeParser::parseBotCommandScope(const BotCommandScope::Ptr& objec
return result;
}
-BotCommandScopeDefault::Ptr TgTypeParser::parseJsonAndGetBotCommandScopeDefault(const boost::property_tree::ptree& data) const {
+BotCommandScopeDefault::Ptr TgTypeParser::parseJsonAndGetBotCommandScopeDefault(const boost::property_tree::ptree& /*data*/) const {
// NOTE: This function will be called by parseJsonAndGetBotCommandScope().
auto result(std::make_shared<BotCommandScopeDefault>());
return result;
@@ -2110,7 +2975,7 @@ std::string TgTypeParser::parseBotCommandScopeDefault(const BotCommandScopeDefau
return result;
}
-BotCommandScopeAllPrivateChats::Ptr TgTypeParser::parseJsonAndGetBotCommandScopeAllPrivateChats(const boost::property_tree::ptree& data) const {
+BotCommandScopeAllPrivateChats::Ptr TgTypeParser::parseJsonAndGetBotCommandScopeAllPrivateChats(const boost::property_tree::ptree& /*data*/) const {
// NOTE: This function will be called by parseJsonAndGetBotCommandScope().
auto result(std::make_shared<BotCommandScopeAllPrivateChats>());
return result;
@@ -2127,7 +2992,7 @@ std::string TgTypeParser::parseBotCommandScopeAllPrivateChats(const BotCommandSc
return result;
}
-BotCommandScopeAllGroupChats::Ptr TgTypeParser::parseJsonAndGetBotCommandScopeAllGroupChats(const boost::property_tree::ptree& data) const {
+BotCommandScopeAllGroupChats::Ptr TgTypeParser::parseJsonAndGetBotCommandScopeAllGroupChats(const boost::property_tree::ptree& /*data*/) const {
// NOTE: This function will be called by parseJsonAndGetBotCommandScope().
auto result(std::make_shared<BotCommandScopeAllGroupChats>());
return result;
@@ -2144,7 +3009,7 @@ std::string TgTypeParser::parseBotCommandScopeAllGroupChats(const BotCommandScop
return result;
}
-BotCommandScopeAllChatAdministrators::Ptr TgTypeParser::parseJsonAndGetBotCommandScopeAllChatAdministrators(const boost::property_tree::ptree& data) const {
+BotCommandScopeAllChatAdministrators::Ptr TgTypeParser::parseJsonAndGetBotCommandScopeAllChatAdministrators(const boost::property_tree::ptree& /*data*/) const {
// NOTE: This function will be called by parseJsonAndGetBotCommandScope().
auto result(std::make_shared<BotCommandScopeAllChatAdministrators>());
return result;
@@ -2220,6 +3085,60 @@ std::string TgTypeParser::parseBotCommandScopeChatMember(const BotCommandScopeCh
return result;
}
+BotName::Ptr TgTypeParser::parseJsonAndGetBotName(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<BotName>());
+ result->name = data.get<std::string>("name", "");
+ return result;
+}
+
+std::string TgTypeParser::parseBotName(const BotName::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "name", object->name);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+BotDescription::Ptr TgTypeParser::parseJsonAndGetBotDescription(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<BotDescription>());
+ result->description = data.get<std::string>("description", "");
+ return result;
+}
+
+std::string TgTypeParser::parseBotDescription(const BotDescription::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "description", object->description);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+BotShortDescription::Ptr TgTypeParser::parseJsonAndGetBotShortDescription(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<BotShortDescription>());
+ result->shortDescription = data.get<std::string>("short_description", "");
+ return result;
+}
+
+std::string TgTypeParser::parseBotShortDescription(const BotShortDescription::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "short_description", object->shortDescription);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
MenuButton::Ptr TgTypeParser::parseJsonAndGetMenuButton(const boost::property_tree::ptree& data) const {
std::string type = data.get<std::string>("type", "");
MenuButton::Ptr result;
@@ -2260,7 +3179,7 @@ std::string TgTypeParser::parseMenuButton(const MenuButton::Ptr& object) const {
return result;
}
-MenuButtonCommands::Ptr TgTypeParser::parseJsonAndGetMenuButtonCommands(const boost::property_tree::ptree& data) const {
+MenuButtonCommands::Ptr TgTypeParser::parseJsonAndGetMenuButtonCommands(const boost::property_tree::ptree& /*data*/) const {
// NOTE: This function will be called by parseJsonAndGetMenuButton().
auto result(std::make_shared<MenuButtonCommands>());
return result;
@@ -2298,7 +3217,7 @@ std::string TgTypeParser::parseMenuButtonWebApp(const MenuButtonWebApp::Ptr& obj
return result;
}
-MenuButtonDefault::Ptr TgTypeParser::parseJsonAndGetMenuButtonDefault(const boost::property_tree::ptree& data) const {
+MenuButtonDefault::Ptr TgTypeParser::parseJsonAndGetMenuButtonDefault(const boost::property_tree::ptree& /*data*/) const {
// NOTE: This function will be called by parseJsonAndGetMenuButton().
auto result(std::make_shared<MenuButtonDefault>());
return result;
@@ -2315,6 +3234,245 @@ 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;
+}
+
+BusinessConnection::Ptr TgTypeParser::parseJsonAndGetBusinessConnection(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<BusinessConnection>());
+ result->id = data.get<std::string>("id", "");
+ result->user = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "user");
+ result->userChatId = data.get<std::int64_t>("user_chat_id", 0);
+ result->date = data.get<std::uint32_t>("date", 0);
+ result->canReply = data.get<bool>("can_reply", false);
+ result->isEnabled = data.get<bool>("is_enabled", false);
+ return result;
+}
+
+std::string TgTypeParser::parseBusinessConnection(const BusinessConnection::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "id", object->id);
+ appendToJson(result, "user", parseUser(object->user));
+ appendToJson(result, "user_chat_id", object->userChatId);
+ appendToJson(result, "date", object->date);
+ appendToJson(result, "can_reply", object->canReply);
+ appendToJson(result, "is_enabled", object->isEnabled);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
+BusinessMessagesDeleted::Ptr TgTypeParser::parseJsonAndGetBusinessMessagesDeleted(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<BusinessMessagesDeleted>());
+ result->businessConnectionId = data.get<std::string>("business_connection_id", "");
+ result->chat = tryParseJson<Chat>(&TgTypeParser::parseJsonAndGetChat, data, "chat");
+ result->messageIds = parseJsonAndGetArray<std::int32_t>(
+ [] (const boost::property_tree::ptree& innerData)->std::int32_t {
+ return innerData.get<std::int32_t>("");
+ }, data, "message_ids");
+ return result;
+}
+
+std::string TgTypeParser::parseBusinessMessagesDeleted(const BusinessMessagesDeleted::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "business_connection_id", object->businessConnectionId);
+ appendToJson(result, "chat", parseChat(object->chat));
+ appendToJson(result, "message_ids", parseArray<std::int32_t>(
+ [] (std::int32_t i)->std::int32_t {
+ return i;
+ }, object->messageIds));
+ 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);
@@ -2413,7 +3571,7 @@ std::string TgTypeParser::parseInputMediaPhoto(const InputMediaPhoto::Ptr& objec
InputMediaVideo::Ptr TgTypeParser::parseJsonAndGetInputMediaVideo(const boost::property_tree::ptree& data) const {
// NOTE: This function will be called by parseJsonAndGetInputMedia().
auto result(std::make_shared<InputMediaVideo>());
- result->thumb = data.get<std::string>("thumb", "");
+ result->thumbnail = data.get<std::string>("thumbnail", "");
result->width = data.get<std::int32_t>("width", 0);
result->height = data.get<std::int32_t>("height", 0);
result->duration = data.get<std::int32_t>("duration", 0);
@@ -2429,7 +3587,7 @@ std::string TgTypeParser::parseInputMediaVideo(const InputMediaVideo::Ptr& objec
// This function will be called by parseInputMedia(), so I don't add
// curly brackets to the result std::string.
std::string result;
- appendToJson(result, "thumb", object->thumb);
+ appendToJson(result, "thumbnail", object->thumbnail);
appendToJson(result, "width", object->width);
appendToJson(result, "height", object->height);
appendToJson(result, "duration", object->duration);
@@ -2442,7 +3600,7 @@ std::string TgTypeParser::parseInputMediaVideo(const InputMediaVideo::Ptr& objec
InputMediaAnimation::Ptr TgTypeParser::parseJsonAndGetInputMediaAnimation(const boost::property_tree::ptree& data) const {
// NOTE: This function will be called by parseJsonAndGetInputMedia().
auto result(std::make_shared<InputMediaAnimation>());
- result->thumb = data.get<std::string>("thumb", "");
+ result->thumbnail = data.get<std::string>("thumbnail", "");
result->width = data.get<std::int32_t>("width", 0);
result->height = data.get<std::int32_t>("height", 0);
result->duration = data.get<std::int32_t>("duration", 0);
@@ -2457,7 +3615,7 @@ std::string TgTypeParser::parseInputMediaAnimation(const InputMediaAnimation::Pt
// This function will be called by parseInputMedia(), so I don't add
// curly brackets to the result std::string.
std::string result;
- appendToJson(result, "thumb", object->thumb);
+ appendToJson(result, "thumbnail", object->thumbnail);
appendToJson(result, "width", object->width);
appendToJson(result, "height", object->height);
appendToJson(result, "duration", object->duration);
@@ -2469,7 +3627,7 @@ std::string TgTypeParser::parseInputMediaAnimation(const InputMediaAnimation::Pt
InputMediaAudio::Ptr TgTypeParser::parseJsonAndGetInputMediaAudio(const boost::property_tree::ptree& data) const {
// NOTE: This function will be called by parseJsonAndGetInputMedia().
auto result(std::make_shared<InputMediaAudio>());
- result->thumb = data.get<std::string>("thumb", "");
+ result->thumbnail = data.get<std::string>("thumbnail", "");
result->duration = data.get<std::int32_t>("duration", 0);
result->performer = data.get<std::string>("performer", "");
result->title = data.get<std::string>("title", "");
@@ -2483,7 +3641,7 @@ std::string TgTypeParser::parseInputMediaAudio(const InputMediaAudio::Ptr& objec
// This function will be called by parseInputMedia(), so I don't add
// curly brackets to the result std::string.
std::string result;
- appendToJson(result, "thumb", object->thumb);
+ appendToJson(result, "thumbnail", object->thumbnail);
appendToJson(result, "duration", object->duration);
appendToJson(result, "performer", object->performer);
appendToJson(result, "title", object->title);
@@ -2494,7 +3652,7 @@ std::string TgTypeParser::parseInputMediaAudio(const InputMediaAudio::Ptr& objec
InputMediaDocument::Ptr TgTypeParser::parseJsonAndGetInputMediaDocument(const boost::property_tree::ptree& data) const {
// NOTE: This function will be called by parseJsonAndGetInputMedia().
auto result(std::make_shared<InputMediaDocument>());
- result->thumb = data.get<std::string>("thumb", "");
+ result->thumbnail = data.get<std::string>("thumbnail", "");
result->disableContentTypeDetection = data.get<bool>("disable_content_type_detection", false);
return result;
}
@@ -2506,7 +3664,7 @@ std::string TgTypeParser::parseInputMediaDocument(const InputMediaDocument::Ptr&
// This function will be called by parseInputMedia(), so I don't add
// curly brackets to the result std::string.
std::string result;
- appendToJson(result, "thumb", object->thumb);
+ appendToJson(result, "thumbnail", object->thumbnail);
appendToJson(result, "disable_content_type_detection", object->disableContentTypeDetection);
// The last comma will be erased by parseInputMedia().
return result;
@@ -2528,12 +3686,13 @@ Sticker::Ptr TgTypeParser::parseJsonAndGetSticker(const boost::property_tree::pt
result->height = data.get<std::int32_t>("height", 0);
result->isAnimated = data.get<bool>("is_animated", false);
result->isVideo = data.get<bool>("is_video", false);
- result->thumb = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumb");
+ result->thumbnail = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumbnail");
result->emoji = data.get<std::string>("emoji", "");
result->setName = data.get<std::string>("set_name", "");
result->premiumAnimation = tryParseJson<File>(&TgTypeParser::parseJsonAndGetFile, data, "premium_animation");
result->maskPosition = tryParseJson<MaskPosition>(&TgTypeParser::parseJsonAndGetMaskPosition, data, "mask_position");
result->customEmojiId = data.get<std::string>("custom_emoji_id", "");
+ result->needsRepainting = data.get<bool>("needs_repainting", true);
result->fileSize = data.get<std::int32_t>("file_size", 0);
return result;
}
@@ -2557,12 +3716,13 @@ std::string TgTypeParser::parseSticker(const Sticker::Ptr& object) const {
appendToJson(result, "height", object->height);
appendToJson(result, "is_animated", object->isAnimated);
appendToJson(result, "is_video", object->isVideo);
- appendToJson(result, "thumb", parsePhotoSize(object->thumb));
+ appendToJson(result, "thumbnail", parsePhotoSize(object->thumbnail));
appendToJson(result, "emoji", object->emoji);
appendToJson(result, "set_name", object->setName);
appendToJson(result, "premium_animation", parseFile(object->premiumAnimation));
appendToJson(result, "mask_position", parseMaskPosition(object->maskPosition));
appendToJson(result, "custom_emoji_id", object->customEmojiId);
+ appendToJson(result, "needs_repainting", object->needsRepainting);
appendToJson(result, "file_size", object->fileSize);
removeLastComma(result);
result += '}';
@@ -2573,18 +3733,16 @@ StickerSet::Ptr TgTypeParser::parseJsonAndGetStickerSet(const boost::property_tr
auto result(std::make_shared<StickerSet>());
result->name = data.get<std::string>("name", "");
result->title = data.get<std::string>("title", "");
- std::string type = data.get<std::string>("type", "");
- if (type == "regular") {
- result->type = StickerSet::Type::Regular;
- } else if (type == "mask") {
- result->type = StickerSet::Type::Mask;
- } else if (type == "custom_emoji") {
- result->type = StickerSet::Type::CustomEmoji;
+ std::string stickerType = data.get<std::string>("sticker_type", "");
+ if (stickerType == "regular") {
+ result->stickerType = StickerSet::Type::Regular;
+ } else if (stickerType == "mask") {
+ result->stickerType = StickerSet::Type::Mask;
+ } else if (stickerType == "custom_emoji") {
+ result->stickerType = StickerSet::Type::CustomEmoji;
}
- result->isAnimated = data.get<bool>("is_animated", false);
- result->isVideo = data.get<bool>("is_video", false);
result->stickers = parseJsonAndGetArray<Sticker>(&TgTypeParser::parseJsonAndGetSticker, data, "stickers");
- result->thumb = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumb");
+ result->thumbnail = tryParseJson<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "thumbnail");
return result;
}
@@ -2596,17 +3754,15 @@ std::string TgTypeParser::parseStickerSet(const StickerSet::Ptr& object) const {
result += '{';
appendToJson(result, "name", object->name);
appendToJson(result, "title", object->title);
- if (object->type == StickerSet::Type::Regular) {
- appendToJson(result, "type", "regular");
- } else if (object->type == StickerSet::Type::Mask) {
- appendToJson(result, "type", "mask");
- } else if (object->type == StickerSet::Type::CustomEmoji) {
- appendToJson(result, "type", "custom_emoji");
+ if (object->stickerType == StickerSet::Type::Regular) {
+ appendToJson(result, "sticker_type", "regular");
+ } else if (object->stickerType == StickerSet::Type::Mask) {
+ appendToJson(result, "sticker_type", "mask");
+ } else if (object->stickerType == StickerSet::Type::CustomEmoji) {
+ appendToJson(result, "sticker_type", "custom_emoji");
}
- appendToJson(result, "is_animated", object->isAnimated);
- appendToJson(result, "is_video", object->isVideo);
appendToJson(result, "stickers", parseArray(&TgTypeParser::parseSticker, object->stickers));
- appendToJson(result, "thumb", parsePhotoSize(object->thumb));
+ appendToJson(result, "thumbnail", parsePhotoSize(object->thumbnail));
removeLastComma(result);
result += '}';
return result;
@@ -2614,7 +3770,7 @@ std::string TgTypeParser::parseStickerSet(const StickerSet::Ptr& object) const {
MaskPosition::Ptr TgTypeParser::parseJsonAndGetMaskPosition(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<MaskPosition>());
- result->point = data.get("point", "");
+ result->point = data.get<std::string>("point", "");
result->xShift = data.get<float>("x_shift", 0);
result->yShift = data.get<float>("y_shift", 0);
result->scale = data.get<float>("scale", 0);
@@ -2636,6 +3792,44 @@ std::string TgTypeParser::parseMaskPosition(const MaskPosition::Ptr& object) con
return result;
}
+InputSticker::Ptr TgTypeParser::parseJsonAndGetInputSticker(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<InputSticker>());
+ result->sticker = data.get<std::string>("sticker", "");
+ result->format = data.get<std::string>("format", "");
+ result->emojiList = parseJsonAndGetArray<std::string>(
+ [] (const boost::property_tree::ptree& innerData)->std::string {
+ return innerData.get<std::string>("");
+ }, data, "emoji_list");
+ result->maskPosition = tryParseJson<MaskPosition>(&TgTypeParser::parseJsonAndGetMaskPosition, data, "mask_position");
+ result->keywords = parseJsonAndGetArray<std::string>(
+ [] (const boost::property_tree::ptree& innerData)->std::string {
+ return innerData.get<std::string>("");
+ }, data, "keywords");
+ return result;
+}
+
+std::string TgTypeParser::parseInputSticker(const InputSticker::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "sticker", object->sticker);
+ appendToJson(result, "format", object->format);
+ appendToJson(result, "emoji_list", parseArray<std::string>(
+ [] (const std::string& s)->std::string {
+ return s;
+ }, object->emojiList));
+ appendToJson(result, "mask_position", parseMaskPosition(object->maskPosition));
+ appendToJson(result, "keywords", parseArray<std::string>(
+ [] (const std::string& s)->std::string {
+ return s;
+ }, object->keywords));
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
InlineQuery::Ptr TgTypeParser::parseJsonAndGetInlineQuery(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<InlineQuery>());
result->id = data.get<std::string>("id", "");
@@ -2664,6 +3858,28 @@ std::string TgTypeParser::parseInlineQuery(const InlineQuery::Ptr& object) const
return result;
}
+InlineQueryResultsButton::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultsButton(const boost::property_tree::ptree& data) const {
+ auto result(std::make_shared<InlineQueryResultsButton>());
+ result->text = data.get<std::string>("text", "");
+ result->webApp = tryParseJson<WebAppInfo>(&TgTypeParser::parseJsonAndGetWebAppInfo, data, "web_app");
+ result->startParameter = data.get<std::string>("start_parameter", "");
+ return result;
+}
+
+std::string TgTypeParser::parseInlineQueryResultsButton(const InlineQueryResultsButton::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
+ std::string result;
+ result += '{';
+ appendToJson(result, "text", object->text);
+ appendToJson(result, "web_app", parseWebAppInfo(object->webApp));
+ appendToJson(result, "start_parameter", object->startParameter);
+ removeLastComma(result);
+ result += '}';
+ return result;
+}
+
InlineQueryResult::Ptr TgTypeParser::parseJsonAndGetInlineQueryResult(const boost::property_tree::ptree& data) const {
std::string type = data.get<std::string>("type", "");
InlineQueryResult::Ptr result;
@@ -2784,9 +4000,9 @@ InlineQueryResultArticle::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultArti
result->url = data.get<std::string>("url", "");
result->hideUrl = data.get<bool>("hide_url", false);
result->description = data.get<std::string>("description", "");
- result->thumbUrl = data.get<std::string>("thumb_url", "");
- result->thumbWidth = data.get<std::int32_t>("thumb_width", 0);
- result->thumbHeight = data.get<std::int32_t>("thumb_height", 0);
+ result->thumbnailUrl = data.get<std::string>("thumbnail_url", "");
+ result->thumbnailWidth = data.get<std::int32_t>("thumbnail_width", 0);
+ result->thumbnailHeight = data.get<std::int32_t>("thumbnail_height", 0);
return result;
}
@@ -2802,9 +4018,9 @@ std::string TgTypeParser::parseInlineQueryResultArticle(const InlineQueryResultA
appendToJson(result, "url", object->url);
appendToJson(result, "hide_url", object->hideUrl);
appendToJson(result, "description", object->description);
- appendToJson(result, "thumb_url", object->thumbUrl);
- appendToJson(result, "thumb_width", object->thumbWidth);
- appendToJson(result, "thumb_height", object->thumbHeight);
+ appendToJson(result, "thumbnail_url", object->thumbnailUrl);
+ appendToJson(result, "thumbnail_width", object->thumbnailWidth);
+ appendToJson(result, "thumbnail_height", object->thumbnailHeight);
// The last comma will be erased by parseInlineQueryResult().
return result;
}
@@ -2813,7 +4029,7 @@ InlineQueryResultPhoto::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultPhoto(
// NOTE: This function will be called by parseJsonAndGetInlineQueryResult().
auto result(std::make_shared<InlineQueryResultPhoto>());
result->photoUrl = data.get<std::string>("photo_url", "");
- result->thumbUrl = data.get<std::string>("thumb_url", "");
+ result->thumbnailUrl = data.get<std::string>("thumbnail_url", "");
result->photoWidth = data.get<std::int32_t>("photo_width", 0);
result->photoHeight = data.get<std::int32_t>("photo_height", 0);
result->title = data.get<std::string>("title", "");
@@ -2833,7 +4049,7 @@ std::string TgTypeParser::parseInlineQueryResultPhoto(const InlineQueryResultPho
// curly brackets to the result std::string.
std::string result;
appendToJson(result, "photo_url", object->photoUrl);
- appendToJson(result, "thumb_url", object->thumbUrl);
+ appendToJson(result, "thumbnail_url", object->thumbnailUrl);
appendToJson(result, "photo_width", object->photoWidth);
appendToJson(result, "photo_height", object->photoHeight);
appendToJson(result, "title", object->title);
@@ -2853,8 +4069,8 @@ InlineQueryResultGif::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultGif(cons
result->gifWidth = data.get<std::int32_t>("gif_width", 0);
result->gifHeight = data.get<std::int32_t>("gif_height", 0);
result->gifDuration = data.get<std::int32_t>("gif_duration", 0);
- result->thumbUrl = data.get<std::string>("thumb_url", "");
- result->thumbMimeType = data.get<std::string>("thumb_mime_type", "");
+ result->thumbnailUrl = data.get<std::string>("thumbnail_url", "");
+ result->thumbnailMimeType = data.get<std::string>("thumbnail_mime_type", "");
result->title = data.get<std::string>("title", "");
result->caption = data.get<std::string>("caption", "");
result->parseMode = data.get<std::string>("parse_mode", "");
@@ -2874,8 +4090,8 @@ std::string TgTypeParser::parseInlineQueryResultGif(const InlineQueryResultGif::
appendToJson(result, "gif_width", object->gifWidth);
appendToJson(result, "gif_height", object->gifHeight);
appendToJson(result, "gif_duration", object->gifDuration);
- appendToJson(result, "thumb_url", object->thumbUrl);
- appendToJson(result, "thumb_mime_type", object->thumbMimeType);
+ appendToJson(result, "thumbnail_url", object->thumbnailUrl);
+ appendToJson(result, "thumbnail_mime_type", object->thumbnailMimeType);
appendToJson(result, "title", object->title);
appendToJson(result, "caption", object->caption);
appendToJson(result, "parse_mode", object->parseMode);
@@ -2892,8 +4108,8 @@ InlineQueryResultMpeg4Gif::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultMpe
result->mpeg4Width = data.get<std::int32_t>("mpeg4_width", 0);
result->mpeg4Height = data.get<std::int32_t>("mpeg4_height", 0);
result->mpeg4Duration = data.get<std::int32_t>("mpeg4_duration", 0);
- result->thumbUrl = data.get<std::string>("thumb_url", "");
- result->thumbMimeType = data.get<std::string>("thumb_mime_type", "");
+ result->thumbnailUrl = data.get<std::string>("thumbnail_url", "");
+ result->thumbnailMimeType = data.get<std::string>("thumbnail_mime_type", "");
result->title = data.get<std::string>("title", "");
result->caption = data.get<std::string>("caption", "");
result->parseMode = data.get<std::string>("parse_mode", "");
@@ -2913,8 +4129,8 @@ std::string TgTypeParser::parseInlineQueryResultMpeg4Gif(const InlineQueryResult
appendToJson(result, "mpeg4_width", object->mpeg4Width);
appendToJson(result, "mpeg4_height", object->mpeg4Height);
appendToJson(result, "mpeg4_duration", object->mpeg4Duration);
- appendToJson(result, "thumb_url", object->thumbUrl);
- appendToJson(result, "thumb_mime_type", object->thumbMimeType);
+ appendToJson(result, "thumbnail_url", object->thumbnailUrl);
+ appendToJson(result, "thumbnail_mime_type", object->thumbnailMimeType);
appendToJson(result, "title", object->title);
appendToJson(result, "caption", object->caption);
appendToJson(result, "parse_mode", object->parseMode);
@@ -2929,7 +4145,7 @@ InlineQueryResultVideo::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultVideo(
auto result(std::make_shared<InlineQueryResultVideo>());
result->videoUrl = data.get<std::string>("video_url", "");
result->mimeType = data.get<std::string>("mime_type", "");
- result->thumbUrl = data.get<std::string>("thumb_url", "");
+ result->thumbnailUrl = data.get<std::string>("thumbnail_url", "");
result->title = data.get<std::string>("title", "");
result->caption = data.get<std::string>("caption", "");
result->parseMode = data.get<std::string>("parse_mode", "");
@@ -2951,7 +4167,7 @@ std::string TgTypeParser::parseInlineQueryResultVideo(const InlineQueryResultVid
std::string result;
appendToJson(result, "video_url", object->videoUrl);
appendToJson(result, "mime_type", object->mimeType);
- appendToJson(result, "thumb_url", object->thumbUrl);
+ appendToJson(result, "thumbnail_url", object->thumbnailUrl);
appendToJson(result, "title", object->title);
appendToJson(result, "caption", object->caption);
appendToJson(result, "parse_mode", object->parseMode);
@@ -3040,9 +4256,9 @@ InlineQueryResultDocument::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultDoc
result->mimeType = data.get<std::string>("mime_type", "");
result->description = data.get<std::string>("description", "");
result->inputMessageContent = tryParseJson<InputMessageContent>(&TgTypeParser::parseJsonAndGetInputMessageContent, data, "input_message_content");
- result->thumbUrl = data.get<std::string>("thumb_url", "");
- result->thumbWidth = data.get<std::int32_t>("thumb_width", 0);
- result->thumbHeight = data.get<std::int32_t>("thumb_height", 0);
+ result->thumbnailUrl = data.get<std::string>("thumbnail_url", "");
+ result->thumbnailWidth = data.get<std::int32_t>("thumbnail_width", 0);
+ result->thumbnailHeight = data.get<std::int32_t>("thumbnail_height", 0);
return result;
}
@@ -3061,9 +4277,9 @@ std::string TgTypeParser::parseInlineQueryResultDocument(const InlineQueryResult
appendToJson(result, "mime_type", object->mimeType);
appendToJson(result, "description", object->description);
appendToJson(result, "input_message_content", parseInputMessageContent(object->inputMessageContent));
- appendToJson(result, "thumb_url", object->thumbUrl);
- appendToJson(result, "thumb_width", object->thumbWidth);
- appendToJson(result, "thumb_height", object->thumbHeight);
+ appendToJson(result, "thumbnail_url", object->thumbnailUrl);
+ appendToJson(result, "thumbnail_width", object->thumbnailWidth);
+ appendToJson(result, "thumbnail_height", object->thumbnailHeight);
// The last comma will be erased by parseInlineQueryResult().
return result;
}
@@ -3079,9 +4295,9 @@ InlineQueryResultLocation::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultLoc
result->heading = data.get<std::int32_t>("heading", 0);
result->proximityAlertRadius = data.get<std::int32_t>("proximity_alert_radius", 0);
result->inputMessageContent = tryParseJson<InputMessageContent>(&TgTypeParser::parseJsonAndGetInputMessageContent, data, "input_message_content");
- result->thumbUrl = data.get<std::string>("thumb_url", "");
- result->thumbWidth = data.get<std::int32_t>("thumb_width", 0);
- result->thumbHeight = data.get<std::int32_t>("thumb_height", 0);
+ result->thumbnailUrl = data.get<std::string>("thumbnail_url", "");
+ result->thumbnailWidth = data.get<std::int32_t>("thumbnail_width", 0);
+ result->thumbnailHeight = data.get<std::int32_t>("thumbnail_height", 0);
return result;
}
@@ -3100,9 +4316,9 @@ std::string TgTypeParser::parseInlineQueryResultLocation(const InlineQueryResult
appendToJson(result, "heading", object->heading);
appendToJson(result, "proximity_alert_radius", object->proximityAlertRadius);
appendToJson(result, "input_message_content", parseInputMessageContent(object->inputMessageContent));
- appendToJson(result, "thumb_url", object->thumbUrl);
- appendToJson(result, "thumb_width", object->thumbWidth);
- appendToJson(result, "thumb_height", object->thumbHeight);
+ appendToJson(result, "thumbnail_url", object->thumbnailUrl);
+ appendToJson(result, "thumbnail_width", object->thumbnailWidth);
+ appendToJson(result, "thumbnail_height", object->thumbnailHeight);
// The last comma will be erased by parseInlineQueryResult().
return result;
}
@@ -3119,9 +4335,9 @@ InlineQueryResultVenue::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultVenue(
result->googlePlaceId = data.get<std::string>("google_place_id", "");
result->googlePlaceType = data.get<std::string>("google_place_type", "");
result->inputMessageContent = tryParseJson<InputMessageContent>(&TgTypeParser::parseJsonAndGetInputMessageContent, data, "input_message_content");
- result->thumbUrl = data.get<std::string>("thumb_url", "");
- result->thumbWidth = data.get<std::int32_t>("thumb_width", 0);
- result->thumbHeight = data.get<std::int32_t>("thumb_height", 0);
+ result->thumbnailUrl = data.get<std::string>("thumbnail_url", "");
+ result->thumbnailWidth = data.get<std::int32_t>("thumbnail_width", 0);
+ result->thumbnailHeight = data.get<std::int32_t>("thumbnail_height", 0);
return result;
}
@@ -3141,9 +4357,9 @@ std::string TgTypeParser::parseInlineQueryResultVenue(const InlineQueryResultVen
appendToJson(result, "google_place_id", object->googlePlaceId);
appendToJson(result, "google_place_type", object->googlePlaceType);
appendToJson(result, "input_message_content", parseInputMessageContent(object->inputMessageContent));
- appendToJson(result, "thumb_url", object->thumbUrl);
- appendToJson(result, "thumb_width", object->thumbWidth);
- appendToJson(result, "thumb_height", object->thumbHeight);
+ appendToJson(result, "thumbnail_url", object->thumbnailUrl);
+ appendToJson(result, "thumbnail_width", object->thumbnailWidth);
+ appendToJson(result, "thumbnail_height", object->thumbnailHeight);
// The last comma will be erased by parseInlineQueryResult().
return result;
}
@@ -3156,9 +4372,9 @@ InlineQueryResultContact::Ptr TgTypeParser::parseJsonAndGetInlineQueryResultCont
result->lastName = data.get<std::string>("last_name", "");
result->vcard = data.get<std::string>("vcard", "");
result->inputMessageContent = tryParseJson<InputMessageContent>(&TgTypeParser::parseJsonAndGetInputMessageContent, data, "input_message_content");
- result->thumbUrl = data.get<std::string>("thumb_url", "");
- result->thumbWidth = data.get<std::int32_t>("thumb_width", 0);
- result->thumbHeight = data.get<std::int32_t>("thumb_height", 0);
+ result->thumbnailUrl = data.get<std::string>("thumbnail_url", "");
+ result->thumbnailWidth = data.get<std::int32_t>("thumbnail_width", 0);
+ result->thumbnailHeight = data.get<std::int32_t>("thumbnail_height", 0);
return result;
}
@@ -3174,9 +4390,9 @@ std::string TgTypeParser::parseInlineQueryResultContact(const InlineQueryResultC
appendToJson(result, "last_name", object->lastName);
appendToJson(result, "vcard", object->vcard);
appendToJson(result, "input_message_content", parseInputMessageContent(object->inputMessageContent));
- appendToJson(result, "thumb_url", object->thumbUrl);
- appendToJson(result, "thumb_width", object->thumbWidth);
- appendToJson(result, "thumb_height", object->thumbHeight);
+ appendToJson(result, "thumbnail_url", object->thumbnailUrl);
+ appendToJson(result, "thumbnail_width", object->thumbnailWidth);
+ appendToJson(result, "thumbnail_height", object->thumbnailHeight);
// The last comma will be erased by parseInlineQueryResult().
return result;
}
@@ -3484,7 +4700,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;
}
@@ -3497,7 +4713,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;
}
@@ -3665,6 +4881,8 @@ std::string TgTypeParser::parseChosenInlineResult(const ChosenInlineResult::Ptr&
result += '{';
appendToJson(result, "result_id", object->resultId);
appendToJson(result, "from", parseUser(object->from));
+ appendToJson(result, "location", parseLocation(object->location));
+ appendToJson(result, "inline_message_id", object->inlineMessageId);
appendToJson(result, "query", object->query);
removeLastComma(result);
result += '}';
@@ -3691,12 +4909,15 @@ std::string TgTypeParser::parseSentWebAppMessage(const SentWebAppMessage::Ptr& o
LabeledPrice::Ptr TgTypeParser::parseJsonAndGetLabeledPrice(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<LabeledPrice>());
- result->label = data.get<std::string>("label");
- result->amount = data.get<std::int32_t>("amount");
+ result->label = data.get<std::string>("label", "");
+ result->amount = data.get<std::int32_t>("amount", 0);
return result;
}
std::string TgTypeParser::parseLabeledPrice(const LabeledPrice::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
std::string result;
result += '{';
appendToJson(result, "label", object->label);
@@ -3708,11 +4929,11 @@ std::string TgTypeParser::parseLabeledPrice(const LabeledPrice::Ptr& object) con
Invoice::Ptr TgTypeParser::parseJsonAndGetInvoice(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<Invoice>());
- result->title = data.get<std::string>("title");
- result->description = data.get<std::string>("description");
- result->startParameter = data.get<std::string>("start_parameter");
- result->currency = data.get<std::string>("currency");
- result->totalAmount = data.get<std::int32_t>("total_amount");
+ result->title = data.get<std::string>("title", "");
+ result->description = data.get<std::string>("description", "");
+ result->startParameter = data.get<std::string>("start_parameter", "");
+ result->currency = data.get<std::string>("currency", "");
+ result->totalAmount = data.get<std::int32_t>("total_amount", 0);
return result;
}
@@ -3733,23 +4954,24 @@ std::string TgTypeParser::parseInvoice(const Invoice::Ptr& object) const {
}
ShippingAddress::Ptr TgTypeParser::parseJsonAndGetShippingAddress(const boost::property_tree::ptree& data) const {
- ShippingAddress::Ptr result;
- result->countryCode = data.get<std::string>("country_code");
+ auto result(std::make_shared<ShippingAddress>());
+ result->countryCode = data.get<std::string>("country_code", "");
result->state = data.get<std::string>("state", "");
- result->city = data.get<std::string>("city");
- result->streetLine1 = data.get<std::string>("street_line1");
- result->streetLine2 = data.get<std::string>("street_line2");
- result->postCode = data.get<std::string>("post_code");
+ result->city = data.get<std::string>("city", "");
+ result->streetLine1 = data.get<std::string>("street_line1", "");
+ result->streetLine2 = data.get<std::string>("street_line2", "");
+ result->postCode = data.get<std::string>("post_code", "");
return result;
}
std::string TgTypeParser::parseShippingAddress(const ShippingAddress::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
std::string result;
result += '{';
appendToJson(result, "country_code", object->countryCode);
- if (!object->state.empty()) {
- appendToJson(result, "state", object->state);
- }
+ appendToJson(result, "state", object->state);
appendToJson(result, "city", object->city);
appendToJson(result, "street_line1", object->streetLine1);
appendToJson(result, "street_line2", object->streetLine2);
@@ -3764,7 +4986,7 @@ OrderInfo::Ptr TgTypeParser::parseJsonAndGetOrderInfo(const boost::property_tree
result->name = data.get<std::string>("name", "");
result->phoneNumber = data.get<std::string>("phone_number", "");
result->email = data.get<std::string>("email", "");
- result->shippingAddress = tryParseJson(&TgTypeParser::parseJsonAndGetShippingAddress, data, "shipping_address");
+ result->shippingAddress = tryParseJson<ShippingAddress>(&TgTypeParser::parseJsonAndGetShippingAddress, data, "shipping_address");
return result;
}
@@ -3774,20 +4996,10 @@ std::string TgTypeParser::parseOrderInfo(const OrderInfo::Ptr& object) const {
}
std::string result;
result += '{';
- if (!object->name.empty()) {
- appendToJson(result, "name", object->name);
- }
- if (!object->phoneNumber.empty()) {
- appendToJson(result, "phone_number", object->phoneNumber);
- }
- if (!object->email.empty()) {
- appendToJson(result, "email", object->email);
- }
- if (!object->shippingAddress) {
- result += R"("shipping_address":)";
- result += parseShippingAddress(object->shippingAddress);
- result += ",";
- }
+ appendToJson(result, "name", object->name);
+ appendToJson(result, "phone_number", object->phoneNumber);
+ appendToJson(result, "email", object->email);
+ appendToJson(result, "shipping_address", parseShippingAddress(object->shippingAddress));
removeLastComma(result);
result += '}';
return result;
@@ -3795,44 +5007,51 @@ std::string TgTypeParser::parseOrderInfo(const OrderInfo::Ptr& object) const {
ShippingOption::Ptr TgTypeParser::parseJsonAndGetShippingOption(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<ShippingOption>());
- result->id = data.get<std::string>("id");
- result->title = data.get<std::string>("title");
+ result->id = data.get<std::string>("id", "");
+ result->title = data.get<std::string>("title", "");
result->prices = parseJsonAndGetArray<LabeledPrice>(&TgTypeParser::parseJsonAndGetLabeledPrice, data, "prices");
return result;
}
std::string TgTypeParser::parseShippingOption(const ShippingOption::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
std::string result;
result += '{';
appendToJson(result, "id", object->id);
appendToJson(result, "title", object->title);
+ appendToJson(result, "prices", parseArray(&TgTypeParser::parseLabeledPrice, object->prices));
removeLastComma(result);
- result += R"("prices":)";
- result += parseArray(&TgTypeParser::parseLabeledPrice, object->prices);
result += '}';
return result;
}
SuccessfulPayment::Ptr TgTypeParser::parseJsonAndGetSuccessfulPayment(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<SuccessfulPayment>());
- result->currency = data.get<std::string>("currency");
- result->totalAmount = data.get<std::int32_t>("total_amount");
- result->invoicePayload = data.get<std::string>("invoice_payload");
- result->shippingOptionId = data.get<std::string>("shipping_option_id");
- result->orderInfo = tryParseJson(&TgTypeParser::parseJsonAndGetOrderInfo, data, "order_info");
+ result->currency = data.get<std::string>("currency", "");
+ result->totalAmount = data.get<std::int32_t>("total_amount", 0);
+ result->invoicePayload = data.get<std::string>("invoice_payload", "");
+ result->shippingOptionId = data.get<std::string>("shipping_option_id", "");
+ result->orderInfo = tryParseJson<OrderInfo>(&TgTypeParser::parseJsonAndGetOrderInfo, data, "order_info");
+ result->telegramPaymentChargeId = data.get<std::string>("telegram_payment_charge_id", "");
+ result->providerPaymentChargeId = data.get<std::string>("provider_payment_charge_id", "");
return result;
}
std::string TgTypeParser::parseSuccessfulPayment(const SuccessfulPayment::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
std::string result;
result += '{';
appendToJson(result, "currency", object->currency);
appendToJson(result, "total_amount", object->totalAmount);
appendToJson(result, "invoice_payload", object->invoicePayload);
appendToJson(result, "shipping_option_id", object->shippingOptionId);
- result += R"("order_info":)";
- result += parseOrderInfo(object->orderInfo);
- result += ",";
+ appendToJson(result, "order_info", parseOrderInfo(object->orderInfo));
+ appendToJson(result, "telegram_payment_charge_id", object->telegramPaymentChargeId);
+ appendToJson(result, "provider_payment_charge_id", object->providerPaymentChargeId);
removeLastComma(result);
result += '}';
return result;
@@ -3840,24 +5059,23 @@ std::string TgTypeParser::parseSuccessfulPayment(const SuccessfulPayment::Ptr& o
ShippingQuery::Ptr TgTypeParser::parseJsonAndGetShippingQuery(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<ShippingQuery>());
- result->id = data.get<std::string>("id");
- result->from = tryParseJson(&TgTypeParser::parseJsonAndGetUser, data, "from");
- result->invoicePayload = data.get<std::string>("invoice_payload");
- result->shippingAddress = tryParseJson(&TgTypeParser::parseJsonAndGetShippingAddress, data, "shipping_address");
+ result->id = data.get<std::string>("id", "");
+ result->from = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "from");
+ result->invoicePayload = data.get<std::string>("invoice_payload", "");
+ result->shippingAddress = tryParseJson<ShippingAddress>(&TgTypeParser::parseJsonAndGetShippingAddress, data, "shipping_address");
return result;
}
std::string TgTypeParser::parseShippingQuery(const ShippingQuery::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
std::string result;
result += '{';
appendToJson(result, "id", object->id);
- result += R"("from":)";
- result += parseUser(object->from);
- result += ",";
+ appendToJson(result, "from", parseUser(object->from));
appendToJson(result, "invoice_payload", object->invoicePayload);
- result += R"("shipping_address":)";
- result += parseShippingAddress(object->shippingAddress);
- result += ",";
+ appendToJson(result, "shipping_address", parseShippingAddress(object->shippingAddress));
removeLastComma(result);
result += '}';
return result;
@@ -3865,22 +5083,29 @@ std::string TgTypeParser::parseShippingQuery(const ShippingQuery::Ptr& object) c
PreCheckoutQuery::Ptr TgTypeParser::parseJsonAndGetPreCheckoutQuery(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<PreCheckoutQuery>());
- result->id = data.get<std::string>("id");
- result->from = tryParseJson(&TgTypeParser::parseJsonAndGetUser, data, "user");
- result->currency = data.get<std::string>("currency");
- result->totalAmount = data.get<std::int32_t>("total_amount");
+ result->id = data.get<std::string>("id", "");
+ result->from = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "from");
+ result->currency = data.get<std::string>("currency", "");
+ result->totalAmount = data.get<std::int32_t>("total_amount", 0);
+ result->invoicePayload = data.get<std::string>("invoice_payload", "");
+ result->shippingOptionId = data.get<std::string>("shipping_option_id", "");
+ result->orderInfo = tryParseJson<OrderInfo>(&TgTypeParser::parseJsonAndGetOrderInfo, data, "order_info");
return result;
}
std::string TgTypeParser::parsePreCheckoutQuery(const PreCheckoutQuery::Ptr& object) const {
+ if (!object) {
+ return "";
+ }
std::string result;
result += '{';
appendToJson(result, "id", object->id);
- result += R"("user":)";
- result += parseUser(object->from);
- result += ",";
+ appendToJson(result, "from", parseUser(object->from));
appendToJson(result, "currency", object->currency);
appendToJson(result, "total_amount", object->totalAmount);
+ appendToJson(result, "invoice_payload", object->invoicePayload);
+ appendToJson(result, "shipping_option_id", object->shippingOptionId);
+ appendToJson(result, "order_info", parseOrderInfo(object->orderInfo));
removeLastComma(result);
result += '}';
return result;
@@ -3889,7 +5114,7 @@ std::string TgTypeParser::parsePreCheckoutQuery(const PreCheckoutQuery::Ptr& obj
PassportData::Ptr TgTypeParser::parseJsonAndGetPassportData(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<PassportData>());
result->data = parseJsonAndGetArray<EncryptedPassportElement>(&TgTypeParser::parseJsonAndGetEncryptedPassportElement, data, "data");
- result->credentials = tryParseJson(&TgTypeParser::parseJsonAndGetEncryptedCredentials, data, "credentials");
+ result->credentials = tryParseJson<EncryptedCredentials>(&TgTypeParser::parseJsonAndGetEncryptedCredentials, data, "credentials");
return result;
}
@@ -3937,9 +5162,9 @@ EncryptedPassportElement::Ptr TgTypeParser::parseJsonAndGetEncryptedPassportElem
result->phoneNumber = data.get<std::string>("phone_number", "");
result->email = data.get<std::string>("email", "");
result->files = parseJsonAndGetArray<PassportFile>(&TgTypeParser::parseJsonAndGetPassportFile, data, "files");
- result->frontSide = tryParseJson(&TgTypeParser::parseJsonAndGetPassportFile, data, "front_side");
- result->reverseSide = tryParseJson(&TgTypeParser::parseJsonAndGetPassportFile, data, "reverse_side");
- result->selfie = tryParseJson(&TgTypeParser::parseJsonAndGetPassportFile, data, "selfie");
+ result->frontSide = tryParseJson<PassportFile>(&TgTypeParser::parseJsonAndGetPassportFile, data, "front_side");
+ result->reverseSide = tryParseJson<PassportFile>(&TgTypeParser::parseJsonAndGetPassportFile, data, "reverse_side");
+ result->selfie = tryParseJson<PassportFile>(&TgTypeParser::parseJsonAndGetPassportFile, data, "selfie");
result->translation = parseJsonAndGetArray<PassportFile>(&TgTypeParser::parseJsonAndGetPassportFile, data, "translation");
result->hash = data.get<std::string>("hash", "");
return result;
@@ -4243,10 +5468,10 @@ std::string TgTypeParser::parsePassportElementErrorUnspecified(const PassportEle
Game::Ptr TgTypeParser::parseJsonAndGetGame(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<Game>());
- result->title = data.get("title", "");
- result->description = data.get("description", "");
+ result->title = data.get<std::string>("title", "");
+ result->description = data.get<std::string>("description", "");
result->photo = parseJsonAndGetArray<PhotoSize>(&TgTypeParser::parseJsonAndGetPhotoSize, data, "photo");
- result->text = data.get("text", "");
+ result->text = data.get<std::string>("text", "");
result->textEntities = parseJsonAndGetArray<MessageEntity>(&TgTypeParser::parseJsonAndGetMessageEntity, data, "text_entities");
result->animation = tryParseJson<Animation>(&TgTypeParser::parseJsonAndGetAnimation, data, "animation");
return result;
@@ -4269,7 +5494,7 @@ std::string TgTypeParser::parseGame(const Game::Ptr& object) const {
return result;
}
-CallbackGame::Ptr TgTypeParser::parseJsonAndGetCallbackGame(const boost::property_tree::ptree& data) const {
+CallbackGame::Ptr TgTypeParser::parseJsonAndGetCallbackGame(const boost::property_tree::ptree& /*data*/) const {
auto result(std::make_shared<CallbackGame>());
return result;
}
@@ -4280,13 +5505,14 @@ std::string TgTypeParser::parseCallbackGame(const CallbackGame::Ptr& object) con
}
std::string result;
result += '{';
+ //removeLastComma(result);
result += '}';
return result;
}
GameHighScore::Ptr TgTypeParser::parseJsonAndGetGameHighScore(const boost::property_tree::ptree& data) const {
auto result(std::make_shared<GameHighScore>());
- result->position = data.get("position", "");
+ result->position = data.get<std::int32_t>("position", 0);
result->user = tryParseJson<User>(&TgTypeParser::parseJsonAndGetUser, data, "user");
result->score = data.get<std::int32_t>("score", 0);
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/InputFile.cpp b/src/types/InputFile.cpp
index c74c73e..2deb082 100644
--- a/src/types/InputFile.cpp
+++ b/src/types/InputFile.cpp
@@ -1,19 +1,17 @@
#include "tgbot/types/InputFile.h"
-#include "tgbot/tools/StringTools.h"
#include "tgbot/tools/FileTools.h"
+#include <filesystem>
#include <memory>
#include <string>
-using namespace std;
-
namespace TgBot {
-InputFile::Ptr InputFile::fromFile(const string& filePath, const string& mimeType) {
- auto result(make_shared<InputFile>());
+InputFile::Ptr InputFile::fromFile(const std::string& filePath, const std::string& mimeType) {
+ auto result(std::make_shared<InputFile>());
result->data = FileTools::read(filePath);
result->mimeType = mimeType;
- result->fileName = StringTools::split(filePath, '/').back();
+ result->fileName = std::filesystem::path(filePath).filename().string();
return result;
}
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";