Files
SupportBot-Dashboard/commands/suggest.js
T

42 lines
1.6 KiB
JavaScript
Raw Normal View History

2019-06-09 23:52:41 +01:00
// SupportBot
2020-01-26 22:35:45 +00:00
// Created by © 2020 Emerald Services
// Command: Say
2019-06-09 23:52:41 +01:00
const Discord = require("discord.js");
2020-01-26 22:35:45 +00:00
const bot = new Discord.Client();
2019-06-09 23:52:41 +01:00
2020-01-26 22:35:45 +00:00
const fs = require("fs");
const yaml = require('js-yaml');
const supportbot = yaml.load(fs.readFileSync('./supportbot-config.yml', 'utf8'));
2019-06-09 23:52:41 +01:00
exports.run = async(bot, message, args) => {
2020-01-26 22:35:45 +00:00
console.log(`\u001b[33m`, `[${supportbot.Bot_Name}] > `, `\u001b[31;1m`, `${message.author.tag}`, `\u001b[32;1m`, `has executed`, `\u001b[31;1m`, `${supportbot.Prefix}${supportbot.Suggest_Command}`);
2019-06-09 23:52:41 +01:00
const SuggestionEmbed = new Discord.RichEmbed()
2020-01-26 22:35:45 +00:00
.setTitle(`${supportbot.Suggestion_Title}`)
2019-07-24 16:52:30 -06:00
.setDescription(`\`\`\`${args.join(" ")}\`\`\`\nFrom <@${message.author.id}>`)
2020-01-26 22:35:45 +00:00
.setFooter(`${supportbot.footer}`, message.author.avatarURL)
2019-06-19 14:27:24 -06:00
.setTimestamp(new Date())
2020-01-26 22:35:45 +00:00
.setColor(supportbot.EmbedColour)
2019-07-24 16:52:30 -06:00
2020-01-26 22:35:45 +00:00
let sc = message.guild.channels.find(SuggestionChannel => SuggestionChannel.name === `${supportbot.Suggestion_Channel}`);
if(!sc) return message.channel.send(`:x: Error! Could not find the suggestion channel **${supportbot.Suggestion_Channel}**`);
2019-06-09 23:52:41 +01:00
sc.send(SuggestionEmbed)
.then(async function(msg) {
2020-01-26 22:35:45 +00:00
msg.react(supportbot.suggestyes).then(() => msg.react(supportbot.suggestno));
2019-06-09 23:52:41 +01:00
});
2019-07-24 16:52:30 -06:00
const SuggestionSuccessEmbed = new Discord.RichEmbed()
2020-01-26 22:35:45 +00:00
.setDescription(`👍 Suggestion has been successfully created\nYou can view your suggestion in <#${sc.id}>`)
.setColor(supportbot.EmbedColour)
2019-07-24 16:52:30 -06:00
message.channel.send(SuggestionSuccessEmbed);
2020-01-26 22:35:45 +00:00
};
2019-06-09 23:52:41 +01:00
exports.help = {
2020-01-26 22:35:45 +00:00
name: supportbot.Suggest_Command,
2019-06-19 14:27:24 -06:00
}