Support sending of media with spoiler.
This commit is contained in:
parent
3342dcef23
commit
b0446523eb
@ -2600,7 +2600,7 @@ inputMessageDocument document:InputFile thumbnail:inputThumbnail disable_content
|
|||||||
//@height Photo height
|
//@height Photo height
|
||||||
//@caption Photo caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters
|
//@caption Photo caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters
|
||||||
//@ttl Photo TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats
|
//@ttl Photo TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats
|
||||||
//@has_spoiler True, if the photo preview should be covered by spoiler animation; not supported yet
|
//@has_spoiler True, if the photo preview should be covered by spoiler animation; not supported in secret chats
|
||||||
inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector<int32> width:int32 height:int32 caption:formattedText ttl:int32 has_spoiler:Bool = InputMessageContent;
|
inputMessagePhoto photo:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector<int32> width:int32 height:int32 caption:formattedText ttl:int32 has_spoiler:Bool = InputMessageContent;
|
||||||
|
|
||||||
//@description A sticker message
|
//@description A sticker message
|
||||||
@ -2621,7 +2621,7 @@ inputMessageSticker sticker:InputFile thumbnail:inputThumbnail width:int32 heigh
|
|||||||
//@supports_streaming True, if the video is supposed to be streamed
|
//@supports_streaming True, if the video is supposed to be streamed
|
||||||
//@caption Video caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters
|
//@caption Video caption; pass null to use an empty caption; 0-getOption("message_caption_length_max") characters
|
||||||
//@ttl Video TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats
|
//@ttl Video TTL (Time To Live), in seconds (0-60). A non-zero TTL can be specified only in private chats
|
||||||
//@has_spoiler True, if the video preview should be covered by spoiler animation; not supported yet
|
//@has_spoiler True, if the video preview should be covered by spoiler animation; not supported in secret chats
|
||||||
inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector<int32> duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText ttl:int32 has_spoiler:Bool = InputMessageContent;
|
inputMessageVideo video:InputFile thumbnail:inputThumbnail added_sticker_file_ids:vector<int32> duration:int32 width:int32 height:int32 supports_streaming:Bool caption:formattedText ttl:int32 has_spoiler:Bool = InputMessageContent;
|
||||||
|
|
||||||
//@description A video note message
|
//@description A video note message
|
||||||
|
@ -1881,6 +1881,7 @@ static Result<InputMessageContent> create_input_message_content(
|
|||||||
int32 ttl = 0;
|
int32 ttl = 0;
|
||||||
string emoji;
|
string emoji;
|
||||||
bool is_bot = td->auth_manager_->is_bot();
|
bool is_bot = td->auth_manager_->is_bot();
|
||||||
|
bool is_secret = dialog_id.get_type() == DialogType::SecretChat;
|
||||||
switch (input_message_content->get_id()) {
|
switch (input_message_content->get_id()) {
|
||||||
case td_api::inputMessageText::ID: {
|
case td_api::inputMessageText::ID: {
|
||||||
TRY_RESULT(input_message_text,
|
TRY_RESULT(input_message_text,
|
||||||
@ -1998,7 +1999,7 @@ static Result<InputMessageContent> create_input_message_content(
|
|||||||
message_photo->photo.sticker_file_ids = std::move(sticker_file_ids);
|
message_photo->photo.sticker_file_ids = std::move(sticker_file_ids);
|
||||||
|
|
||||||
message_photo->caption = std::move(caption);
|
message_photo->caption = std::move(caption);
|
||||||
message_photo->has_spoiler = input_photo->has_spoiler_ && false;
|
message_photo->has_spoiler = input_photo->has_spoiler_ && !is_secret;
|
||||||
|
|
||||||
content = std::move(message_photo);
|
content = std::move(message_photo);
|
||||||
break;
|
break;
|
||||||
@ -2026,7 +2027,7 @@ static Result<InputMessageContent> create_input_message_content(
|
|||||||
std::move(file_name), std::move(mime_type), input_video->duration_,
|
std::move(file_name), std::move(mime_type), input_video->duration_,
|
||||||
get_dimensions(input_video->width_, input_video->height_, nullptr), input_video->supports_streaming_, false);
|
get_dimensions(input_video->width_, input_video->height_, nullptr), input_video->supports_streaming_, false);
|
||||||
|
|
||||||
content = make_unique<MessageVideo>(file_id, std::move(caption), input_video->has_spoiler_ && false);
|
content = make_unique<MessageVideo>(file_id, std::move(caption), input_video->has_spoiler_ && !is_secret);
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
case td_api::inputMessageVideoNote::ID: {
|
case td_api::inputMessageVideoNote::ID: {
|
||||||
|
@ -440,6 +440,9 @@ tl_object_ptr<telegram_api::InputMedia> photo_get_input_media(FileManager *file_
|
|||||||
if (ttl != 0) {
|
if (ttl != 0) {
|
||||||
flags |= telegram_api::inputMediaPhoto::TTL_SECONDS_MASK;
|
flags |= telegram_api::inputMediaPhoto::TTL_SECONDS_MASK;
|
||||||
}
|
}
|
||||||
|
if (has_spoiler) {
|
||||||
|
flags |= telegram_api::inputMediaPhoto::SPOILER_MASK;
|
||||||
|
}
|
||||||
return make_tl_object<telegram_api::inputMediaPhoto>(flags, false /*ignored*/,
|
return make_tl_object<telegram_api::inputMediaPhoto>(flags, false /*ignored*/,
|
||||||
file_view.main_remote_location().as_input_photo(), ttl);
|
file_view.main_remote_location().as_input_photo(), ttl);
|
||||||
}
|
}
|
||||||
@ -448,6 +451,9 @@ tl_object_ptr<telegram_api::InputMedia> photo_get_input_media(FileManager *file_
|
|||||||
if (ttl != 0) {
|
if (ttl != 0) {
|
||||||
flags |= telegram_api::inputMediaPhotoExternal::TTL_SECONDS_MASK;
|
flags |= telegram_api::inputMediaPhotoExternal::TTL_SECONDS_MASK;
|
||||||
}
|
}
|
||||||
|
if (has_spoiler) {
|
||||||
|
flags |= telegram_api::inputMediaPhotoExternal::SPOILER_MASK;
|
||||||
|
}
|
||||||
LOG(INFO) << "Create inputMediaPhotoExternal with a URL " << file_view.url() << " and TTL " << ttl;
|
LOG(INFO) << "Create inputMediaPhotoExternal with a URL " << file_view.url() << " and TTL " << ttl;
|
||||||
return make_tl_object<telegram_api::inputMediaPhotoExternal>(flags, false /*ignored*/, file_view.url(), ttl);
|
return make_tl_object<telegram_api::inputMediaPhotoExternal>(flags, false /*ignored*/, file_view.url(), ttl);
|
||||||
}
|
}
|
||||||
|
@ -237,6 +237,9 @@ tl_object_ptr<telegram_api::InputMedia> VideosManager::get_input_media(
|
|||||||
if (ttl != 0) {
|
if (ttl != 0) {
|
||||||
flags |= telegram_api::inputMediaDocument::TTL_SECONDS_MASK;
|
flags |= telegram_api::inputMediaDocument::TTL_SECONDS_MASK;
|
||||||
}
|
}
|
||||||
|
if (has_spoiler) {
|
||||||
|
flags |= telegram_api::inputMediaDocument::SPOILER_MASK;
|
||||||
|
}
|
||||||
return make_tl_object<telegram_api::inputMediaDocument>(
|
return make_tl_object<telegram_api::inputMediaDocument>(
|
||||||
flags, false /*ignored*/, file_view.main_remote_location().as_input_document(), ttl, string());
|
flags, false /*ignored*/, file_view.main_remote_location().as_input_document(), ttl, string());
|
||||||
}
|
}
|
||||||
@ -245,6 +248,9 @@ tl_object_ptr<telegram_api::InputMedia> VideosManager::get_input_media(
|
|||||||
if (ttl != 0) {
|
if (ttl != 0) {
|
||||||
flags |= telegram_api::inputMediaDocumentExternal::TTL_SECONDS_MASK;
|
flags |= telegram_api::inputMediaDocumentExternal::TTL_SECONDS_MASK;
|
||||||
}
|
}
|
||||||
|
if (has_spoiler) {
|
||||||
|
flags |= telegram_api::inputMediaDocumentExternal::SPOILER_MASK;
|
||||||
|
}
|
||||||
return make_tl_object<telegram_api::inputMediaDocumentExternal>(flags, false /*ignored*/, file_view.url(), ttl);
|
return make_tl_object<telegram_api::inputMediaDocumentExternal>(flags, false /*ignored*/, file_view.url(), ttl);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user