JaBa/commands/Moderation/sanctions.js

61 lines
1.5 KiB
JavaScript
Raw Normal View History

const Command = require("../../base/Command"),
2022-01-04 02:18:28 +05:00
Discord = require("discord.js");
class Sanctions extends Command {
constructor(client) {
super(client, {
name: "sanctions",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["warns"],
memberPermissions: ["MANAGE_MESSAGES"],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 1000
});
}
async run(message, args, data) {
const user = await this.client.resolveUser(args[0]);
if (!user) return message.error("moderation/sanctions:MISSING_MEMBER");
const memberData = await this.client.findOrCreateMember({
id: user.id,
guildID: message.guild.id
});
const embed = new Discord.MessageEmbed()
.setAuthor({
name: user.tag,
iconURL: user.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
})
})
2022-01-04 02:18:28 +05:00
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
2022-01-04 02:18:28 +05:00
if (memberData.sanctions.length < 1) {
embed.setDescription(message.translate("moderation/sanctions:NO_SANCTION", {
username: user.tag
}));
return message.reply({
embeds: [embed]
});
2022-01-04 02:18:28 +05:00
} else {
memberData.sanctions.forEach((s) => {
embed.addField(s.type + " | #" + s.case, `${message.translate("common:MODERATOR")}: <@${s.moderator}>\n${message.translate("common:REASON")}: ${s.reason}`, true);
});
2022-01-13 00:26:23 +05:00
}
message.reply({
embeds: [embed]
});
2022-01-04 02:18:28 +05:00
}
2022-01-13 00:26:23 +05:00
}
2022-01-04 02:18:28 +05:00
module.exports = Sanctions;