Files
SupportBot/Commands/suggest.js
T

60 lines
1.8 KiB
JavaScript
Raw Normal View History

2021-10-25 23:18:28 +01:00
// SupportBot | Emerald Services
// Ping Command
const fs = require("fs");
const Discord = require("discord.js");
const yaml = require("js-yaml");
2021-10-27 19:30:10 -05:00
const supportbot = yaml.load(
fs.readFileSync("./Configs/supportbot.yml", "utf8")
);
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
2021-10-25 23:18:28 +01:00
const Command = require("../Structures/Command.js");
module.exports = new Command({
name: cmdconfig.SuggestCommand,
description: cmdconfig.SuggestCommandDesc,
slashCommandOptions: [
{
2021-10-27 19:20:10 -05:00
name: "suggestion",
description: "Create a Suggestion",
type: "STRING",
},
2021-10-25 23:18:28 +01:00
],
permission: "SEND_MESSAGES",
async run(interaction) {
2021-10-27 19:20:10 -05:00
const suggestChannel = client.channels.cache.get(
supportbot.SuggestionChannel
);
2021-10-25 23:18:28 +01:00
const NoChannel = new Discord.MessageEmbed()
.setTitle("Missing Channel!")
.setDescription(`${supportbot.InvalidChannel}`)
.setColor(supportbot.WarningColour);
if (!suggestChannel) return interaction.reply({ embeds: [NoChannel] });
2021-10-27 19:20:10 -05:00
let suggestion = interaction.options.getString("suggestion");
2021-10-25 23:18:28 +01:00
const SuggestEmbed = new Discord.MessageEmbed()
2021-10-27 19:20:10 -05:00
.addField("Suggestion", suggestion, true)
.addField("From", `<@${interaction.user.id}>`)
.setThumbnail(interaction.user.displayAvatarURL())
.setFooter(supportbot.EmbedFooter, interaction.user.displayAvatarURL())
.setColor(supportbot.EmbedColour);
2021-10-25 23:18:28 +01:00
2021-10-27 19:20:10 -05:00
suggestChannel.reply({ embeds: [SuggestEmbed] });
2021-10-25 23:18:28 +01:00
const Submitted = new Discord.MessageEmbed()
.setTitle("Suggestion Submitted!")
2021-10-27 19:20:10 -05:00
.setDescription(
`:white_check_mark: You have successfully submitted a suggestion.`
)
2021-10-25 23:18:28 +01:00
.addField("Sent to:", `<#${suggestChannel.id}>`)
.setColor(supportbot.WarningColour);
2021-10-27 19:20:10 -05:00
return interaction.reply({ embeds: [Submitted] });
2021-10-25 23:18:28 +01:00
},
});