mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-22 13:14:58 +05:00
5f4c53b072
Удалён мусор и ненужные комментарии
99 lines
No EOL
2.7 KiB
JavaScript
99 lines
No EOL
2.7 KiB
JavaScript
const { SlashCommandBuilder, EmbedBuilder, parseEmoji } = require("discord.js");
|
|
const BaseCommand = require("../../base/BaseCommand");
|
|
|
|
class Report extends BaseCommand {
|
|
/**
|
|
*
|
|
* @param {import("../base/JaBa")} client
|
|
*/
|
|
constructor(client) {
|
|
super({
|
|
command: new SlashCommandBuilder()
|
|
.setName("report")
|
|
.setDescription(client.translate("general/report:DESCRIPTION"))
|
|
.addUserOption(option => option.setName("user")
|
|
.setDescription(client.translate("common:USER"))
|
|
.setRequired(true))
|
|
.addStringOption(option => option.setName("message")
|
|
.setDescription(client.translate("common:MESSAGE"))
|
|
.setRequired(true)),
|
|
aliases: [],
|
|
dirname: __dirname,
|
|
guildOnly: true,
|
|
ownerOnly: false
|
|
});
|
|
}
|
|
/**
|
|
*
|
|
* @param {import("../../base/JaBa")} client
|
|
*/
|
|
async onLoad() {
|
|
//...
|
|
}
|
|
/**
|
|
*
|
|
* @param {import("../../base/JaBa")} client
|
|
* @param {import("discord.js").ChatInputCommandInteraction} interaction
|
|
* @param {Array} data
|
|
*/
|
|
async execute(client, interaction) {
|
|
if (interaction.user.id === "285109105717280768") return interaction.reply({ content: "Пошёл нахуй фахон" });
|
|
const repChannel = interaction.guild.channels.cache.get(interaction.guild.data.plugins.reports);
|
|
if (!repChannel) return interaction.error("general/report:MISSING_CHANNEL");
|
|
const member = interaction.options.getMember("user");
|
|
if (member.id === interaction.user.id) return interaction.error("general/report:INVALID_USER");
|
|
const rep = interaction.options.getString("message");
|
|
|
|
const embed = new EmbedBuilder()
|
|
.setAuthor({
|
|
name: interaction.translate("general/report:TITLE", {
|
|
user: member.user.tag
|
|
}),
|
|
iconURL: interaction.user.displayAvatarURL({
|
|
extension: "png",
|
|
size: 512
|
|
})
|
|
})
|
|
.addFields([
|
|
{
|
|
name: interaction.translate("common:DATE"),
|
|
value: client.printDate(new Date(Date.now()))
|
|
},
|
|
{
|
|
name: interaction.translate("common:AUTHOR"),
|
|
value: interaction.user.toString(),
|
|
inline: true
|
|
},
|
|
{
|
|
name: interaction.translate("common:USER"),
|
|
value: member.user.toString(),
|
|
inline: true
|
|
},
|
|
{
|
|
name: interaction.translate("common:REASON"),
|
|
value: rep,
|
|
inline: true
|
|
}
|
|
])
|
|
.setColor(client.config.embed.color)
|
|
.setFooter({
|
|
text: client.config.embed.footer
|
|
});
|
|
|
|
const success = parseEmoji(client.customEmojis.cool).id;
|
|
const error = parseEmoji(client.customEmojis.notcool).id;
|
|
|
|
repChannel.send({
|
|
embeds: [embed]
|
|
}).then(async (m) => {
|
|
await m.react(success);
|
|
await m.react(error);
|
|
});
|
|
|
|
interaction.success("general/report:SUCCESS", {
|
|
channel: repChannel.toString()
|
|
});
|
|
}
|
|
}
|
|
|
|
module.exports = Report; |