Rename ChatReportReason to ReportReason.

This commit is contained in:
levlam 2023-06-22 13:47:52 +03:00
parent 26c8c0f4fa
commit 579eef5f10
4 changed files with 43 additions and 43 deletions

View File

@ -1507,11 +1507,11 @@ publicChatTypeIsLocationBased = PublicChatType;
//@class ChatActionBar @description Describes actions which must be possible to do through a chat action bar
//@description The chat can be reported as spam using the method reportChat with the reason chatReportReasonSpam. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown
//@description The chat can be reported as spam using the method reportChat with the reason reportReasonSpam. If the chat is a private chat with a user with an emoji status, then a notice about emoji status usage must be shown
//@can_unarchive If true, the chat was automatically archived and can be moved back to the main chat list using addChatToList simultaneously with setting chat notification settings to default using setChatNotificationSettings
chatActionBarReportSpam can_unarchive:Bool = ChatActionBar;
//@description The chat is a location-based supergroup, which can be reported as having unrelated location using the method reportChat with the reason chatReportReasonUnrelatedLocation
//@description The chat is a location-based supergroup, which can be reported as having unrelated location using the method reportChat with the reason reportReasonUnrelatedLocation
chatActionBarReportUnrelatedLocation = ChatActionBar;
//@description The chat is a recently created group chat to which new members can be invited
@ -4639,37 +4639,37 @@ connectedWebsite id:int64 domain_name:string bot_user_id:int53 browser:string pl
connectedWebsites websites:vector<connectedWebsite> = ConnectedWebsites;
//@class ChatReportReason @description Describes the reason why a chat is reported
//@class ReportReason @description Describes the reason why a chat is reported
//@description The chat contains spam messages
chatReportReasonSpam = ChatReportReason;
reportReasonSpam = ReportReason;
//@description The chat promotes violence
chatReportReasonViolence = ChatReportReason;
reportReasonViolence = ReportReason;
//@description The chat contains pornographic messages
chatReportReasonPornography = ChatReportReason;
reportReasonPornography = ReportReason;
//@description The chat has child abuse related content
chatReportReasonChildAbuse = ChatReportReason;
reportReasonChildAbuse = ReportReason;
//@description The chat contains copyrighted content
chatReportReasonCopyright = ChatReportReason;
reportReasonCopyright = ReportReason;
//@description The location-based chat is unrelated to its stated location
chatReportReasonUnrelatedLocation = ChatReportReason;
reportReasonUnrelatedLocation = ReportReason;
//@description The chat represents a fake account
chatReportReasonFake = ChatReportReason;
reportReasonFake = ReportReason;
//@description The chat has illegal drugs related content
chatReportReasonIllegalDrugs = ChatReportReason;
reportReasonIllegalDrugs = ReportReason;
//@description The chat contains messages with personal details
chatReportReasonPersonalDetails = ChatReportReason;
reportReasonPersonalDetails = ReportReason;
//@description A custom reason provided by the user
chatReportReasonCustom = ChatReportReason;
reportReasonCustom = ReportReason;
//@class TargetChat @description Describes the target chat to be opened
@ -7297,7 +7297,7 @@ getStoryViewers story_id:int32 offset_viewer:messageViewer limit:int32 = Message
//@story_id The identifier of the story to report
//@reason The reason for reporting the story
//@text Additional report details; 0-1024 characters
reportStory story_sender_user_id:int53 story_id:int32 reason:ChatReportReason text:string = Ok;
reportStory story_sender_user_id:int53 story_id:int32 reason:ReportReason text:string = Ok;
//@description Returns information about a bot that can be added to attachment menu @bot_user_id Bot's user identifier
@ -8272,14 +8272,14 @@ removeChatActionBar chat_id:int53 = Ok;
//@message_ids Identifiers of reported messages; may be empty to report the whole chat
//@reason The reason for reporting the chat
//@text Additional report details; 0-1024 characters
reportChat chat_id:int53 message_ids:vector<int53> reason:ChatReportReason text:string = Ok;
reportChat chat_id:int53 message_ids:vector<int53> reason:ReportReason text:string = Ok;
//@description Reports a chat photo to the Telegram moderators. A chat photo can be reported only if chat.can_be_reported
//@chat_id Chat identifier
//@file_id Identifier of the photo to report. Only full photos from chatPhoto can be reported
//@reason The reason for reporting the chat photo
//@text Additional report details; 0-1024 characters
reportChatPhoto chat_id:int53 file_id:int32 reason:ChatReportReason text:string = Ok;
reportChatPhoto chat_id:int53 file_id:int32 reason:ReportReason text:string = Ok;
//@description Reports reactions set on a message to the Telegram moderators. Reactions on a message can be reported only if message.can_report_reactions
//@chat_id Chat identifier

View File

