replace usernames with user mention

This commit is contained in:
Jonny_Bro (Nikita) 2024-04-07 20:14:04 +05:00
parent b0cdd9b2c9
commit 2cd08d3151
Signed by: jonny_bro
GPG key ID: 3F1ECC04147E9BD8
2 changed files with 7 additions and 12 deletions

View file

@ -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", {

View file

@ -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,
}),
});