From 2cd08d3151ca5aabd52300cd01dcf9b05bde3b1f Mon Sep 17 00:00:00 2001 From: "Jonny_Bro (Nikita)" Date: Sun, 7 Apr 2024 20:14:04 +0500 Subject: [PATCH] replace usernames with user mention --- commands/Moderation/clear.js | 11 +++-------- commands/Moderation/warn.c.js | 8 ++++---- 2 files changed, 7 insertions(+), 12 deletions(-) diff --git a/commands/Moderation/clear.js b/commands/Moderation/clear.js index 092d1d79..a3e52321 100644 --- a/commands/Moderation/clear.js +++ b/commands/Moderation/clear.js @@ -119,22 +119,17 @@ class Clear extends BaseCommand { } else { if (isNaN(option) || parseInt(option) < 1) return interaction.error("misc:OPTION_NAN_ALL", null, { ephemeral: true }); - let messages = await interaction.channel.messages.fetch({ - limit: option, - }); + let messages = await interaction.channel.messages.fetch({ limit: option }); if (user_id && member) return interaction.replyT("moderation/clear:REQUIRE_ID_USER", null, { edit: true }); if (user_id || member) messages = messages.filter(m => m.author.id === (user_id || member.id)); - interaction.channel.bulkDelete( - messages.filter(m => !m.pinned), - true, - ); + interaction.channel.bulkDelete(messages.filter(m => !m.pinned), true); if (member || user_id) { interaction.replyT("moderation/clear:CLEARED_MEMBER", { amount: `**${option}** ${client.functions.getNoun(option, interaction.translate("misc:NOUNS:MESSAGES:1"), interaction.translate("misc:NOUNS:MESSAGES:2"), interaction.translate("misc:NOUNS:MESSAGES:5"))}`, - user: (member && member.user.getUsername()) || user_id, + user: user_id || member.toString(), }, { edit: true }); } else { interaction.replyT("moderation/clear:CLEARED", { diff --git a/commands/Moderation/warn.c.js b/commands/Moderation/warn.c.js index 6d8c84a9..e226c4ea 100644 --- a/commands/Moderation/warn.c.js +++ b/commands/Moderation/warn.c.js @@ -86,11 +86,11 @@ class WarnContext extends BaseCommand { fields: [ { name: interaction.translate("common:USER"), - value: `\`${member.user.getUsername()}\` (${member.user.toString()})`, + value: member.user.toString(), }, { name: interaction.translate("common:MODERATOR"), - value: `\`${interaction.user.getUsername()}\` (${interaction.user.toString()})`, + value: interaction.user.toString(), }, { name: interaction.translate("common:REASON"), @@ -164,9 +164,9 @@ class WarnContext extends BaseCommand { try { await member.send({ content: interaction.translate("moderation/warn:WARNED_DM", { - user: member.user.getUsername(), + user: member.toString(), server: interaction.guild.name, - moderator: interaction.user.getUsername(), + moderator: interaction.user.toString(), reason, }), });