@ -10,7 +10,7 @@
namespace td {
Result<ReportReason> ReportReason::get_report_reason(td_api::object_ptr<td_api::ChatReportReason> reason,
Result<ReportReason> ReportReason::get_report_reason(td_api::object_ptr<td_api::ReportReason> reason,
string &&message) {
if (reason == nullptr) {
return Status::Error(400, "Chat report reason must be non-empty");
@ -21,25 +21,25 @@ Result<ReportReason> ReportReason::get_report_reason(td_api::object_ptr<td_api::
auto type = [&] {
switch (reason->get_id()) {
case td_api::chatReportReasonSpam::ID:
case td_api::reportReasonSpam::ID:
return ReportReason::Type::Spam;
case td_api::chatReportReasonViolence::ID:
case td_api::reportReasonViolence::ID:
return ReportReason::Type::Violence;
case td_api::chatReportReasonPornography::ID:
case td_api::reportReasonPornography::ID:
return ReportReason::Type::Pornography;
case td_api::chatReportReasonChildAbuse::ID:
case td_api::reportReasonChildAbuse::ID:
return ReportReason::Type::ChildAbuse;
case td_api::chatReportReasonCopyright::ID:
case td_api::reportReasonCopyright::ID:
return ReportReason::Type::Copyright;
case td_api::chatReportReasonUnrelatedLocation::ID:
case td_api::reportReasonUnrelatedLocation::ID:
return ReportReason::Type::UnrelatedLocation;
case td_api::chatReportReasonFake::ID:
case td_api::reportReasonFake::ID:
return ReportReason::Type::Fake;
case td_api::chatReportReasonIllegalDrugs::ID:
case td_api::reportReasonIllegalDrugs::ID:
return ReportReason::Type::IllegalDrugs;
case td_api::chatReportReasonPersonalDetails::ID:
case td_api::reportReasonPersonalDetails::ID:
return ReportReason::Type::PersonalDetails;
case td_api::chatReportReasonCustom::ID:
case td_api::reportReasonCustom::ID:
return ReportReason::Type::Custom;
default:
UNREACHABLE();

View File

@ -39,7 +39,7 @@ class ReportReason {
public:
ReportReason() = default;
static Result<ReportReason> get_report_reason(td_api::object_ptr<td_api::ChatReportReason> reason, string &&message);
static Result<ReportReason> get_report_reason(td_api::object_ptr<td_api::ReportReason> reason, string &&message);
tl_object_ptr<telegram_api::ReportReason> get_input_report_reason() const;

View File

@ -1784,39 +1784,39 @@ class CliClient final : public Actor {
return td_api::make_object<td_api::chatActionTyping>();
}
static td_api::object_ptr<td_api::ChatReportReason> as_chat_report_reason(MutableSlice reason) {
static td_api::object_ptr<td_api::ReportReason> as_report_reason(MutableSlice reason) {
reason = trim(reason);
if (reason == "null") {
return nullptr;
}
if (reason == "spam") {
return td_api::make_object<td_api::chatReportReasonSpam>();
return td_api::make_object<td_api::reportReasonSpam>();
}
if (reason == "violence") {
return td_api::make_object<td_api::chatReportReasonViolence>();
return td_api::make_object<td_api::reportReasonViolence>();
}
if (reason == "porno") {
return td_api::make_object<td_api::chatReportReasonPornography>();
return td_api::make_object<td_api::reportReasonPornography>();
}
if (reason == "ca") {
return td_api::make_object<td_api::chatReportReasonChildAbuse>();
return td_api::make_object<td_api::reportReasonChildAbuse>();
}
if (reason == "copyright") {
return td_api::make_object<td_api::chatReportReasonCopyright>();
return td_api::make_object<td_api::reportReasonCopyright>();
}
if (reason == "geo" || reason == "location") {
return td_api::make_object<td_api::chatReportReasonUnrelatedLocation>();
return td_api::make_object<td_api::reportReasonUnrelatedLocation>();
}
if (reason == "fake") {
return td_api::make_object<td_api::chatReportReasonFake>();
return td_api::make_object<td_api::reportReasonFake>();
}
if (reason == "drugs") {
return td_api::make_object<td_api::chatReportReasonIllegalDrugs>();
return td_api::make_object<td_api::reportReasonIllegalDrugs>();
}
if (reason == "pd") {
return td_api::make_object<td_api::chatReportReasonPersonalDetails>();
return td_api::make_object<td_api::reportReasonPersonalDetails>();
}
return td_api::make_object<td_api::chatReportReasonCustom>();
return td_api::make_object<td_api::reportReasonCustom>();
}
static td_api::object_ptr<td_api::NetworkType> as_network_type(MutableSlice type) {
@ -4082,8 +4082,8 @@ class CliClient final : public Actor {
string reason;
string text;
get_args(args, story_sender_user_id, story_id, reason, text);
send_request(td_api::make_object<td_api::reportStory>(story_sender_user_id, story_id,
as_chat_report_reason(reason), text));
send_request(
td_api::make_object<td_api::reportStory>(story_sender_user_id, story_id, as_report_reason(reason), text));
} else if (op == "gamb") {
UserId user_id;
get_args(args, user_id);
@ -5566,14 +5566,14 @@ class CliClient final : public Actor {
string text;
get_args(args, chat_id, message_ids, reason, text);
send_request(td_api::make_object<td_api::reportChat>(chat_id, as_message_ids(message_ids),
as_chat_report_reason(reason), text));
as_report_reason(reason), text));
} else if (op == "rcp") {
ChatId chat_id;
FileId file_id;
string reason;
string text;
get_args(args, chat_id, file_id, reason, text);
send_request(td_api::make_object<td_api::reportChatPhoto>(chat_id, file_id, as_chat_report_reason(reason), text));
send_request(td_api::make_object<td_api::reportChatPhoto>(chat_id, file_id, as_report_reason(reason), text));
} else if (op == "reportmr") {
ChatId chat_id;
MessageId message_id;