@@ -71,6 +71,8 @@ dpp::task<> moderation::purge(const dpp::slashcommand_t &event, const nlohmann::
71
71
.add_field (" In channel" , channel.get_mention (), true );
72
72
try {
73
73
std::string reason = std::get<std::string>(event.get_parameter (" reason" ));
74
+ // Replace escaped newline "\\n" with actual newline character
75
+ util::escape_newlines (reason);
74
76
embed.add_field (" Reason" , reason, false );
75
77
} catch (const std::bad_variant_access&) {}
76
78
event.owner ->message_create (dpp::message (config[" log_channel_ids" ][" mod_log" ], embed));
@@ -198,6 +200,8 @@ dpp::task<> moderation::warn(const dpp::slashcommand_t &event, const nlohmann::j
198
200
co_return ;
199
201
}
200
202
std::string reason = std::get<std::string>(event.get_parameter (" reason" ));
203
+ // Replace escaped newline "\\n" with actual newline character
204
+ util::escape_newlines (reason);
201
205
// Check hierarchy
202
206
if (! co_await util::check_perms (event.owner , config, event.command .get_issuing_user ().id , user.user_id )) {
203
207
co_await thinking;
@@ -256,6 +260,8 @@ dpp::task<> moderation::unwarn(const dpp::slashcommand_t &event, const nlohmann:
256
260
// Send "thinking" response to allow time for DB operation
257
261
dpp::async thinking = event.co_thinking (true );
258
262
std::string reason = std::get<std::string>(event.get_parameter (" reason" ));
263
+ // Replace escaped newline "\\n" with actual newline character
264
+ util::escape_newlines (reason);
259
265
// Get ID and make sure it's a number
260
266
std::string id = std::get<std::string>(event.get_parameter (" id" ));
261
267
if (std::ranges::any_of (id, [](const char & c){return !std::isdigit (c);})) {
@@ -364,6 +370,8 @@ dpp::task<> moderation::mute(const dpp::slashcommand_t &event, const nlohmann::j
364
370
std::string reason;
365
371
try {
366
372
reason = std::get<std::string>(event.get_parameter (" reason" ));
373
+ // Replace escaped newline "\\n" with actual newline character
374
+ util::escape_newlines (reason);
367
375
} catch (const std::bad_variant_access&) {
368
376
reason = " No reason provided." ;
369
377
}
@@ -466,6 +474,8 @@ dpp::task<> moderation::unmute(const dpp::slashcommand_t &event, const nlohmann:
466
474
std::string reason;
467
475
try {
468
476
reason = std::get<std::string>(event.get_parameter (" reason" ));
477
+ // Replace escaped newline "\\n" with actual newline character
478
+ util::escape_newlines (reason);
469
479
} catch (const std::bad_variant_access&) {
470
480
reason = " No reason provided." ;
471
481
}
@@ -551,6 +561,8 @@ dpp::task<> moderation::kick(const dpp::slashcommand_t &event, const nlohmann::j
551
561
std::string reason;
552
562
try {
553
563
reason = std::get<std::string>(event.get_parameter (" reason" ));
564
+ // Replace escaped newline "\\n" with actual newline character
565
+ util::escape_newlines (reason);
554
566
} catch (const std::bad_variant_access&) {
555
567
reason = " No reason provided." ;
556
568
}
@@ -627,6 +639,8 @@ dpp::task<> moderation::ban(const dpp::slashcommand_t &event, const nlohmann::js
627
639
std::string reason;
628
640
try {
629
641
reason = std::get<std::string>(event.get_parameter (" reason" ));
642
+ // Replace escaped newline "\\n" with actual newline character
643
+ util::escape_newlines (reason);
630
644
} catch (const std::bad_variant_access&) {
631
645
reason = " No reason provided." ;
632
646
}
@@ -720,6 +734,8 @@ dpp::task<> moderation::unban(const dpp::slashcommand_t &event, const nlohmann::
720
734
std::string reason;
721
735
try {
722
736
reason = std::get<std::string>(event.get_parameter (" reason" ));
737
+ // Replace escaped newline "\\n" with actual newline character
738
+ util::escape_newlines (reason);
723
739
} catch (const std::bad_variant_access&) {
724
740
reason = " No reason provided." ;
725
741
}
0 commit comments