selectmenu dont working

Hi, I'm making a ticket system in discord.js v14, but when selecting in selectmenu, it shows that this action failed and there are no errors in the console (vsc), does anyone know the reason?
6 Replies
d.js toolkit
d.js toolkit4d 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!
Unknown User
Unknown User4d ago
Message Not Public
Sign In & Join Server To View
kermiot $
kermiot $OP4d ago
see the code ticket.js how and index.js I added interactions and still nothing ticket.js
kermiot $
kermiot $OP4d ago
and index.js const { Client, GatewayIntentBits, Collection } = require('discord.js'); const fs = require('fs'); const config = require('./config.json'); const { REST, Routes } = require('discord.js'); // Stwórz instancję klienta const client = new Client({ intents: [GatewayIntentBits.Guilds, GatewayIntentBits.GuildMessages, GatewayIntentBits.MessageContent] }); client.commands = new Collection(); // Załaduj komendy z folderu 'commands' const commandFiles = fs.readdirSync('./commands').filter(file => file.endsWith('.js')); for (const file of commandFiles) { const command = require(./commands/${file}); if (command.data && command.data.name) { client.commands.set(command.data.name, command); } else { console.error(Komenda w pliku ${file} nie zawiera 'data.name'); } } // Rejestracja komend const registerCommands = async () => { const commands = client.commands.map(command => command.data.toJSON()); const rest = new REST({ version: '10' }).setToken(config.token); try { console.log('Rejestruję komendy...'); await rest.put( Routes.applicationGuildCommands(config.clientId, config.guildId), { body: commands } ); console.log('Komendy zostały zarejestrowane.'); } catch (error) { console.error('Błąd rejestracji komend:', error); } }; // Event: Bot gotowy client.once('ready', () => { console.log(Zalogowano jako ${client.user.tag}); registerCommands(); }); // Event: Obsługa interakcji client.on('interactionCreate', async interaction => { const command = client.commands.get(interaction.commandName); try { if (interaction.isCommand() && command) { await command.execute(interaction); } else if (!interaction.isCommand() && command?.onInteraction) { await command.onInteraction(interaction); } } catch (error) { console.error(error); if (interaction.replied || interaction.deferred) { await interaction.followUp({ content: 'Wystąpił błąd podczas przetwarzania interakcji!', ephemeral: true }); } else { await interaction.reply({ content: 'Wystąpił błąd podczas przetwarzania interakcji!', ephemeral: true }); } } }); // Logowanie bota client.login(config.token); help plz
monbrey
monbrey4d ago
else if (!interaction.isCommand() && command?.onInteraction)
This will never work command will always be undefined on a non-command interaction
Steve
Steve3d ago
You should probably start handling stringselectmenus
Want results from more Discord servers?
Add your server