Files
SupportBot/commands/suggest.js
T

49 lines
2.0 KiB
JavaScript
Raw Normal View History

2020-04-16 16:43:16 +01:00
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
2020-04-06 18:15:17 -04:00
const SuggestionEmbed = new Discord.MessageEmbed()
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-04-18 22:49:03 +01:00
.setThumbnail(message.author.avatarURL)
.setFooter(`${supportbot.EmbedFooter}`)
2019-06-19 14:27:24 -06:00
.setTimestamp(new Date())
2020-01-26 22:35:45 +00:00
.setColor(supportbot.EmbedColour)
2020-04-16 16:43:16 +01:00
let locateChannel = message.guild.channels.cache.find(LocateChannel => LocateChannel.name === `${supportbot.Suggestion_Channel}`)
const errornochannel = new Discord.MessageEmbed()
.setTitle("SupportBot Error!")
.setDescription(`:x: **Error!** Channel not Found, This command cannot be executed proberbly as their is no channel within this server.\nThis is configurable via **supportbot-config.yml**\n\nChannel Required: \`${supportbot.Suggestion_Channel}\`\n\nError Code: \`SB-03\``)
.setColor(supportbot.ErrorColour);
if(!locateChannel) return message.channel.send(errornochannel);
locateChannel.send(SuggestionEmbed)
2019-06-09 23:52:41 +01:00
.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
});
2020-04-06 18:15:17 -04:00
const SuggestionSuccessEmbed = new Discord.MessageEmbed()
2020-04-16 16:43:16 +01:00
.setDescription(`👍 Suggestion has been successfully created\nYou can view your suggestion in <#${locateChannel.id}>`)
2020-01-26 22:35:45 +00:00
.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
}