Development (#112)
Co-authored-by: Samuel Shuert <samuel.shuert@gmail.com>
diff --git a/src/commands/mod/ban.ts b/src/commands/mod/ban.ts
index 78f936c..3ed7f14 100644
--- a/src/commands/mod/ban.ts
+++ b/src/commands/mod/ban.ts
@@ -86,8 +86,9 @@
const config = await client.database.guilds.read(interaction.guild.id);
try {
if (notify) {
+ let formattedReason: string | null = null;
if (reason) {
- reason = reason
+ formattedReason = reason
.split("\n")
.map((line) => "> " + line)
.join("\n");
@@ -102,7 +103,7 @@
.setTitle("Banned")
.setDescription(
`You have been banned from ${interaction.guild.name}` +
- (reason ? ` for:\n${reason}` : ".\n*No reason was provided.*")
+ (formattedReason ? ` for:\n${formattedReason}` : ".\n*No reason was provided.*")
)
.setStatus("Danger")
],
diff --git a/src/commands/mod/kick.ts b/src/commands/mod/kick.ts
index f9242fe..9ed4bb3 100644
--- a/src/commands/mod/kick.ts
+++ b/src/commands/mod/kick.ts
@@ -74,8 +74,9 @@
const config = await client.database.guilds.read(interaction.guild.id);
try {
if (notify) {
+ let formattedReason: string | null = null;
if (reason) {
- reason = reason
+ formattedReason = reason
.split("\n")
.map((line) => "> " + line)
.join("\n");
@@ -90,7 +91,7 @@
.setTitle("Kicked")
.setDescription(
`You have been kicked from ${interaction.guild.name}` +
- (reason ? ` for:\n${reason}` : ".\n*No reason was provided.*")
+ (formattedReason ? ` for:\n${formattedReason}` : ".\n*No reason was provided.*")
)
.setStatus("Danger")
],
diff --git a/src/commands/mod/mute.ts b/src/commands/mod/mute.ts
index 0cfe660..3b6e06b 100644
--- a/src/commands/mod/mute.ts
+++ b/src/commands/mod/mute.ts
@@ -250,8 +250,9 @@
let dmMessage;
try {
if (notify) {
+ let formattedReason: string | null = null;
if (reason) {
- reason = reason
+ formattedReason = reason
.split("\n")
.map((line) => "> " + line)
.join("\n");
@@ -266,7 +267,7 @@
.setTitle("Muted")
.setDescription(
`You have been muted in ${interaction.guild.name}` +
- (reason ? ` for:\n${reason}` : ".\n*No reason was provided*") +
+ (formattedReason ? ` for:\n${formattedReason}` : ".\n*No reason was provided*") +
"\n\n" +
`You will be unmuted at: <t:${Math.round(Date.now() / 1000) + muteTime}:D> at ` +
`<t:${Math.round(Date.now() / 1000) + muteTime}:T> (<t:${
diff --git a/src/commands/mod/softban.ts b/src/commands/mod/softban.ts
index 984bb6b..19605c7 100644
--- a/src/commands/mod/softban.ts
+++ b/src/commands/mod/softban.ts
@@ -81,8 +81,9 @@
const config = await client.database.guilds.read(interaction.guild.id);
try {
if (notify) {
+ let formattedReason: string | null = null;
if (reason) {
- reason = reason
+ formattedReason = reason
.split("\n")
.map((line) => "> " + line)
.join("\n");
@@ -97,7 +98,7 @@
.setTitle("Softban")
.setDescription(
`You have been softbanned from ${interaction.guild.name}` +
- (reason ? ` for:\n${reason}` : ".\n*No reason was provided.*")
+ (formattedReason ? ` for:\n${formattedReason}` : ".\n*No reason was provided.*")
)
.setStatus("Danger")
],
diff --git a/src/commands/mod/unmute.ts b/src/commands/mod/unmute.ts
index 516bd39..0200c22 100644
--- a/src/commands/mod/unmute.ts
+++ b/src/commands/mod/unmute.ts
@@ -57,6 +57,13 @@
let dmMessage;
try {
if (notify) {
+ let formattedReason: string | null = null;
+ if (reason) {
+ formattedReason = reason
+ .split("\n")
+ .map((line) => "> " + line)
+ .join("\n");
+ }
dmMessage = await (interaction.options.getMember("user") as GuildMember).send({
embeds: [
new EmojiEmbed()
@@ -64,7 +71,7 @@
.setTitle("Unmuted")
.setDescription(
`You have been unmuted in ${interaction.guild.name}` +
- (reason ? ` for:\n> ${reason}` : " with no reason provided.")
+ (formattedReason ? ` for:\n> ${formattedReason}` : " with no reason provided.")
)
.setStatus("Success")
]
diff --git a/src/commands/mod/warn.ts b/src/commands/mod/warn.ts
index 7790fa8..020a962 100644
--- a/src/commands/mod/warn.ts
+++ b/src/commands/mod/warn.ts
@@ -84,8 +84,9 @@
const config = await client.database.guilds.read(interaction.guild.id);
try {
if (notify) {
+ let formattedReason: string | null = null;
if (reason) {
- reason = reason
+ formattedReason = reason
.split("\n")
.map((line) => "> " + line)
.join("\n");
@@ -100,7 +101,7 @@
.setTitle("Warned")
.setDescription(
`You have been warned in ${interaction.guild.name}` +
- (reason ? ` for:\n${reason}` : ".\n*No reason was provided*") +
+ (formattedReason ? ` for:\n${formattedReason}` : ".\n*No reason was provided*") +
"\n\n" +
(createAppealTicket
? `You can appeal this in the ticket created in <#${