JaBa/commands/General/report.js

69 lines
2.1 KiB
JavaScript
Raw Normal View History

const Command = require("../../base/Command"),
2022-01-04 02:18:28 +05:00
Discord = require("discord.js");
class Report extends Command {
constructor(client) {
super(client, {
name: "report",
dirname: __dirname,
enabled: true,
guildOnly: true,
2022-01-05 22:04:46 +05:00
aliases: ["repo"],
2022-01-04 02:18:28 +05:00
memberPermissions: [],
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
nsfw: false,
ownerOnly: false,
cooldown: 2000
});
}
async run(message, args, data) {
2022-01-09 13:42:33 +05:00
if (message.author.id === "285109105717280768") return message.channel.send({ content: "пошёл нахуй фахон" });
2022-01-04 02:18:28 +05:00
const repChannel = message.guild.channels.cache.get(data.guild.plugins.reports);
if (!repChannel) return message.error("general/report:MISSING_CHANNEL");
const member = await this.client.resolveMember(args[0], message.guild);
if (!member) return message.error("general/report:MISSING_USER");
if (member.id === message.author.id) return message.error("general/report:INVALID_USER");
const rep = args.slice(1).join(" ");
if (!rep) return message.error("general/report:MISSING_REASON");
const embed = new Discord.MessageEmbed()
.setAuthor({
name: message.translate("general/report:TITLE", {
user: member.user.tag
}),
iconURL: message.author.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
})
})
2022-01-04 02:18:28 +05:00
.addField(message.translate("common:AUTHOR"), message.author.tag, true)
.addField(message.translate("common:DATE"), message.printDate(new Date(Date.now())), true)
.addField(message.translate("common:REASON"), rep, true)
.addField(message.translate("common:USER"), `\`${member.user.tag}\` (${member.user.toString()})`, true)
.setColor(data.config.embed.color)
.setFooter({
text: data.config.embed.footer
});
2022-01-04 02:18:28 +05:00
const success = Discord.Util.parseEmoji(this.client.customEmojis.success).id;
const error = Discord.Util.parseEmoji(this.client.customEmojis.error).id;
repChannel.send({
embeds: [embed]
}).then(async (m) => {
2022-01-04 02:18:28 +05:00
await m.react(success);
await m.react(error);
});
message.success("general/report:SUCCESS", {
channel: repChannel.toString()
});
}
2022-01-13 00:26:23 +05:00
}
2022-01-04 02:18:28 +05:00
module.exports = Report;