Hi i am trying to do a suggestion command with djs 14. And so far i have made like the format of a command and stuff. But i keep getting this error is there any way you could help?
const { EmbedBuilder, Client, ActionRowBuilder, ButtonBuilder, ButtonStyle, ChatInputCommandInteraction, ApplicationCommandOptionType } = require("discord.js");
const SuggestDB = require("../../Structures/Schemas/SuggestDB");
module.exports = {
name: "suggest",
description: "Suggest something",
type: 3,
options: [
{
name: "type",
description: "Whats the type of your suggestion.",
required: true,
type: 3
}
],
name: "actions",
description: "Suggest something",
type: 3,
options: [
{
name: "suggest",
description: "Whats the type of your suggestion.",
required: true,
choices: [
{ name: "Command", value: "command" },
{ name: "Event", value: "event" },
{ name: "System", value: "System" },
{ name: "Other", value: "other" }
]
},
{
name: "suggestion",
description: "Name your suggestion.",
required: true,
type: 3,
},
{
name: "description",
description: "Describe your suggestion.",
required: true,
type: 3,
},
],
async execute(interaction, client) {
const { guild, options, member } = interaction
client.on(Events.InteractionCreate, async interaction => {
if (!interaction.isChatInputCommand()) return;
if (interaction.commandName === 'button') {
const suggestion = options.getString("suggestion")
const Description = options.getString("description")
const Type = options.getString("type")
const embed = new EmbedBuilder()
.setColor("Navy")
.setAuthor({ name: `${interaction.user.tag}`, iconURL: `${interaction.user.displayAvatarURL({ dynamic: true })}` })
.addFields(
{ name: "🟠 | New Suggestion", value: `${Suggestion} ` + `:\n \`${description}\``, inline: false },
{ name: "Type", value: `${type}`, inline: true },
{ name: "Status", value: "Pending", inline: true }
)
.setThumbnail(interaction.user.displayAvatarURL({ dynamic: true }))
.setTimestamp();
const row = new ActionRowBuilder()
.addComponents(
new ButtonBuilder()
.setCustomId('suggest-accept')
.setLabel('accept')
.setStyle(ButtonStyle.Success),
);
await interaction.reply({ content: 'I think you should,', components: [row] });
}
});
try {
const msg = await client.channels.cache
.get("990914879563124758")
.send({ embeds: [embed], components: [row] });
await SuggestDB.create({
Guild: guild.id,
Message: msg.id,
Details: [
{
MemberID: interaction.user.id,
Type: ApplicationCommandOptionType.String,
Suggestion: Suggestion,
},
],
});
} catch (error) {
console.log(error);
}
}
}