JaBa/commands/General/suggest.js

55 lines
1.6 KiB
JavaScript
Raw Normal View History

2021-12-10 21:39:54 +05:00
const Command = require("../../base/Command.js"),
Discord = require("discord.js");
class Suggest extends Command {
2021-12-26 19:29:37 +05:00
constructor(client) {
2021-12-10 21:39:54 +05:00
super(client, {
name: "suggest",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: ["sugg"],
2021-12-10 21:39:54 +05:00
memberPermissions: [],
2021-12-26 19:29:37 +05:00
botPermissions: ["SEND_MESSAGES", "EMBED_LINKS"],
2021-12-10 21:39:54 +05:00
nsfw: false,
ownerOnly: false,
cooldown: 2000
2021-12-10 21:39:54 +05:00
});
}
2021-12-26 19:29:37 +05:00
async run(message, args, data) {
2021-12-10 21:39:54 +05:00
const suggChannel = message.guild.channels.cache.get(data.guild.plugins.suggestions);
2021-12-11 01:11:50 +05:00
if (!suggChannel) return message.error("general/suggest:MISSING_CHANNEL");
2021-12-10 21:39:54 +05:00
const sugg = args.join(" ");
2021-12-11 01:11:50 +05:00
if (!sugg) return message.error("general/suggest:MISSING_CONTENT");
2021-12-10 21:39:54 +05:00
const embed = new Discord.MessageEmbed()
2021-12-26 19:29:37 +05:00
.setAuthor(message.translate("general/suggest:TITLE", {
user: message.author.username
}), message.author.displayAvatarURL({
size: 512,
dynamic: true,
format: "png"
}))
2021-12-10 21:39:54 +05:00
.addField(message.translate("common:AUTHOR"), `\`${message.author.username}#${message.author.discriminator}\``, true)
.addField(message.translate("common:DATE"), message.printDate(new Date(Date.now())), true)
2021-12-24 20:52:27 +05:00
.addField(message.translate("common:CONTENT"), sugg)
2021-12-10 21:39:54 +05:00
.setColor(data.config.embed.color)
.setFooter(data.config.embed.footer);
const success = Discord.Util.parseEmoji(this.client.customEmojis.success).id;
const error = Discord.Util.parseEmoji(this.client.customEmojis.error).id;
2021-12-11 01:11:50 +05:00
2021-12-10 21:39:54 +05:00
suggChannel.send(embed).then(async (m) => {
await m.react(success);
await m.react(error);
});
2021-12-26 19:29:37 +05:00
message.success("general/suggest:SUCCESS", {
channel: suggChannel.toString()
});
2021-12-10 21:39:54 +05:00
}
2021-12-11 01:11:50 +05:00
};
2021-12-10 21:39:54 +05:00
module.exports = Suggest;