2022-01-04 02:18:28 +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,
|
|
|
|
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()
|
2022-01-05 00:24:57 +05:00
|
|
|
.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)
|
2022-01-05 00:24:57 +05:00
|
|
|
.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
|
|
|
|
}));
|
2022-01-05 00:24:57 +05:00
|
|
|
return message.channel.send({
|
|
|
|
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-05 00:24:57 +05:00
|
|
|
message.channel.send({
|
|
|
|
embeds: [embed]
|
|
|
|
});
|
2022-01-04 02:18:28 +05:00
|
|
|
}
|
|
|
|
};
|
|
|
|
|
|
|
|
module.exports = Sanctions;
|