Add two new chat report reasons.

This commit is contained in:
levlam 2022-02-18 16:12:39 +03:00
parent 2bdd0d0c9a
commit ad22bf1174
4 changed files with 36 additions and 1 deletions

View File

@ -3255,6 +3255,12 @@ chatReportReasonUnrelatedLocation = ChatReportReason;
//@description The chat represents a fake account
chatReportReasonFake = ChatReportReason;
//@description The chat has illegal drugs related content
chatReportReasonIllegalDrugs = ChatReportReason;
//@description The chat contains messages with personal details
chatReportReasonPersonalDetails = ChatReportReason;
//@description A custom reason provided by the user
chatReportReasonCustom = ChatReportReason;

View File

@ -35,6 +35,10 @@ Result<ReportReason> ReportReason::get_report_reason(td_api::object_ptr<td_api::
return ReportReason::Type::UnrelatedLocation;
case td_api::chatReportReasonFake::ID:
return ReportReason::Type::Fake;
case td_api::chatReportReasonIllegalDrugs::ID:
return ReportReason::Type::IllegalDrugs;
case td_api::chatReportReasonPersonalDetails::ID:
return ReportReason::Type::PersonalDetails;
case td_api::chatReportReasonCustom::ID:
return ReportReason::Type::Custom;
default:
@ -61,6 +65,10 @@ tl_object_ptr<telegram_api::ReportReason> ReportReason::get_input_report_reason(
return make_tl_object<telegram_api::inputReportReasonGeoIrrelevant>();
case ReportReason::Type::Fake:
return make_tl_object<telegram_api::inputReportReasonFake>();
case ReportReason::Type::IllegalDrugs:
return make_tl_object<telegram_api::inputReportReasonIllegalDrugs>();
case ReportReason::Type::PersonalDetails:
return make_tl_object<telegram_api::inputReportReasonPersonalDetails>();
case ReportReason::Type::Custom:
return make_tl_object<telegram_api::inputReportReasonOther>();
default:
@ -86,6 +94,10 @@ StringBuilder &operator<<(StringBuilder &string_builder, const ReportReason &rep
return string_builder << "UnrelatedLocation";
case ReportReason::Type::Fake:
return string_builder << "Fake";
case ReportReason::Type::IllegalDrugs:
return string_builder << "IllegalDrugs";
case ReportReason::Type::PersonalDetails:
return string_builder << "PersonalDetails";
case ReportReason::Type::Custom:
return string_builder << "Custom";
default:

View File

@ -16,7 +16,18 @@
namespace td {
class ReportReason {
enum class Type : int32 { Spam, Violence, Pornography, ChildAbuse, Copyright, UnrelatedLocation, Fake, Custom };
enum class Type : int32 {
Spam,
Violence,
Pornography,
ChildAbuse,
Copyright,
UnrelatedLocation,
Fake,
IllegalDrugs,
PersonalDetails,
Custom
};
Type type_ = Type::Spam;
string message_;

View File

@ -1443,6 +1443,12 @@ class CliClient final : public Actor {
if (reason == "fake") {
return td_api::make_object<td_api::chatReportReasonFake>();
}
if (reason == "drugs") {
return td_api::make_object<td_api::chatReportReasonIllegalDrugs>();
}
if (reason == "pd") {
return td_api::make_object<td_api::chatReportReasonPersonalDetails>();
}
return td_api::make_object<td_api::chatReportReasonCustom>();
}