summaryrefslogtreecommitdiff
path: root/include/tgbot
diff options
context:
space:
mode:
authorllnulldisk <48621230+llnulldisk@users.noreply.github.com>2022-09-09 16:57:08 +0200
committerllnulldisk <48621230+llnulldisk@users.noreply.github.com>2022-09-09 16:57:08 +0200
commit349a54107d23ab58cff9afccad27741fa3ad8937 (patch)
treec9afbddb9796f446b136600780e7817963d815c1 /include/tgbot
parentc82fa054194126e400e7e87dabbdaf20d847703c (diff)
Update to API 5.6
Diffstat (limited to 'include/tgbot')
-rw-r--r--include/tgbot/Api.h217
-rw-r--r--include/tgbot/types/ChatMemberBanned.h2
-rw-r--r--include/tgbot/types/ChatMemberRestricted.h2
-rw-r--r--include/tgbot/types/MessageEntity.h109
4 files changed, 196 insertions, 134 deletions
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h
index 87c6c11..e0c69ec 100644
--- a/include/tgbot/Api.h
+++ b/include/tgbot/Api.h
@@ -135,11 +135,13 @@ public:
* @param replyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
* @param 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 entities Optional. List of special entities that appear in message text, which can be specified instead of parseMode
+ * @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
*
* @return On success, the sent Message is returned.
*/
+
Message::Ptr sendMessage(boost::variant<std::int64_t, const std::string&> chatId,
const std::string& text,
bool disableWebPagePreview = false,
@@ -148,67 +150,90 @@ public:
const std::string& parseMode = "",
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& entities = std::vector<MessageEntity::Ptr>(),
- bool allowSendingWithoutReply = false) const;
+ bool allowSendingWithoutReply = false,
+ bool protectContent = false) const;
/**
* @brief Use this method to forward messages of any kind.
- * @param chatId Unique identifier for the target chat.
- * @param fromChatId Unique identifier for the chat where the original message was sent — User or GroupChat id.
- * @param messageId Unique message identifier.
- * @param disableNotification Optional. Sends the message silenty.
- * @return On success, the sent message is returned.
+ *
+ * Service messages 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 protectContent Optional. Protects the contents of the forwarded message from forwarding and saving
+ *
+ * @return On success, the sent Message is returned.
*/
- Message::Ptr forwardMessage(std::int64_t chatId, std::int64_t fromChatId, std::int32_t messageId, bool disableNotification = false) const;
+ Message::Ptr forwardMessage(boost::variant<std::int64_t, const std::string&> chatId,
+ boost::variant<std::int64_t, const std::string&> fromChatId,
+ std::int32_t messageId,
+ bool disableNotification = false,
+ bool protectContent = false) const;
/**
* @brief Use this method to copy messages of any kind.
- * The method is analogous to the method Api::forwardMessages, but the copied message doesn't have a link to the original message.
+ *
+ * Service messages and invoice messages can't be copied.
+ * 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 captionEntities Optional. List of special entities that appear in the new caption, which can be specified instead of parseMode
+ * @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 protectContent Optional. Protects the contents of the sent message from forwarding and saving
*
- * @return the MessageId of the sent message on success.
+ * @return Returns the MessageId of the sent message on success.
*/
- MessageId::Ptr copyMessage(std::int64_t chatId, std::int64_t fromChatId, std::int32_t messageId,
- const std::string& caption = "", 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,
- GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>()) const;
+ MessageId::Ptr copyMessage(boost::variant<std::int64_t, const std::string&> chatId,
+ boost::variant<std::int64_t, const std::string&> fromChatId,
+ std::int32_t messageId,
+ const std::string& caption = "",
+ 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,
+ GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
+ bool protectContent = 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. https://core.telegram.org/bots/api#sending-files
+ * @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 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. List of special entities that appear in the caption, which can be specified instead of parseMode
+ * @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
*
* @return On success, the sent Message is returned.
*/
- Message::Ptr sendPhoto(std::int64_t chatId,
- boost::variant<InputFile::Ptr, std::string> photo,
+ Message::Ptr sendPhoto(boost::variant<std::int64_t, const std::string&> chatId,
+ boost::variant<InputFile::Ptr, const std::string&> photo,
const std::string& caption = "",
std::int32_t replyToMessageId = 0,
GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
const std::string& parseMode = "",
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
- bool allowSendingWithoutReply = false) const;
+ bool allowSendingWithoutReply = false,
+ bool protectContent = false) const;
/**
- * @brief Use this method to send audio files, if you want Telegram clients to display them in the music player.
+ * @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.
*
@@ -225,27 +250,30 @@ public:
* @param replyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
* @param 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. List of special entities that appear in the caption, which can be specified instead of parseMode
+ * @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
*
* @return On success, the sent Message is returned.
*/
- Message::Ptr sendAudio(std::int64_t chatId,
- boost::variant<InputFile::Ptr, std::string> audio,
+ Message::Ptr sendAudio(boost::variant<std::int64_t, const std::string&> chatId,
+ boost::variant<InputFile::Ptr, const std::string&> audio,
const std::string& caption = "",
std::int32_t duration = 0,
const std::string& performer = "",
const std::string& title = "",
- boost::variant<InputFile::Ptr, std::string> thumb = "",
+ boost::variant<InputFile::Ptr, const std::string&> thumb = "",
std::int32_t replyToMessageId = 0,
GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
const std::string& parseMode = "",
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
- bool allowSendingWithoutReply = false) const;
+ bool allowSendingWithoutReply = false,
+ bool protectContent = false) const;
/**
* @brief Use this method to send general files.
+ *
* Bots can currently send files of any type of up to 50 MB in size, this limit may be changed in the future.
*
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
@@ -256,15 +284,16 @@ public:
* @param replyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
* @param 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. List of special entities that appear in the caption, which can be specified instead of parseMode
+ * @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
*
* @return On success, the sent Message is returned.
*/
- Message::Ptr sendDocument(std::int64_t chatId,
- boost::variant<InputFile::Ptr, std::string> document,
- boost::variant<InputFile::Ptr, std::string> thumb = "",
+ Message::Ptr sendDocument(boost::variant<std::int64_t, const std::string&> chatId,
+ boost::variant<InputFile::Ptr, const std::string&> document,
+ boost::variant<InputFile::Ptr, const std::string&> thumb = "",
const std::string& caption = "",
std::int32_t replyToMessageId = 0,
GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
@@ -272,10 +301,12 @@ public:
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
bool disableContentTypeDetection = false,
- bool allowSendingWithoutReply = false) const;
+ bool allowSendingWithoutReply = false,
+ bool protectContent = false) const;
/**
* @brief Use this method to send video files, Telegram clients support mp4 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)
@@ -284,34 +315,37 @@ public:
* @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 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 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 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. List of special entities that appear in the caption, which can be specified instead of parseMode
+ * @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
*
* @return On success, the sent Message is returned.
*/
- Message::Ptr sendVideo(std::int64_t chatId,
- boost::variant<InputFile::Ptr, std::string> video,
+ Message::Ptr sendVideo(boost::variant<std::int64_t, const std::string&> chatId,
+ boost::variant<InputFile::Ptr, const std::string&> video,
bool supportsStreaming = false,
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, const std::string&> thumb = "",
const std::string& caption = "",
std::int32_t replyToMessageId = 0,
GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
const std::string& parseMode = "",
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
- bool allowSendingWithoutReply = false) const;
+ bool allowSendingWithoutReply = false,
+ bool protectContent = false) const;
/**
* @brief Use this method to send animation files (GIF or H.264/MPEG-4 AVC video without sound).
+ *
* Bots can currently send animation files of up to 50 MB in size, this limit may be changed in the future.
*
* @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
@@ -325,27 +359,30 @@ public:
* @param replyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
* @param 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. List of special entities that appear in the caption, which can be specified instead of parseMode
+ * @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
*
* @return On success, the sent Message is returned.
*/
- Message::Ptr sendAnimation(std::int64_t chatId,
- boost::variant<InputFile::Ptr, std::string> animation,
+ Message::Ptr sendAnimation(boost::variant<std::int64_t, const std::string&> chatId,
+ boost::variant<InputFile::Ptr, const std::string&> animation,
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, const std::string&> thumb = "",
const std::string& caption = "",
std::int32_t replyToMessageId = 0,
GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
const std::string& parseMode = "",
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
- bool allowSendingWithoutReply = false) const;
+ bool allowSendingWithoutReply = false,
+ bool protectContent = false) const;
/**
* @brief Use this method to send audio files, if you want Telegram clients to display the file as a playable voice message.
+ *
* For this to work, your audio must be in an .OGG file encoded with OPUS (other formats may be sent as Audio or Document).
* Bots can currently send voice messages of up to 50 MB in size, this limit may be changed in the future.
*
@@ -357,13 +394,14 @@ public:
* @param replyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
* @param 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. List of special entities that appear in the caption, which can be specified instead of parseMode
+ * @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
*
* @return On success, the sent Message is returned.
*/
- Message::Ptr sendVoice(std::int64_t chatId,
- boost::variant<InputFile::Ptr, std::string> voice,
+ Message::Ptr sendVoice(boost::variant<std::int64_t, const std::string&> chatId,
+ boost::variant<InputFile::Ptr, const std::string&> voice,
const std::string& caption = "",
std::int32_t duration = 0,
std::int32_t replyToMessageId = 0,
@@ -371,11 +409,13 @@ public:
const std::string& parseMode = "",
bool disableNotification = false,
const std::vector<MessageEntity::Ptr>& captionEntities = std::vector<MessageEntity::Ptr>(),
- bool allowSendingWithoutReply = false) const;
+ bool allowSendingWithoutReply = false,
+ bool protectContent = false) const;
/**
- * @brief As of v.4.0, Telegram clients support rounded square mp4 videos of up to 1 minute long.
- * Use this method to send video messages.
+ * @brief Use this method to send video messages.
+ *
+ * As of v.4.0, Telegram clients support rounded square mp4 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. Sending video notes by a URL is currently unsupported. https://core.telegram.org/bots/api#sending-files
@@ -386,21 +426,24 @@ public:
* @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
*
* @return On success, the sent Message is returned.
*/
- Message::Ptr sendVideoNote(std::int64_t chatId,
- boost::variant<InputFile::Ptr, std::string> videoNote,
+ Message::Ptr sendVideoNote(boost::variant<std::int64_t, const std::string&> chatId,
+ boost::variant<InputFile::Ptr, const std::string&> videoNote,
std::int64_t replyToMessageId = 0,
bool disableNotification = false,
std::int32_t duration = 0,
std::int32_t length = 0,
- boost::variant<InputFile::Ptr, std::string> thumb = "",
+ boost::variant<InputFile::Ptr, const std::string&> thumb = "",
GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
- bool allowSendingWithoutReply = false) const;
+ bool allowSendingWithoutReply = false,
+ bool protectContent = false) const;
/**
* @brief Use this method to send a group of photos, videos, documents or audios as an album.
+ *
* Documents and audio files can be only group 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)
@@ -408,14 +451,16 @@ public:
* @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
*
* @return On success, an array of Messages that were sent is returned.
*/
- std::vector<Message::Ptr> sendMediaGroup(std::int64_t chatId,
+ std::vector<Message::Ptr> sendMediaGroup(boost::variant<std::int64_t, const std::string&> chatId,
const std::vector<InputMedia::Ptr>& media,
bool disableNotification = false,
std::int32_t replyToMessageId = 0,
- bool allowSendingWithoutReply = false) const;
+ bool allowSendingWithoutReply = false,
+ bool protectContent = false) const;
/**
* @brief Use this method to send point on the map.
@@ -423,7 +468,7 @@ public:
* @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 Live Locations, should be between 60 and 86400.
+ * @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 disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
@@ -431,20 +476,22 @@ public:
* @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
*
* @return On success, the sent Message is returned.
*/
- Message::Ptr sendLocation(std::int64_t chatId,
+ Message::Ptr sendLocation(boost::variant<std::int64_t, const std::string&> chatId,
float latitude,
float longitude,
- std::uint32_t livePeriod = 0,
+ std::int32_t livePeriod = 0,
std::int32_t replyToMessageId = 0,
GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
bool disableNotification = false,
float horizontalAccuracy = 0,
- std::uint32_t heading = 0,
- std::uint32_t proximityAlertRadius = 0,
- bool allowSendingWithoutReply = false) const;
+ std::int32_t heading = 0,
+ std::int32_t proximityAlertRadius = 0,
+ bool allowSendingWithoutReply = false,
+ bool protectContent = false) const;
/**
* @brief Use this method to edit live location messages.
@@ -499,10 +546,11 @@ public:
* @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
*
* @return On success, the sent Message is returned.
*/
- Message::Ptr sendVenue(std::int64_t chatId,
+ Message::Ptr sendVenue(boost::variant<std::int64_t, const std::string&> chatId,
float latitude,
float longitude,
const std::string& title,
@@ -514,7 +562,8 @@ public:
GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
const std::string& googlePlaceId = "",
const std::string& googlePlaceType = "",
- bool allowSendingWithoutReply = false) const;
+ bool allowSendingWithoutReply = false,
+ bool protectContent = false) const;
/**
* @brief Use this method to send phone contacts.
@@ -528,10 +577,11 @@ public:
* @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
*
* @return On success, the sent Message is returned.
*/
- Message::Ptr sendContact(std::int64_t chatId,
+ Message::Ptr sendContact(boost::variant<std::int64_t, const std::string&> chatId,
const std::string& phoneNumber,
const std::string& firstName,
const std::string& lastName = "",
@@ -539,7 +589,8 @@ public:
bool disableNotification = false,
std::int32_t replyToMessageId = 0,
GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
- bool allowSendingWithoutReply = false) const;
+ bool allowSendingWithoutReply = false,
+ bool protectContent = false) const;
/**
* @brief Use this method to send a native poll.
@@ -561,10 +612,11 @@ public:
* @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
*
* @return On success, the sent Message is returned.
*/
- Message::Ptr sendPoll(std::int64_t chatId,
+ Message::Ptr sendPoll(boost::variant<std::int64_t, const std::string&> chatId,
const std::string& question,
const std::vector<std::string>& options,
bool disableNotification = false,
@@ -580,7 +632,8 @@ public:
std::int32_t openPeriod = 0,
std::int32_t closeDate = 0,
bool isClosed = false,
- bool allowSendingWithoutReply = false) const;
+ bool allowSendingWithoutReply = false,
+ bool protectContent = false) const;
/**
* @brief Use this method to send an animated emoji that will display a random value.
@@ -591,15 +644,17 @@ public:
* @param replyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
* @param 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
*
* @return On success, the sent Message is returned.
*/
- Message::Ptr sendDice(std::int64_t chatId,
+ Message::Ptr sendDice(boost::variant<std::int64_t, const std::string&> chatId,
bool disableNotification = false,
std::int32_t replyToMessageId = 0,
GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
const std::string& emoji = "",
- bool allowSendingWithoutReply = false) const;
+ bool allowSendingWithoutReply = false,
+ bool protectContent = false) const;
/**
* @brief Use this method when you need to tell the user that something is happening on the bot's side.
@@ -813,7 +868,7 @@ public:
* @return the edited invite link as a ChatInviteLink object.
*/
ChatInviteLink::Ptr editChatInviteLink(std::int64_t chatId,
- std::string inviteLink,
+ const std::string& inviteLink,
std::int32_t expireDate = 0,
std::int32_t memberLimit = 0,
const std::string& name = "",
@@ -830,7 +885,7 @@ public:
* @return the revoked invite link as ChatInviteLink object.
*/
ChatInviteLink::Ptr revokeChatInviteLink(std::int64_t chatId,
- std::string inviteLink) const;
+ const std::string& inviteLink) const;
/**
* @brief Use this method to approve a chat join request.
@@ -1129,15 +1184,17 @@ public:
* @param replyMarkup Optional. Additional interface options. A JSON-serialized object for an inline keyboard, custom reply keyboard, instructions to remove reply keyboard or to force a reply from the user.
* @param 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
*
* @return On success, the sent Message is returned.
*/
- Message::Ptr sendSticker(std::int64_t chatId,
- boost::variant<InputFile::Ptr, std::string> sticker,
+ Message::Ptr sendSticker(boost::variant<std::int64_t, const std::string&> chatId,
+ boost::variant<InputFile::Ptr, const std::string&> sticker,
std::int32_t replyToMessageId = 0,
GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>(),
bool disableNotification = false,
- bool allowSendingWithoutReply = false) const;
+ bool allowSendingWithoutReply = false,
+ bool protectContent = false) const;
/**
* @brief Use this method to get a sticker set.
@@ -1273,10 +1330,11 @@ public:
* @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
*
* @return On success, the sent Message is returned.
*/
- Message::Ptr sendInvoice(std::int64_t chatId,
+ Message::Ptr sendInvoice(boost::variant<std::int64_t, const std::string&> chatId,
const std::string& title,
const std::string& description,
const std::string& payload,
@@ -1301,7 +1359,8 @@ public:
bool allowSendingWithoutReply = false,
std::int32_t maxTipAmount = 0,
const std::vector<std::int32_t>& suggestedTipAmounts = std::vector<std::int32_t>(),
- const std::string& startParameter = "") const;
+ const std::string& startParameter = "",
+ bool protectContent = false) const;
/**
* @brief Use this method to reply to shipping queries.
@@ -1350,9 +1409,10 @@ public:
* @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 game_title' button will be shown. If not empty, the first button must launch the game.
+ * @param replyMarkup Optional. A JSON-serialized object for an inline keyboard. If empty, one 'Play gameTitle' button will be shown. If not empty, the first button must launch the game.
* @param disableNotification Optional. Sends the message silently. Users will receive a notification with no sound.
* @param allowSendingWithoutReply Optional. Pass True, if the message should be sent even if the specified replied-to message is not found
+ * @param protectContent Optional. Protects the contents of the sent message from forwarding and saving
*
* @return On success, the sent Message is returned.
*/
@@ -1361,7 +1421,8 @@ public:
std::int32_t replyToMessageId = 0,
InlineKeyboardMarkup::Ptr replyMarkup = std::make_shared<InlineKeyboardMarkup>(),
bool disableNotification = false,
- bool allowSendingWithoutReply = false) const;
+ bool allowSendingWithoutReply = false,
+ bool protectContent = false) const;
/**
* @brief Use this method to set the score of the specified user in a game.
diff --git a/include/tgbot/types/ChatMemberBanned.h b/include/tgbot/types/ChatMemberBanned.h
index c54385e..90ae93e 100644
--- a/include/tgbot/types/ChatMemberBanned.h
+++ b/include/tgbot/types/ChatMemberBanned.h
@@ -26,7 +26,7 @@ public:
/**
* @brief Date when restrictions will be lifted for this user; unix time
*/
- std::int32_t untilDate;
+ std::uint32_t untilDate;
};
}
diff --git a/include/tgbot/types/ChatMemberRestricted.h b/include/tgbot/types/ChatMemberRestricted.h
index 76a9cd7..d64c849 100644
--- a/include/tgbot/types/ChatMemberRestricted.h
+++ b/include/tgbot/types/ChatMemberRestricted.h
@@ -72,7 +72,7 @@ public:
/**
* @brief Date when restrictions will be lifted for this user; unix time
*/
- std::int32_t untilDate;
+ std::uint32_t untilDate;
};
}
diff --git a/include/tgbot/types/MessageEntity.h b/include/tgbot/types/MessageEntity.h
index 6cf42f5..d1384e7 100644
--- a/include/tgbot/types/MessageEntity.h
+++ b/include/tgbot/types/MessageEntity.h
@@ -1,54 +1,55 @@
-#ifndef TGBOT_MESSAGEENTITY_H
-#define TGBOT_MESSAGEENTITY_H
-
-#include "tgbot/types/User.h"
-
-#include <cstdint>
-#include <memory>
-#include <string>
-
-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;
-
- /**
- * @brief Type of the entity.
- * Can be “mention” (@username), “hashtag” (#hashtag), “cashtag” ($USD), “bot_command” (/start@jobs_bot), “url” (https://telegram.org), “email” (do-not-reply@telegram.org), “phone_number” (+1-212-555-0123), “bold” (bold text), “italic” (italic text), “underline” (underlined text), “strikethrough” (strikethrough text), “code” (monowidth string), “pre” (monowidth block), “text_link” (for clickable text URLs), “text_mention” (for users without usernames)
- */
- std::string type;
-
- /**
- * @brief Offset in UTF-16 code units to the start of the entity
- */
- std::int32_t offset;
-
- /**
- * @brief Length of the entity in UTF-16 code units
- */
- std::int32_t length;
-
- /**
- * @brief Optional. For “text_link” only, url that will be opened after user taps on the text
- */
- std::string url;
-
- /**
- * @brief Optional. For “text_mention” only, the mentioned user
- */
- User::Ptr user;
-
- /**
- * @brief Optional. For “pre” only, the programming language of the entity text
- */
- std::string language;
-};
-}
-
-#endif //TGBOT_MESSAGEENTITY_H
+#ifndef TGBOT_MESSAGEENTITY_H
+#define TGBOT_MESSAGEENTITY_H
+
+#include "tgbot/types/User.h"
+
+#include <cstdint>
+#include <memory>
+#include <string>
+
+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;
+
+ /**
+ * @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)
+ */
+ std::string type;
+
+ /**
+ * @brief Offset in UTF-16 code units to the start of the entity
+ */
+ std::int32_t offset;
+
+ /**
+ * @brief Length of the entity in UTF-16 code units
+ */
+ std::int32_t length;
+
+ /**
+ * @brief Optional. For “text_link” only, url that will be opened after user taps on the text
+ */
+ std::string url;
+
+ /**
+ * @brief Optional. For “text_mention” only, the mentioned user
+ */
+ User::Ptr user;
+
+ /**
+ * @brief Optional. For “pre” only, the programming language of the entity text
+ */
+ std::string language;
+};
+}
+
+#endif //TGBOT_MESSAGEENTITY_H