JaBa/commands/General/suggest.js

47 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 {
constructor (client) {
super(client, {
name: "suggest",
dirname: __dirname,
enabled: true,
guildOnly: true,
aliases: [ "suggestion", "sugg" ],
memberPermissions: [],
botPermissions: [ "SEND_MESSAGES", "EMBED_LINKS" ],
nsfw: false,
ownerOnly: false,
cooldown: 5000
});
}
async run (message, args, data) {
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-11 01:11:50 +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)
.addField(message.translate("common:CONTENT"), "**"+sugg+"**")
.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-11 01:11:50 +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;