From b729f89033dca0cd2b9606060e735abfaf41c1f4 Mon Sep 17 00:00:00 2001 From: llnulldisk <48621230+llnulldisk@users.noreply.github.com> Date: Mon, 29 Aug 2022 18:46:44 +0200 Subject: Update to API 4.5 --- include/tgbot/Api.h | 21 +++++++++++----- include/tgbot/types/Animation.h | 36 +++++++++++++++++++++------- include/tgbot/types/Audio.h | 24 +++++++++++-------- include/tgbot/types/Chat.h | 48 ++++++++++++++++++++++++------------- include/tgbot/types/ChatMember.h | 7 ++++++ include/tgbot/types/ChatPhoto.h | 24 +++++++++++++++++-- include/tgbot/types/Document.h | 20 ++++++++++------ include/tgbot/types/File.h | 10 ++++++-- include/tgbot/types/MessageEntity.h | 4 ++-- include/tgbot/types/PhotoSize.h | 16 +++++++++---- include/tgbot/types/Sticker.h | 28 +++++++++++++--------- include/tgbot/types/Update.h | 10 +++++++- include/tgbot/types/Video.h | 20 ++++++++++------ include/tgbot/types/VideoNote.h | 18 +++++++++----- include/tgbot/types/Voice.h | 15 ++++++++---- 15 files changed, 214 insertions(+), 87 deletions(-) (limited to 'include') diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h index cc18807..f5b325e 100644 --- a/include/tgbot/Api.h +++ b/include/tgbot/Api.h @@ -67,7 +67,7 @@ public: */ Message::Ptr sendMessage(std::int64_t chatId, const std::string& text, bool disableWebPagePreview = false, std::int32_t replyToMessageId = 0, GenericReply::Ptr replyMarkup = std::make_shared(), const std::string& parseMode = "", bool disableNotification = false) const; - + Message::Ptr sendMessage(const std::string& chatId, const std::string& text, bool disableWebPagePreview = false, std::int32_t replyToMessageId = 0, GenericReply::Ptr replyMarkup = std::make_shared(), const std::string& parseMode = "", bool disableNotification = false) const; @@ -682,11 +682,20 @@ public: bool canEditMessages = false, bool canDeleteMessages = false, bool canInviteUsers = false, bool canPinMessages = false, bool canPromoteMembers = false) 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. - * @return True on success - */ + * @brief Use this method to set a custom title for an administrator in a supergroup promoted by the bot. + * @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 customTitle New custom title for the administrator; 0-16 characters, emoji are not allowed + * @return True on success + */ + bool setChatAdministratorCustomTitle(std::int64_t chatId, std::int64_t userId, const std::string& customTitle) 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. + * @return True on success + */ bool setChatPermissions(std::int64_t chatId, ChatPermissions::Ptr permissions) const; /** diff --git a/include/tgbot/types/Animation.h b/include/tgbot/types/Animation.h index ac54b2c..f1f62af 100644 --- a/include/tgbot/types/Animation.h +++ b/include/tgbot/types/Animation.h @@ -10,9 +10,7 @@ namespace TgBot { /** - * @brief You can provide an animation for your game so that it looks stylish in chats (check out Lumberjack for an example). - * - * This object represents an animation file to be displayed in the message containing a game. + * @brief This object represents an animation file (GIF or H.264/MPEG-4 AVC video without sound). * * @ingroup types */ @@ -21,27 +19,49 @@ public: typedef std::shared_ptr Ptr; /** - * @brief Unique file identifier. + * @brief Identifier for this file, which can be used to download or reuse the file */ std::string fileId; /** - * @brief Optional. Animation thumbnail as defined by sender. + * @brief Unique identifier for this file, which is supposed to be the same over time and for different bots. + * + * Can't be used to download or reuse the file. + */ + std::string fileUniqueId; + + /** + * @brief Video width as defined by sender + */ + std::int32_t width; + + /** + * @brief Video height as defined by sender + */ + std::int32_t height; + + /** + * @brief Duration of the video in seconds as defined by sender + */ + std::int32_t duration; + + /** + * @brief Optional. Animation thumbnail as defined by sender */ PhotoSize::Ptr thumb; /** - * @brief Optional. Original animation filename as defined by sender. + * @brief Optional. Original animation filename as defined by sender */ std::string fileName; /** - * @brief Optional. MIME type of the file as defined by sender. + * @brief Optional. MIME type of the file as defined by sender */ std::string mimeType; /** - * @brief Optional. File size. + * @brief Optional. File size */ std::int32_t fileSize; }; diff --git a/include/tgbot/types/Audio.h b/include/tgbot/types/Audio.h index dae8729..0db0a36 100644 --- a/include/tgbot/types/Audio.h +++ b/include/tgbot/types/Audio.h @@ -10,7 +10,7 @@ namespace TgBot { /** - * @brief This object represents an audio file (voice note). + * @brief This object represents an audio file to be treated as music by the Telegram clients. * * @ingroup types */ @@ -20,34 +20,39 @@ public: typedef std::shared_ptr