I build a 'sending select menu'

But if I test my bot and choise a option the bot dosent response. What is missing? Ty for ur help and sry My expirience in programming isn't like a professional. Have mercy😂🙌🏼
33 Replies
d.js toolkit
d.js toolkit12mo ago
- What's your exact discord.js npm list discord.js and node node -v version? - Not a discord.js issue? Check out #other-js-ts. - Consider reading #how-to-get-help to improve your question! - Explain what exactly your issue is. - Post the full error stack trace, not just the top part! - Show your code! - Issue solved? Press the button! - Marked as resolved by OP
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Nicolas Matheisen
Nicolas MatheisenOP12mo ago
No description
Nicolas Matheisen
Nicolas MatheisenOP12mo ago
sec start discord on my pc
const { StringSelectMenuBuilder, SlashCommandBuilder, StringSelectMenuOptionBuilder, ActionRowBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('server')
.setDescription('Provides information about the server.'),
async execute(interaction) {
const select = new StringSelectMenuBuilder()
.setCustomId('starter')
.setPlaceholder('Make a selection!')
.addOptions(
new StringSelectMenuOptionBuilder()
.setLabel('Bulbasaur')
.setDescription('The dual-type Grass/Poison Seed Pokémon.')
.setValue('bulbasaur'),
new StringSelectMenuOptionBuilder()
.setLabel('Charmander')
.setDescription('The Fire-type Lizard Pokémon.')
.setValue('charmander'),
new StringSelectMenuOptionBuilder()
.setLabel('Squirtle')
.setDescription('The Water-type Tiny Turtle Pokémon.')
.setValue('squirtle'),
);

const row = new ActionRowBuilder()
.addComponents(select);

await interaction.reply({
content: 'Choose your starter!',
components: [row],
});
},
};
const { StringSelectMenuBuilder, SlashCommandBuilder, StringSelectMenuOptionBuilder, ActionRowBuilder } = require('discord.js');

module.exports = {
data: new SlashCommandBuilder()
.setName('server')
.setDescription('Provides information about the server.'),
async execute(interaction) {
const select = new StringSelectMenuBuilder()
.setCustomId('starter')
.setPlaceholder('Make a selection!')
.addOptions(
new StringSelectMenuOptionBuilder()
.setLabel('Bulbasaur')
.setDescription('The dual-type Grass/Poison Seed Pokémon.')
.setValue('bulbasaur'),
new StringSelectMenuOptionBuilder()
.setLabel('Charmander')
.setDescription('The Fire-type Lizard Pokémon.')
.setValue('charmander'),
new StringSelectMenuOptionBuilder()
.setLabel('Squirtle')
.setDescription('The Water-type Tiny Turtle Pokémon.')
.setValue('squirtle'),
);

const row = new ActionRowBuilder()
.addComponents(select);

await interaction.reply({
content: 'Choose your starter!',
components: [row],
});
},
};
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs12mo ago
guide Message Components: Component interactions - The Client#interactionCreate event Third and finally, you may wish to have a listener setup to respond to permanent button or select menu features of your guild. For this, returning to the Client#event:interactionCreateopen in new window event is the best approach. read more
Nicolas Matheisen
Nicolas MatheisenOP12mo ago
Ok I must create a event ok... Sry it's my first time to programm a discord bot or crate something js but I fixed some code today
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Nicolas Matheisen
Nicolas MatheisenOP12mo ago
now i get the error unknown interaction
d.js docs
d.js docs12mo ago
Common causes of DiscordAPIError[10062]: Unknown interaction: - Initial response took more than 3 seconds ➞ defer the response *. - Wrong interaction object inside a collector. - Two processes handling the same command (the first consumes the interaction, so it won't be valid for the other instance) * Note: you cannot defer modal or autocomplete value responses
Nicolas Matheisen
Nicolas MatheisenOP12mo ago
else if (interaction.isStringSelectMenu()) {
console.log(`U choise ...`);
}
else if (interaction.isStringSelectMenu()) {
console.log(`U choise ...`);
}
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Nicolas Matheisen
Nicolas MatheisenOP12mo ago
if I click the first one
No description
Nicolas Matheisen
Nicolas MatheisenOP12mo ago
what interaction type is it? Do u have a tutorial about events? that I can edit it for my example
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Nicolas Matheisen
Nicolas MatheisenOP12mo ago
yes put I don't understand the how this can help me
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Nicolas Matheisen
Nicolas MatheisenOP12mo ago
there are 3 possibile errors and I must find the error?
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Nicolas Matheisen
Nicolas MatheisenOP12mo ago
this ?
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Nicolas Matheisen
Nicolas MatheisenOP12mo ago
yeah I copy paste it but it doesn't work then I get the error with the unknown interaction
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Nicolas Matheisen
Nicolas MatheisenOP12mo ago
The first point isn't
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Nicolas Matheisen
Nicolas MatheisenOP12mo ago
the error
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Nicolas Matheisen
Nicolas MatheisenOP12mo ago
😅 what can I do if I don't understand ur question😅 I can explain what I understand: u send me 3 ways how to solve my problem but I read it and I can't do anything with this cause I don't know the word initial
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
d.js docs
d.js docs12mo ago
guide Slash Commands: Command response methods - Deferred responses read more
Nicolas Matheisen
Nicolas MatheisenOP12mo ago
to translate stuff it isn't I understand this
Unknown User
Unknown User12mo ago
Message Not Public
Sign In & Join Server To View
Nicolas Matheisen
Nicolas MatheisenOP12mo ago
ahhhh now I can explain I don't know which part of my code I must edit normaly i try to edit this part and the sometimes it's work and sometimes not sry for wasting ur time i read many stuff and google and try to understand how I fix a error and it's too much know I go to bed ty 🙏🏼
Want results from more Discord servers?
Add your server