Add messageProperties.can_set_fact_check.
This commit is contained in:
parent
46beb7d873
commit
ecd58a70ce
@ -3852,7 +3852,8 @@ inputMessageForwarded from_chat_id:int53 message_id:int53 in_game_share:Bool cop
|
||||
//@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
|
||||
//@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_edit_scheduling_state: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;
|
||||
//@can_set_fact_check True, if fact check for the message can be changed through setMessageFactCheck
|
||||
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_edit_scheduling_state: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 can_set_fact_check:Bool = MessageProperties;
|
||||
|
||||
|
||||
//@class SearchMessagesFilter @description Represents a filter for message search results
|
||||
@ -8646,9 +8647,9 @@ editInlineMessageReplyMarkup inline_message_id:string reply_markup:ReplyMarkup =
|
||||
//@scheduling_state The new message scheduling state; pass null to send the message immediately
|
||||
editMessageSchedulingState chat_id:int53 message_id:int53 scheduling_state:MessageSchedulingState = Ok;
|
||||
|
||||
//@description Changes the fact-check of a message. Can be only used if getOption("can_edit_fact_check") == true
|
||||
//@description Changes the fact-check of a message. Can be only used if messageProperties.can_set_fact_check == true
|
||||
//@chat_id The channel chat the message belongs to
|
||||
//@message_id Identifier of the message. The message must be one of the following types: messageAnimation, messageAudio, messageDocument, messagePhoto, messageText, messageVideo
|
||||
//@message_id Identifier of the message
|
||||
//@text New text of the fact-check; 0-getOption("fact_check_length_max") characters; pass null to remove it. Only Bold, Italic, and TextUrl entities with https://t.me/ links are supported
|
||||
setMessageFactCheck chat_id:int53 message_id:int53 text:formattedText = Ok;
|
||||
|
||||
|
@ -17365,12 +17365,13 @@ void MessagesManager::get_message_properties(DialogId dialog_id, MessageId messa
|
||||
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);
|
||||
auto can_set_fact_check = can_set_message_fact_check(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_edit_scheduling_state,
|
||||
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_recognize_speech));
|
||||
can_recognize_speech, can_set_fact_check));
|
||||
}
|
||||
|
||||
bool MessagesManager::is_message_edited_recently(MessageFullId message_full_id, int32 seconds) {
|
||||
@ -17489,6 +17490,30 @@ bool MessagesManager::can_recognize_message_speech(DialogId dialog_id, const Mes
|
||||
return true;
|
||||
}
|
||||
|
||||
bool MessagesManager::can_set_message_fact_check(DialogId dialog_id, const Message *m) const {
|
||||
if (!td_->option_manager_->get_option_boolean("can_edit_fact_check")) {
|
||||
return false;
|
||||
}
|
||||
if (td_->auth_manager_->is_bot() || m == nullptr || !m->message_id.is_valid() || !m->message_id.is_server() ||
|
||||
!td_->dialog_manager_->is_broadcast_channel(dialog_id)) {
|
||||
return false;
|
||||
}
|
||||
auto content_type = m->content->get_type();
|
||||
switch (content_type) {
|
||||
case MessageContentType::Animation:
|
||||
case MessageContentType::Audio:
|
||||
case MessageContentType::Document:
|
||||
case MessageContentType::Photo:
|
||||
case MessageContentType::Text:
|
||||
case MessageContentType::Video:
|
||||
// ok
|
||||
break;
|
||||
default:
|
||||
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();
|
||||
@ -25720,8 +25745,7 @@ void MessagesManager::set_message_fact_check(MessageFullId message_full_id,
|
||||
if (m == nullptr) {
|
||||
return promise.set_error(Status::Error(400, "Message not found"));
|
||||
}
|
||||
if (!td_->dialog_manager_->is_broadcast_channel(dialog_id) || !m->message_id.is_valid() ||
|
||||
!m->message_id.is_server()) {
|
||||
if (!can_set_message_fact_check(dialog_id, m)) {
|
||||
return promise.set_error(Status::Error(400, "Message fact-check can't be changed for the message"));
|
||||
}
|
||||
|
||||
|
@ -1740,6 +1740,8 @@ class MessagesManager final : public Actor {
|
||||
|
||||
bool can_recognize_message_speech(DialogId dialog_id, const Message *m) const;
|
||||
|
||||
bool can_set_message_fact_check(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