diff options
author | JellyBrick <shlee1503@naver.com> | 2018-07-27 17:40:44 +0900 |
---|---|---|
committer | JellyBrick <shlee1503@naver.com> | 2018-07-27 17:40:44 +0900 |
commit | 941c97706cb5b81d5a2e44a827e8f6bf76a2c6bd (patch) | |
tree | ba87716d560a674d338c5d43f319b749ff4f46c4 /include | |
parent | 6c2dc4d2eb84e7ba98f73332ccf95ffa5a7adf3f (diff) |
Bot API 4.0 - Part 2
Diffstat (limited to 'include')
-rw-r--r-- | include/tgbot/Api.h | 18 | ||||
-rw-r--r-- | include/tgbot/types/InputMedia.h | 34 | ||||
-rw-r--r-- | include/tgbot/types/InputMediaAnimation.h | 49 | ||||
-rw-r--r-- | include/tgbot/types/InputMediaAudio.h | 49 | ||||
-rw-r--r-- | include/tgbot/types/InputMediaDocument.h | 49 | ||||
-rw-r--r-- | include/tgbot/types/InputVenueMessageContent.h | 5 |
6 files changed, 198 insertions, 6 deletions
diff --git a/include/tgbot/Api.h b/include/tgbot/Api.h index 2af7be2..480949e 100644 --- a/include/tgbot/Api.h +++ b/include/tgbot/Api.h @@ -682,6 +682,24 @@ public: const std::string& inlineMessageId = "", GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>()) const; /** + * @brief Use this method to edit audio, document, photo, or video messages. + * + * + * If a message is a part of a message album, then it can be edited only to a photo or a video. + * Otherwise, message type can be changed arbitrarily. When inline message is edited, new file can't be uploaded. + * Use previously uploaded file via its file_id or specify a URL. + * + * @param media A JSON-serialized object for a new media content of the message. + * @param chatId Optional Required if inline_message_id is not specified. Unique identifier for the target chat of the target channel. + * @param messageId Optional Required if inline_message_id is not specified. Identifier of the sent message + * @param inlineMessageId Optional Required if chat_id and message_id are not specified. Identifier of the inline message + * @param replyMarkup Optional A JSON-serialized object for an inline keyboard. + * @return On success, if the edited message was sent by the bot, the edited Message is returned, otherwise nullptr is returned. + */ + Message::Ptr editMessageMedia(InputMedia::Ptr media, int64_t chatId = 0, int32_t messageId = 0, const std::string& inlineMessageId = "", + GenericReply::Ptr replyMarkup = std::make_shared<GenericReply>()) const; + + /** * @brief Use this method to edit only the reply markup of messages sent by the bot or via the bot (for inline bots). * @param chatId Optional Required if inline_message_id is not specified. Unique identifier for the target chat of the target channel. * @param messageId Optional Required if inline_message_id is not specified. Identifier of the sent message diff --git a/include/tgbot/types/InputMedia.h b/include/tgbot/types/InputMedia.h index a4610ad..c8cd4ae 100644 --- a/include/tgbot/types/InputMedia.h +++ b/include/tgbot/types/InputMedia.h @@ -28,6 +28,8 @@ #include <memory> #include <string> +#include <boost/variant.hpp> + namespace TgBot { /** @@ -41,11 +43,14 @@ public: enum class TYPE : uint8_t { PHOTO, - VIDEO + VIDEO, + ANIMATION, + DOCUMENT, + AUDIO }; /** - * @brief Type of the result, It should be one of TYPE::PHOTO/TYPE::VIDEO + * @brief Type of the result, It should be one of TYPE::* */ TYPE type; @@ -55,7 +60,14 @@ public: std::string media; /** - * @brief Optional. Caption of the photo to be sent, 0-200 characters + * @brief Optional. Thumbnail of the file sent. + * + * The thumbnail should be in JPEG format and less than 200 kB in size. A thumbnail‘s width and height should not exceed 90. 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>. + */ + std::string thumb; + + /** + * @brief Optional. Caption of the media to be sent, 0-200 characters */ std::string caption; @@ -65,21 +77,31 @@ public: std::string parseMode; /** - * @brief Optional. Video width + * @brief Optional. Media width */ int32_t width = 0; /** - * @brief Optional. Video height + * @brief Optional. Media height */ int32_t height = 0; /** - * @brief Optional. Video duration + * @brief Optional. Media duration */ int32_t duration = 0; /** + * @brief Optional. Performer of the audio. + */ + int32_t performer = 0; + + /** + * @brief Optional. Title of the audio. + */ + int32_t title = 0; + + /** * @brief Optional. Pass True, if the uploaded video is suitable for streaming */ bool supportsStreaming = false; diff --git a/include/tgbot/types/InputMediaAnimation.h b/include/tgbot/types/InputMediaAnimation.h new file mode 100644 index 0000000..8b3b976 --- /dev/null +++ b/include/tgbot/types/InputMediaAnimation.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2015 Oleg Morozenkov + * Copyright (c) 2016 Konstantin Kukin + * Copyright (c) 2018 JellyBrick + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef TGBOT_INPUTMEDIAANIMATION_H +#define TGBOT_INPUTMEDIAANIMATION_H + +#include <memory> +#include <string> + +#include "tgbot/types/InputMedia.h" + +namespace TgBot { + +/** + * @brief Represents a video to be sent. + * @ingroup types + */ +class InputMediaAnimation : public InputMedia { +public: + typedef std::shared_ptr<InputMediaAnimation> Ptr; + + InputMediaAnimation() { + this->type = TYPE::ANIMATION; + } +}; +} + +#endif //TGBOT_INPUTMEDIAANIMATION_H diff --git a/include/tgbot/types/InputMediaAudio.h b/include/tgbot/types/InputMediaAudio.h new file mode 100644 index 0000000..08b21ab --- /dev/null +++ b/include/tgbot/types/InputMediaAudio.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2015 Oleg Morozenkov + * Copyright (c) 2016 Konstantin Kukin + * Copyright (c) 2018 JellyBrick + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef TGBOT_INPUTMEDIAAUDIO_H +#define TGBOT_INPUTMEDIAAUDIO_H + +#include <memory> +#include <string> + +#include "tgbot/types/InputMedia.h" + +namespace TgBot { + +/** + * @brief Represents a video to be sent. + * @ingroup types + */ +class InputMediaAudio : public InputMedia { +public: + typedef std::shared_ptr<InputMediaAudio> Ptr; + + InputMediaAudio() { + this->type = TYPE::AUDIO; + } +}; +} + +#endif //TGBOT_INPUTMEDIAAUDIO_H diff --git a/include/tgbot/types/InputMediaDocument.h b/include/tgbot/types/InputMediaDocument.h new file mode 100644 index 0000000..a00eabb --- /dev/null +++ b/include/tgbot/types/InputMediaDocument.h @@ -0,0 +1,49 @@ +/* + * Copyright (c) 2015 Oleg Morozenkov + * Copyright (c) 2016 Konstantin Kukin + * Copyright (c) 2018 JellyBrick + * + * Permission is hereby granted, free of charge, to any person obtaining a copy + * of this software and associated documentation files (the "Software"), to deal + * in the Software without restriction, including without limitation the rights + * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell + * copies of the Software, and to permit persons to whom the Software is + * furnished to do so, subject to the following conditions: + * + * The above copyright notice and this permission notice shall be included in all + * copies or substantial portions of the Software. + * + * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR + * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, + * FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE + * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER + * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, + * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE + * SOFTWARE. + */ + +#ifndef TGBOT_INPUTMEDIADOCUMENT_H +#define TGBOT_INPUTMEDIADOCUMENT_H + +#include <memory> +#include <string> + +#include "tgbot/types/InputMedia.h" + +namespace TgBot { + +/** + * @brief Represents a video to be sent. + * @ingroup types + */ +class InputMediaDocument : public InputMedia { +public: + typedef std::shared_ptr<InputMediaDocument> Ptr; + + InputMediaDocument() { + this->type = TYPE::DOCUMENT; + } +}; +} + +#endif //TGBOT_INPUTMEDIADOCUMENT_H diff --git a/include/tgbot/types/InputVenueMessageContent.h b/include/tgbot/types/InputVenueMessageContent.h index 254a0a0..1f0bea7 100644 --- a/include/tgbot/types/InputVenueMessageContent.h +++ b/include/tgbot/types/InputVenueMessageContent.h @@ -48,6 +48,11 @@ public: * @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. Foursquare type of the venue, if known. (For example, “arts_entertainment/default”, “arts_entertainment/aquarium” or “food/icecream”.) |