Add td_api::InputStoryContent.
This commit is contained in:
parent
a049076797
commit
0ef9365e02
@ -4846,6 +4846,20 @@ storyContentVideo video:video alternative_video:video = StoryContent;
|
||||
storyContentUnsupported = StoryContent;
|
||||
|
||||
|
||||
//@class InputStoryContent @description The content of a story to send
|
||||
|
||||
//@description A photo story
|
||||
//@photo Photo to send. The photo must be at most 10 MB in size. The photo size must be 720x1280
|
||||
//@added_sticker_file_ids File identifiers of the stickers added to the photo, if applicable
|
||||
inputStoryContentPhoto photo:InputFile added_sticker_file_ids:vector<int32> = InputStoryContent;
|
||||
|
||||
//@description A video story
|
||||
//@video Video to be sent. The video size must be 720x1280. The video must be stored in MPEG4 format, encoded by x265 codec and must be streamable
|
||||
//@added_sticker_file_ids File identifiers of the stickers added to the video, if applicable
|
||||
//@duration Duration of the video, in seconds
|
||||
inputStoryContentVideo video:InputFile added_sticker_file_ids:vector<int32> duration:int32 = InputStoryContent;
|
||||
|
||||
|
||||
//@description Contains information about interactions with a story
|
||||
//@view_count Number of times the story was viewed
|
||||
//@recent_viewer_user_ids Identifiers of at most 3 recent viewers of the story
|
||||
|
@ -8,7 +8,10 @@
|
||||
|
||||
#include "td/telegram/DocumentsManager.h"
|
||||
#include "td/telegram/files/FileId.h"
|
||||
#include "td/telegram/files/FileManager.h"
|
||||
#include "td/telegram/files/FileType.h"
|
||||
#include "td/telegram/Photo.h"
|
||||
#include "td/telegram/StickersManager.h"
|
||||
#include "td/telegram/Td.h"
|
||||
#include "td/telegram/VideosManager.h"
|
||||
|
||||
@ -124,6 +127,40 @@ unique_ptr<StoryContent> get_story_content(Td *td, tl_object_ptr<telegram_api::M
|
||||
return nullptr;
|
||||
}
|
||||
|
||||
Result<unique_ptr<StoryContent>> get_input_story_content(
|
||||
Td *td, td_api::object_ptr<td_api::InputStoryContent> &&input_story_content, DialogId owner_dialog_id) {
|
||||
LOG(INFO) << "Get input story content from " << to_string(input_story_content);
|
||||
|
||||
switch (input_story_content->get_id()) {
|
||||
case td_api::inputStoryContentPhoto::ID: {
|
||||
auto input_story = static_cast<const td_api::inputStoryContentPhoto *>(input_story_content.get());
|
||||
TRY_RESULT(file_id, td->file_manager_->get_input_file_id(FileType::Photo, input_story->photo_, owner_dialog_id,
|
||||
false, false));
|
||||
auto sticker_file_ids =
|
||||
td->stickers_manager_->get_attached_sticker_file_ids(input_story->added_sticker_file_ids_);
|
||||
TRY_RESULT(photo,
|
||||
create_photo(td->file_manager_.get(), file_id, PhotoSize(), 720, 1280, std::move(sticker_file_ids)));
|
||||
return make_unique<StoryContentPhoto>(std::move(photo));
|
||||
}
|
||||
case td_api::inputStoryContentVideo::ID: {
|
||||
auto input_story = static_cast<const td_api::inputStoryContentVideo *>(input_story_content.get());
|
||||
TRY_RESULT(file_id, td->file_manager_->get_input_file_id(FileType::Video, input_story->video_, owner_dialog_id,
|
||||
false, false));
|
||||
auto sticker_file_ids =
|
||||
td->stickers_manager_->get_attached_sticker_file_ids(input_story->added_sticker_file_ids_);
|
||||
bool has_stickers = !sticker_file_ids.empty();
|
||||
td->videos_manager_->create_video(file_id, string(), PhotoSize(), AnimationSize(), has_stickers,
|
||||
std::move(sticker_file_ids), "story.mp4", "video/mp4", input_story->duration_,
|
||||
get_dimensions(720, 1280, nullptr), true, 0, false);
|
||||
|
||||
return make_unique<StoryContentVideo>(file_id, FileId());
|
||||
}
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
void merge_story_contents(Td *td, const StoryContent *old_content, StoryContent *new_content, DialogId dialog_id,
|
||||
bool need_merge_files, bool &is_content_changed, bool &need_update) {
|
||||
StoryContentType content_type = new_content->get_type();
|
||||
|
@ -13,6 +13,7 @@
|
||||
#include "td/telegram/telegram_api.h"
|
||||
|
||||
#include "td/utils/common.h"
|
||||
#include "td/utils/Status.h"
|
||||
|
||||
namespace td {
|
||||
|
||||
@ -33,6 +34,9 @@ class StoryContent {
|
||||
unique_ptr<StoryContent> get_story_content(Td *td, telegram_api::object_ptr<telegram_api::MessageMedia> &&media_ptr,
|
||||
DialogId owner_dialog_id);
|
||||
|
||||
Result<unique_ptr<StoryContent>> get_input_story_content(
|
||||
Td *td, td_api::object_ptr<td_api::InputStoryContent> &&input_story_content, DialogId owner_dialog_id);
|
||||
|
||||
void merge_story_contents(Td *td, const StoryContent *old_content, StoryContent *new_content, DialogId dialog_id,
|
||||
bool need_merge_files, bool &is_content_changed, bool &need_update);
|
||||
|
||||
|
Loading…
x
Reference in New Issue
Block a user