Add messageProperties.can_recognize_speech.
This commit is contained in:
parent
abb004d0de
commit
250f2fda12
@ -3850,7 +3850,8 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool cop
|
||||
//@can_get_statistics True, if the message statistics are available through getMessageStatistics and message forwards can be received using getMessagePublicForwards
|
||||
//@can_get_viewers True, if chat members already viewed the message can be received through getMessageViewers
|
||||
//@can_report_reactions True, if reactions on the message can be reported through reportMessageReactions
|
||||
messageProperties can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_reported:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_get_added_reactions:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_report_reactions:Bool = MessageProperties;
|
||||
//@can_recognize_speech True, if speech can be recognized for the message through recognizeSpeech
|
||||
messageProperties can_be_deleted_only_for_self:Bool can_be_deleted_for_all_users:Bool can_be_edited:Bool can_be_forwarded:Bool can_be_paid:Bool can_be_replied:Bool can_be_replied_in_another_chat:Bool can_be_reported:Bool can_be_saved:Bool can_be_shared_in_story:Bool can_get_added_reactions:Bool can_get_embedding_code:Bool can_get_link:Bool can_get_media_timestamp_links:Bool can_get_message_thread:Bool can_get_read_date:Bool can_get_statistics:Bool can_get_viewers:Bool can_report_reactions:Bool can_recognize_speech:Bool = MessageProperties;
|
||||
|
||||
|
||||
//@class SearchMessagesFilter @description Represents a filter for message search results
|
||||
@ -8464,9 +8465,9 @@ translateText text:formattedText to_language_code:string = FormattedText;
|
||||
//-"st", "sn", "sd", "si", "sk", "sl", "so", "es", "su", "sw", "sv", "tl", "tg", "ta", "tt", "te", "th", "tr", "tk", "uk", "ur", "ug", "uz", "vi", "cy", "xh", "yi", "ji", "yo", "zu"
|
||||
translateMessageText chat_id:int53 message_id:int53 to_language_code:string = FormattedText;
|
||||
|
||||
//@description Recognizes speech in a video note or a voice note message. The message must be successfully sent, must not be scheduled, and must be from a non-secret chat
|
||||
//@description Recognizes speech in a video note or a voice note message
|
||||
//@chat_id Identifier of the chat to which the message belongs
|
||||
//@message_id Identifier of the message
|
||||
//@message_id Identifier of the message. Use messageProperties.can_recognize_speech to check whether the message is suitable
|
||||
recognizeSpeech chat_id:int53 message_id:int53 = Ok;
|
||||
|
||||
//@description Rates recognized speech in a video note or a voice note message @chat_id Identifier of the chat to which the message belongs @message_id Identifier of the message @is_good Pass true if the speech recognition is good
|
||||
|
@ -17111,7 +17111,7 @@ void MessagesManager::translate_message_text(MessageFullId message_full_id, cons
|
||||
}
|
||||
|
||||
auto text = get_message_content_text(m->content.get());
|
||||
if (text == nullptr) {
|
||||
if (text == nullptr || text->text.empty()) {
|
||||
return promise.set_value(td_api::make_object<td_api::formattedText>());
|
||||
}
|
||||
|
||||
@ -17312,7 +17312,7 @@ void MessagesManager::get_message_properties(DialogId dialog_id, MessageId messa
|
||||
if (message_id.is_valid_sponsored()) {
|
||||
return promise.set_value(td_api::make_object<td_api::messageProperties>(
|
||||
false, false, false, false, false, false, false, false, false, false, false, false, false, false, false,
|
||||
false, false, false, false));
|
||||
false, false, false, false, false));
|
||||
}
|
||||
return promise.set_error(Status::Error(400, "Message not found"));
|
||||
}
|
||||
@ -17365,11 +17365,12 @@ void MessagesManager::get_message_properties(DialogId dialog_id, MessageId messa
|
||||
auto can_get_link = can_get_media_timestamp_links && dialog_type == DialogType::Channel;
|
||||
auto can_get_embedding_code = can_get_message_embedding_code(dialog_id, m).is_ok();
|
||||
auto can_report_reactions = can_report_message_reactions(dialog_id, m);
|
||||
auto can_recognize_speech = can_recognize_message_speech(dialog_id, m);
|
||||
promise.set_value(td_api::make_object<td_api::messageProperties>(
|
||||
can_delete_for_self, can_delete_for_all_users, can_be_edited, can_be_forwarded, can_be_paid, can_be_replied,
|
||||
can_be_replied_in_another_chat, can_be_reported, can_be_saved, can_be_shared_in_story, can_get_added_reactions,
|
||||
can_get_embedding_code, can_get_link, can_get_media_timestamp_links, can_get_message_thread, can_get_read_date,
|
||||
can_get_statistics, can_get_viewers, can_report_reactions));
|
||||
can_get_statistics, can_get_viewers, can_report_reactions, can_recognize_speech));
|
||||
}
|
||||
|
||||
bool MessagesManager::is_message_edited_recently(MessageFullId message_full_id, int32 seconds) {
|
||||
@ -17476,6 +17477,18 @@ bool MessagesManager::can_report_message_reactions(DialogId dialog_id, const Mes
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MessagesManager::can_recognize_message_speech(DialogId dialog_id, const Message *m) const {
|
||||
if (td_->auth_manager_->is_bot() || m == nullptr || !m->message_id.is_valid() || !m->message_id.is_server() ||
|
||||
dialog_id.get_type() == DialogType::SecretChat) {
|
||||
return false;
|
||||
}
|
||||
auto content_type = m->content->get_type();
|
||||
if (content_type != MessageContentType::VideoNote && content_type != MessageContentType::VoiceNote) {
|
||||
return false;
|
||||
}
|
||||
return true;
|
||||
}
|
||||
|
||||
Result<std::pair<string, bool>> MessagesManager::get_message_link(MessageFullId message_full_id, int32 media_timestamp,
|
||||
bool for_group, bool in_message_thread) {
|
||||
auto dialog_id = message_full_id.get_dialog_id();
|
||||
|
@ -1738,6 +1738,8 @@ class MessagesManager final : public Actor {
|
||||
|
||||
bool can_report_message_reactions(DialogId dialog_id, const Message *m) const;
|
||||
|
||||
bool can_recognize_message_speech(DialogId dialog_id, const Message *m) const;
|
||||
|
||||
Status can_get_message_read_date(DialogId dialog_id, const Message *m) const TD_WARN_UNUSED_RESULT;
|
||||
|
||||
Status can_get_message_viewers(MessageFullId message_full_id) TD_WARN_UNUSED_RESULT;
|
||||
|
Loading…
Reference in New Issue
Block a user