const { support_topics } = require("../config"); const { SlashCommandBuilder, EmbedBuilder } = require("discord.js"); module.exports = { data: new SlashCommandBuilder() .setName('support') .setDescription("Get support topics") .addStringOption(option => option .setRequired(true) .setName("parameter") .addChoices( ...support_topics.map(topic => ({ name: topic.name, value: topic.value })) ) .setDescription("Issue to prompt") ), async run(interaction) { let { options } = interaction; let selectedTopic = options.getString('parameter'); let matchedTopic = support_topics.filter(topic => selectedTopic === topic.value); if (matchedTopic.length === 0) { return; } const footerText = { text: "Coded by @onurcansevinc" }; let supportEmbed = new EmbedBuilder() .setTitle(matchedTopic[0].name) .setColor("Random") .setFooter(footerText) .setDescription(matchedTopic[0].response); if (matchedTopic[0].image) { supportEmbed.setImage(matchedTopic[0].image); } if (matchedTopic[0].thumbnail) { supportEmbed.setThumbnail(matchedTopic[0].thumbnail); } const replyOptions = { embeds: [supportEmbed] }; return interaction.reply(replyOptions); } };