Add sendStory.areas.
This commit is contained in:
parent
7f4e614bfe
commit
f72ac41756
@ -4948,6 +4948,9 @@ inputStoryAreaTypePreviousVenue venue_provider:string venue_id:string = InputSto
|
||||
//@description Describes a clickable rectangle area on a story media to be added @position Position of the area @type Type of the area
|
||||
inputStoryArea position:storyAreaPosition type:InputStoryAreaType = InputStoryArea;
|
||||
|
||||
//@description Contains a list of story areas to be added @areas List of input story areas
|
||||
inputStoryAreas areas:vector<inputStoryArea> = InputStoryAreas;
|
||||
|
||||
|
||||
//@description Describes a video file sent in a story
|
||||
//@duration Duration of the video, in seconds
|
||||
@ -7363,12 +7366,13 @@ getStory story_sender_chat_id:int53 story_id:int32 only_local:Bool = Story;
|
||||
|
||||
//@description Sends a new story. Returns a temporary story with identifier 0
|
||||
//@content Content of the story
|
||||
//@areas Clickable rectangle areas to be shown on the story media; pass null if none
|
||||
//@caption Story caption; pass null to use an empty caption; 0-getOption("story_caption_length_max") characters
|
||||
//@privacy_settings The privacy settings for the story
|
||||
//@active_period Period after which the story is moved to archive, in seconds; must be one of 6 * 3600, 12 * 3600, 86400, 2 * 86400, 3 * 86400, or 7 * 86400 for Telegram Premium users, and 86400 otherwise
|
||||
//@is_pinned Pass true to keep the story accessible after expiration
|
||||
//@protect_content Pass true if the content of the story must be protected from forwarding and screenshotting
|
||||
sendStory content:InputStoryContent caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 is_pinned:Bool protect_content:Bool = Story;
|
||||
sendStory content:InputStoryContent areas:inputStoryAreas caption:formattedText privacy_settings:StoryPrivacySettings active_period:int32 is_pinned:Bool protect_content:Bool = Story;
|
||||
|
||||
//@description Changes content and caption of a previously sent story
|
||||
//@story_id Identifier of the story to edit
|
||||
|
@ -127,6 +127,7 @@ telegram_api::object_ptr<telegram_api::MediaArea> MediaArea::get_input_media_are
|
||||
return venue_.get_input_media_area_venue(coordinates_.get_input_media_area_coordinates());
|
||||
default:
|
||||
UNREACHABLE();
|
||||
return nullptr;
|
||||
}
|
||||
}
|
||||
|
||||
|
@ -591,12 +591,18 @@ class StoryManager::SendStoryQuery final : public Td::ResultHandler {
|
||||
if (story->noforwards_) {
|
||||
flags |= telegram_api::stories_sendStory::NOFORWARDS_MASK;
|
||||
}
|
||||
vector<telegram_api::object_ptr<telegram_api::MediaArea>> media_areas;
|
||||
for (const auto &media_area : story->areas_) {
|
||||
media_areas.push_back(media_area.get_input_media_area());
|
||||
}
|
||||
if (!media_areas.empty()) {
|
||||
flags |= telegram_api::stories_sendStory::MEDIA_AREAS_MASK;
|
||||
}
|
||||
|
||||
send_query(G()->net_query_creator().create(
|
||||
telegram_api::stories_sendStory(flags, false /*ignored*/, false /*ignored*/, std::move(input_media),
|
||||
vector<telegram_api::object_ptr<telegram_api::MediaArea>>(), caption.text,
|
||||
std::move(entities), std::move(privacy_rules), pending_story_->random_id_,
|
||||
period),
|
||||
std::move(media_areas), caption.text, std::move(entities),
|
||||
std::move(privacy_rules), pending_story_->random_id_, period),
|
||||
{{pending_story_->dialog_id_}}));
|
||||
}
|
||||
|
||||
@ -3386,6 +3392,7 @@ void StoryManager::do_get_story(StoryFullId story_full_id, Result<Unit> &&result
|
||||
}
|
||||
|
||||
void StoryManager::send_story(td_api::object_ptr<td_api::InputStoryContent> &&input_story_content,
|
||||
td_api::object_ptr<td_api::inputStoryAreas> &&input_areas,
|
||||
td_api::object_ptr<td_api::formattedText> &&input_caption,
|
||||
td_api::object_ptr<td_api::StoryPrivacySettings> &&settings, int32 active_period,
|
||||
bool is_pinned, bool protect_content,
|
||||
@ -3404,6 +3411,15 @@ void StoryManager::send_story(td_api::object_ptr<td_api::InputStoryContent> &&in
|
||||
return promise.set_error(Status::Error(400, "Invalid story active period specified"));
|
||||
}
|
||||
}
|
||||
vector<MediaArea> areas;
|
||||
if (input_areas != nullptr) {
|
||||
for (auto &input_area : input_areas->areas_) {
|
||||
MediaArea media_area(td_, std::move(input_area), Auto());
|
||||
if (media_area.is_valid()) {
|
||||
areas.push_back(std::move(media_area));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
td_->messages_manager_->force_create_dialog(dialog_id, "send_story");
|
||||
|
||||
@ -3414,6 +3430,7 @@ void StoryManager::send_story(td_api::object_ptr<td_api::InputStoryContent> &&in
|
||||
story->noforwards_ = protect_content;
|
||||
story->privacy_rules_ = std::move(privacy_rules);
|
||||
story->content_ = dup_story_content(td_, content.get());
|
||||
story->areas_ = std::move(areas);
|
||||
story->caption_ = std::move(caption);
|
||||
|
||||
int64 random_id;
|
||||
|
@ -199,6 +199,7 @@ class StoryManager final : public Actor {
|
||||
Promise<td_api::object_ptr<td_api::story>> &&promise);
|
||||
|
||||
void send_story(td_api::object_ptr<td_api::InputStoryContent> &&input_story_content,
|
||||
td_api::object_ptr<td_api::inputStoryAreas> &&input_areas,
|
||||
td_api::object_ptr<td_api::formattedText> &&input_caption,
|
||||
td_api::object_ptr<td_api::StoryPrivacySettings> &&settings, int32 active_period, bool is_pinned,
|
||||
bool protect_content, Promise<td_api::object_ptr<td_api::story>> &&promise);
|
||||
|
@ -5633,7 +5633,7 @@ void Td::on_request(uint64 id, const td_api::getStory &request) {
|
||||
void Td::on_request(uint64 id, td_api::sendStory &request) {
|
||||
CHECK_IS_USER();
|
||||
CREATE_REQUEST_PROMISE();
|
||||
story_manager_->send_story(std::move(request.content_), std::move(request.caption_),
|
||||
story_manager_->send_story(std::move(request.content_), std::move(request.areas_), std::move(request.caption_),
|
||||
std::move(request.privacy_settings_), request.active_period_, request.is_pinned_,
|
||||
request.protect_content_, std::move(promise));
|
||||
}
|
||||
|
@ -4048,7 +4048,7 @@ class CliClient final : public Actor {
|
||||
send_request(td_api::make_object<td_api::sendStory>(
|
||||
td_api::make_object<td_api::inputStoryContentPhoto>(as_input_file(photo),
|
||||
to_integers<int32>(sticker_file_ids)),
|
||||
as_caption(caption), rules, active_period ? active_period : 86400, op == "sspp", protect_content));
|
||||
nullptr, as_caption(caption), rules, active_period ? active_period : 86400, op == "sspp", protect_content));
|
||||
} else if (op == "ssv" || op == "ssvp") {
|
||||
string video;
|
||||
string caption;
|
||||
@ -4061,7 +4061,7 @@ class CliClient final : public Actor {
|
||||
send_request(td_api::make_object<td_api::sendStory>(
|
||||
td_api::make_object<td_api::inputStoryContentVideo>(as_input_file(video),
|
||||
to_integers<int32>(sticker_file_ids), duration, true),
|
||||
as_caption(caption), rules, active_period ? active_period : 86400, op == "ssvp", protect_content));
|
||||
nullptr, as_caption(caption), rules, active_period ? active_period : 86400, op == "ssvp", protect_content));
|
||||
} else if (op == "esc") {
|
||||
StoryId story_id;
|
||||
string caption;
|
||||
|
Loading…
Reference in New Issue
Block a user