summaryrefslogtreecommitdiff
path: root/include/tgbot
diff options
context:
space:
mode:
authorllnulldisk <48621230+llnulldisk@users.noreply.github.com>2022-09-04 21:18:17 +0200
committerllnulldisk <48621230+llnulldisk@users.noreply.github.com>2022-09-04 21:18:17 +0200
commit5c9062ab3c3bff1fa1fb5b5288dda0cf5d0acf54 (patch)
treef64bf217f53f3b5ff2ba48711ff05cf50ca1aa3a /include/tgbot
parent5a72b4b1fc89d9b6033f929d9bf4f6e30d7f9698 (diff)
Update to API 5.5
Diffstat (limited to 'include/tgbot')
-rw-r--r--include/tgbot/Api.h25
-rw-r--r--include/tgbot/types/Chat.h18
-rw-r--r--include/tgbot/types/Message.h25
3 files changed, 57 insertions, 11 deletions
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h
index 428c8b2..87c6c11 100644
--- a/include/tgbot/Api.h
+++ b/include/tgbot/Api.h
@@ -741,6 +741,31 @@ public:
bool setChatAdministratorCustomTitle(std::int64_t chatId, std::int64_t userId, const std::string& customTitle) const;
/**
+ * @brief Use this method to ban a channel chat in a supergroup or a channel.
+ * Until the chat is unbanned, the owner of the banned chat won't be able to send messages on behalf of any of their channels.
+ * The bot must be an administrator in the supergroup or channel for this to work and must have the appropriate administrator rights.
+ *
+ * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
+ * @param senderChatId Unique identifier of the target sender chat
+ *
+ * @return True on success.
+ */
+ bool banChatSenderChat(std::int64_t chatId,
+ std::int64_t senderChatId) const;
+
+ /**
+ * @brief Use this method to unban a previously banned channel chat in a supergroup or channel.
+ * The bot must be an administrator for this to work and must have the appropriate administrator rights.
+ *
+ * @param chatId Unique identifier for the target chat or username of the target channel (in the format @channelusername)
+ * @param senderChatId Unique identifier of the target sender chat
+ *
+ * @return Returns True on success.
+ */
+ bool unbanChatSenderChat(std::int64_t chatId,
+ std::int64_t senderChatId) const;
+
+ /**
* @brief Use this method to set default chat permissions for all members. The bot must be an administrator in the group or a supergroup for this to work and must have the can_restrict_members admin rights. Returns True on success.
* @param chatId Unique identifier for the target chat of the target supergroup.
* @param permissions New default chat permissions.
diff --git a/include/tgbot/types/Chat.h b/include/tgbot/types/Chat.h
index 2b74447..24f7955 100644
--- a/include/tgbot/types/Chat.h
+++ b/include/tgbot/types/Chat.h
@@ -75,6 +75,12 @@ public:
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. Description, for groups, supergroups and channel chats.
* Returned only in Api::getChat.
*/
@@ -106,6 +112,18 @@ public:
std::int32_t slowModeDelay;
/**
+ * @brief Optional. The time after which all messages sent to the chat will be automatically deleted; in seconds.
+ * Returned only in Api::getChat.
+ */
+ std::int32_t messageAutoDeleteTime;
+
+ /**
+ * @brief Optional. True, if messages from the chat can't be forwarded to other chats.
+ * Returned only in Api::getChat.
+ */
+ bool hasProtectedContent;
+
+ /**
* @brief Optional. For supergroups, name of group sticker set.
* Returned only in Api::getChat.
*/
diff --git a/include/tgbot/types/Message.h b/include/tgbot/types/Message.h
index dc65604..c918257 100644
--- a/include/tgbot/types/Message.h
+++ b/include/tgbot/types/Message.h
@@ -52,15 +52,15 @@ public:
std::int32_t messageId;
/**
- * @brief Optional. Sender, empty for messages sent to channels
+ * @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.
- * The channel itself for channel messages.
- * The supergroup itself for messages from anonymous group administrators.
- * The linked channel for messages automatically forwarded to the discussion group
+ * 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;
@@ -105,6 +105,11 @@ public:
std::int32_t forwardDate;
/**
+ * @brief Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group
+ */
+ bool isAutomaticForward;
+
+ /**
* @brief Optional. For replies, the original message.
* Note that the Message object in this field will not contain further replyToMessage fields even if it itself is a reply.
*/
@@ -121,6 +126,11 @@ public:
std::int32_t editDate;
/**
+ * @brief Optional. True, if the message can't be forwarded
+ */
+ bool hasProtectedContent;
+
+ /**
* @brief Optional. The unique identifier of a media message group this message belongs to
*/
std::string mediaGroupId;
@@ -347,13 +357,6 @@ public:
* loginUrl buttons are represented as ordinary url buttons.
*/
InlineKeyboardMarkup::Ptr replyMarkup;
-
- /**
- * @brief Optional. True, if the message is a channel post that was automatically forwarded to the connected discussion group
- *
- * Note: Added with Bot API 5.5
- */
- bool automaticForward;
};
}