Fix suggestions
This commit is contained in:
1 parent
02de920cb3
commit
31f6b9e08e
3 files changed
+16
-51
No files matched your search
+14
-6
@@ -25,14 +25,18 @@ module.exports = new Command({
|
||||
permission: "SEND_MESSAGES",
|
||||
|
||||
async run(interaction) {
|
||||
const suggestChannel = client.channels.cache.get(
|
||||
supportbot.SuggestionChannel
|
||||
);
|
||||
const suggestChannel =
|
||||
interaction.guild.channels.cache.find(
|
||||
(channel) => channel.name === supportbot.SuggestionChannel
|
||||
) ||
|
||||
interaction.guild.channels.cache.find(
|
||||
(channel) => channel.id === supportbot.SuggestionChannel
|
||||
);
|
||||
|
||||
const NoChannel = new Discord.MessageEmbed()
|
||||
.setTitle("Missing Channel!")
|
||||
.setDescription(`${supportbot.InvalidChannel}`)
|
||||
.setColor(supportbot.WarningColour);
|
||||
.setColor(supportbot.ErrorColour);
|
||||
|
||||
if (!suggestChannel) return interaction.reply({ embeds: [NoChannel] });
|
||||
|
||||
@@ -45,7 +49,11 @@ module.exports = new Command({
|
||||
.setFooter(supportbot.EmbedFooter, interaction.user.displayAvatarURL())
|
||||
.setColor(supportbot.EmbedColour);
|
||||
|
||||
suggestChannel.reply({ embeds: [SuggestEmbed] });
|
||||
const suggestionMsg = await suggestChannel.send({ embeds: [SuggestEmbed] });
|
||||
if (supportbot.SuggestionUpvote && supportbot.SuggestionDownvote) {
|
||||
suggestionMsg.react(supportbot.SuggestionUpvote);
|
||||
suggestionMsg.react(supportbot.SuggestionDownvote);
|
||||
}
|
||||
|
||||
const Submitted = new Discord.MessageEmbed()
|
||||
.setTitle("Suggestion Submitted!")
|
||||
@@ -53,7 +61,7 @@ module.exports = new Command({
|
||||
`:white_check_mark: You have successfully submitted a suggestion.`
|
||||
)
|
||||
.addField("Sent to:", `<#${suggestChannel.id}>`)
|
||||
.setColor(supportbot.WarningColour);
|
||||
.setColor(supportbot.SuccessColour);
|
||||
|
||||
return interaction.reply({ embeds: [Submitted] });
|
||||
},
|
||||
|
||||
@@ -78,6 +78,8 @@ TicketBlackListRole: "Blacklisted"
|
||||
# ----------------------------
|
||||
|
||||
SuggestionChannel: "suggestions"
|
||||
SuggestionUpvote: "✅"
|
||||
SuggestionDownvote: "❌"
|
||||
|
||||
# -------------------------
|
||||
# Tickets Configuration
|
||||
|
||||
@@ -1,45 +0,0 @@
|
||||
// SupportBot | Emerald Services
|
||||
// Ready Event
|
||||
|
||||
const fs = require("fs");
|
||||
|
||||
const Discord = require("discord.js");
|
||||
const yaml = require("js-yaml");
|
||||
const supportbot = yaml.load(
|
||||
fs.readFileSync("./Configs/supportbot.yml", "utf8")
|
||||
);
|
||||
const cmdconfig = yaml.load(fs.readFileSync("./Configs/commands.yml", "utf8"));
|
||||
const panelconfig = yaml.load(
|
||||
fs.readFileSync("./Configs/ticket-panel.yml", "utf8")
|
||||
);
|
||||
|
||||
const Event = require("../Structures/Event.js");
|
||||
|
||||
module.exports = new Event("messageReactionAdd", async (client) => {
|
||||
let message = {
|
||||
guild: reaction.message.channel.guild,
|
||||
author: user,
|
||||
content: "N/A",
|
||||
channel: reaction.message.channel,
|
||||
};
|
||||
|
||||
if (panelconfig.TicketPanel) {
|
||||
if (reaction.message.id === panelconfig.TicketPanelID) {
|
||||
if (
|
||||
reaction.emoji.name == panelconfig.ButtonEmoji ||
|
||||
reaction.emoji.id == panelconfig.ButtonEmoji
|
||||
) {
|
||||
await reaction.users.remove(user.id);
|
||||
|
||||
try {
|
||||
const cmd = client.commands.get(cmdconfig.OpenTicket);
|
||||
if (!cmd) return;
|
||||
|
||||
cmd.run(message, message.content);
|
||||
} catch (error) {
|
||||
console.error(error);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
});
|
||||
Reference in new issue
Block a user