2021-12-10 21:39:54 +05:00
|
|
|
const Command = require("../../base/Command.js"),
|
|
|
|
Discord = require("discord.js");
|
|
|
|
|
|
|
|
class Sanctions extends Command {
|
|
|
|
constructor (client) {
|
|
|
|
super(client, {
|
|
|
|
name: "sanctions",
|
|
|
|
dirname: __dirname,
|
|
|
|
enabled: true,
|
|
|
|
guildOnly: true,
|
2021-12-19 17:16:15 +05:00
|
|
|
aliases: [ "warns" ],
|
2021-12-10 21:39:54 +05:00
|
|
|
memberPermissions: [ "MANAGE_MESSAGES" ],
|
|
|
|
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ],
|
|
|
|
nsfw: false,
|
|
|
|
ownerOnly: false,
|
2021-12-22 17:32:50 +05:00
|
|
|
cooldown: 2000
|
2021-12-10 21:39:54 +05:00
|
|
|
});
|
|
|
|
}
|
|
|
|
|
|
|
|
async run (message, args, data) {
|
|
|
|
const user = await this.client.resolveUser(args[0]);
|
2021-12-11 01:11:50 +05:00
|
|
|
if (!user) return message.error("moderation/sanctions:MISSING_MEMBER");
|
|
|
|
|
2021-12-10 21:39:54 +05:00
|
|
|
const memberData = await this.client.findOrCreateMember({ id: user.id, guildID: message.guild.id });
|
|
|
|
|
|
|
|
const embed = new Discord.MessageEmbed()
|
2021-12-24 20:52:27 +05:00
|
|
|
.setAuthor(user.tag, user.displayAvatarURL({ size: 512, dynamic: true, format: "png" }))
|
2021-12-10 21:39:54 +05:00
|
|
|
.setColor(data.config.embed.color)
|
|
|
|
.setFooter(data.config.embed.footer);
|
|
|
|
|
2021-12-11 01:11:50 +05:00
|
|
|
if (memberData.sanctions.length < 1) {
|
|
|
|
embed.setDescription(message.translate("moderation/sanctions:NO_SANCTION", { username: user.tag }));
|
2021-12-10 21:39:54 +05:00
|
|
|
return message.channel.send(embed);
|
|
|
|
} else {
|
|
|
|
memberData.sanctions.forEach((s) => {
|
2021-12-24 20:52:27 +05:00
|
|
|
embed.addField(s.type + " | #" + s.case, `${message.translate("common:MODERATOR")}: <@${s.moderator}>\n${message.translate("common:REASON")}: ${s.reason}`, true);
|
2021-12-10 21:39:54 +05:00
|
|
|
});
|
2021-12-11 01:11:50 +05:00
|
|
|
};
|
2021-12-10 21:39:54 +05:00
|
|
|
message.channel.send(embed);
|
|
|
|
}
|
2021-12-11 01:11:50 +05:00
|
|
|
};
|
2021-12-10 21:39:54 +05:00
|
|
|
|
2021-12-11 01:11:50 +05:00
|
|
|
module.exports = Sanctions;
|