Add chatEventMessageDeleted.can_report_anti_spam_false_positive.

This commit is contained in:
levlam 2022-11-25 16:50:16 +03:00
parent 3d3f73df7a
commit e6941d231d
4 changed files with 15 additions and 3 deletions

View File

@ -2906,8 +2906,8 @@ gameHighScores scores:vector<gameHighScore> = GameHighScores;
//@description A message was edited @old_message The original message before the edit @new_message The message after it was edited
chatEventMessageEdited old_message:message new_message:message = ChatEventAction;
//@description A message was deleted @message Deleted message
chatEventMessageDeleted message:message = ChatEventAction;
//@description A message was deleted @message Deleted message @can_report_anti_spam_false_positive True, if the message deletion can be reported via reportSupergroupAntiSpamFalsePositive
chatEventMessageDeleted message:message can_report_anti_spam_false_positive:Bool = ChatEventAction;
//@description A message was pinned @message Pinned message
chatEventMessagePinned message:message = ChatEventAction;

View File

@ -1848,6 +1848,11 @@ void ConfigManager::process_app_config(tl_object_ptr<telegram_api::JSONValue> &c
forum_upgrade_participants_min = get_json_value_int(std::move(key_value->value_), key);
continue;
}
if (key == "telegram_antispam_user_id") {
auto setting_value = get_json_value_long(std::move(key_value->value_), key);
G()->set_option_integer("telegram_antispam_user_id", setting_value);
continue;
}
new_values.push_back(std::move(key_value));
}

View File

@ -204,7 +204,7 @@ static td_api::object_ptr<td_api::ChatEventAction> get_chat_event_action_object(
if (message == nullptr) {
return nullptr;
}
return td_api::make_object<td_api::chatEventMessageDeleted>(std::move(message));
return td_api::make_object<td_api::chatEventMessageDeleted>(std::move(message), false);
}
case telegram_api::channelAdminLogEventActionChangeStickerSet::ID: {
auto action = move_tl_object_as<telegram_api::channelAdminLogEventActionChangeStickerSet>(action_ptr);
@ -460,6 +460,7 @@ class GetChannelAdminLogQuery final : public Td::ResultHandler {
td_->contacts_manager_->on_get_users(std::move(events->users_), "on_get_event_log");
td_->contacts_manager_->on_get_chats(std::move(events->chats_), "on_get_event_log");
auto anti_spam_user_id = UserId(G()->get_option_integer("telegram_antispam_user_id"));
auto result = td_api::make_object<td_api::chatEvents>();
result->events_.reserve(events->events_.size());
for (auto &event : events->events_) {
@ -480,6 +481,10 @@ class GetChannelAdminLogQuery final : public Td::ResultHandler {
if (action == nullptr) {
continue;
}
if (user_id == anti_spam_user_id && anti_spam_user_id.is_valid() &&
action->get_id() == td_api::chatEventMessageDeleted::ID) {
static_cast<td_api::chatEventMessageDeleted *>(action.get())->can_report_anti_spam_false_positive_ = true;
}
if (user_id == ContactsManager::get_channel_bot_user_id() && actor_dialog_id.is_valid() &&
actor_dialog_id.get_type() != DialogType::User) {
user_id = UserId();

View File

@ -282,6 +282,8 @@ bool OptionManager::is_internal_option(Slice name) {
name == "saved_gifs_limit_premium" || name == "session_count" || name == "stickers_faved_limit_default" ||
name == "stickers_faved_limit_premium" || name == "stickers_normal_by_emoji_per_premium_num" ||
name == "stickers_premium_by_emoji_num";
case 't':
return name == "telegram_antispam_user_id";
case 'v':
return name == "video_note_size_max";
case 'w':