Follow

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use
Contact

Discord menu selection interaction failed

I’m trying to create a menu with specific choices but when i try to select one of the choices it says the interaction failed. This is my first time ever using menus on discord and i tried to follow the docs but i cant seem to find what i did wrong.

                const mvpCollector = interaction.channel.createMessageComponentCollector({
                  componentType: 'SELECT_MENU',
                  time: 30000,
                });
                
                mvpCollector.on('collect', async (menuInteraction) => {
                  const mvp = menuInteraction.values[0];
                  
                  if (!team1.has(mvp) && !team2.has(mvp)) {
                    interaction.followUp({content: `${mvp} wasn't in the game!`});
                  } else {
                    mapBanendEmbed.addFields({name: 'MVP', value: `${mvp}`});
                
                    interaction.followUp({
                      embeds: [mapBanendEmbed],
                      components: []
                    });
                  }
                });
                
                mvpCollector.on('end', async (collected) => {
                  if (collected.size === 0) {
                    interaction.followUp({content: 'No MVP was selected.'});
                  }
                });

When a user is selected as the MVP from the select menu it’s suppose to edit an embed and set that user as the MVP in the field but it just gives me a interaction failed error.

MEDevel.com: Open-source for Healthcare and Education

Collecting and validating open-source software for healthcare, education, enterprise, development, medical imaging, medical records, and digital pathology.

Visit Medevel

>Solution :

Component types changed in v14. Use this when creating your collector:

const { ComponentType } = require('discord.js');

const mvpCollector = interaction.channel.createMessageComponentCollector({
  componentType: ComponentType.SelectMenu, // This line changed
  time: 30000,
}); 

Also, if you’re trying to edit the original message, I think you’ll want to use .update() instead of .followUp().

Add a comment

Leave a Reply

Keep Up to Date with the Most Important News

By pressing the Subscribe button, you confirm that you have read and are agreeing to our Privacy Policy and Terms of Use

Discover more from Dev solutions

Subscribe now to keep reading and get access to the full archive.

Continue reading