Files
SupportBot/commands/suggest.js
T

53 lines
2.1 KiB
JavaScript
Raw Normal View History

2019-06-09 23:52:41 +01:00
// SupportBot
// Command: Suggest
const Discord = require("discord.js");
const bot = new Discord.Client()
bot.settings = require("../settings.json");
exports.run = async(bot, message, args) => {
message.delete();
const SuggestionEmbed = new Discord.RichEmbed()
2019-07-24 16:52:30 -06:00
.setTitle(`${bot.settings.Suggestion_Title}`)
.setDescription(`\`\`\`${args.join(" ")}\`\`\`\nFrom <@${message.author.id}>`)
.setFooter(`${bot.settings.footer}`, message.author.avatarURL)
2019-06-19 14:27:24 -06:00
.setTimestamp(new Date())
.setColor(bot.settings.colour);
2019-07-24 16:52:30 -06:00
2019-06-09 23:52:41 +01:00
let sc = message.guild.channels.find(SuggestionChannel => SuggestionChannel.name === `${bot.settings.Suggestion_Channel}`);
if(!sc) return message.channel.send(`:x: Error! Could not find the suggestion channel **${bot.settings.Suggestion_Channel}**`);
sc.send(SuggestionEmbed)
.then(async function(msg) {
msg.react(bot.settings.suggestyes).then(() => msg.react(bot.settings.suggestno));
});
2019-07-24 16:52:30 -06:00
const SuggestionSuccessEmbed = new Discord.RichEmbed()
.setDescription(`:white_check_mark: You have successfully created your suggestion. <#${sc.id}>`)
.setColor(bot.settings.colour)
message.channel.send(SuggestionSuccessEmbed);
2019-06-09 23:52:41 +01:00
console.log(`\x1b[36m`, `${message.author} has executed ${bot.settings.prefix}${bot.settings.Suggest_Command}`)
2019-07-24 16:52:30 -06:00
const CMDLog = new Discord.RichEmbed()
.setTitle(bot.settings.Commands_Log_Title)
.addField(`User`, `<@${message.author.id}>`)
.addField(`Command`, bot.settings.Suggest_Command, true)
.addField(`Channel`, message.channel, true)
.addField(`Executed At`, message.createdAt, true)
.setColor(bot.settings.colour)
.setFooter(bot.settings.footer)
let CommandLog = message.guild.channels.find(LogsChannel => LogsChannel.name === `${bot.settings.Command_Log_Channel}`);
if(!CommandLog) return message.channel.send(`:x: Error! Could not find the logs channel. **${bot.settings.Command_Log_Channel}**`);
CommandLog.send(CMDLog);
2019-06-09 23:52:41 +01:00
}
exports.help = {
name: bot.settings.Suggest_Command,
2019-06-19 14:27:24 -06:00
}