#SelectMenu help

1 messages · Page 1 of 1 (latest)

forest depot
#

I am trying to make a menu that works without sending additional messages, only editing current menu depending on output from the user.

I've started with interaction.followUp, and edited the menu once with interaction.update which is working fine.

I am not sure how to grab user's input (what they've picked from the menu) after editing it so I can proceed.

Any ideas?

mild niche
#

Just keep a collector open and identify submenu's by customId.

forest depot
mild niche
#

That's probably because the application is not responding to the interaction

#

Send code

forest depot
#
const { Client, Message, MessageEmbed, Interaction } = require("discord.js");
const { MessageActionRow, MessageSelectMenu } = require("discord.js");

module.exports = {
    name: "select",
    description: "Register dungeon/raid event",
    /**
     * @param {Client}
     * @param {Message}
     * @param {String[]}
     */
    run: async(client, interaction, message, args) => {
        const row = new MessageActionRow().addComponents(
            new MessageSelectMenu()
                .setCustomId("1")
                .setPlaceholder("What are we creating today?")
                .addOptions([
                    {
                        label: "Raids",
                        value: "raids",
                        description: "Select from Raids",
                        emoji: "🌌"
                    },
                    {
                        label: "Dungeons",
                        value: "dungeons",
                        description: "Select from the dungeonss",
                        emoji: "🐲"
                    }
                ])
        )
        await interaction.followUp({ components: [row] });
    }
}
mild niche
#

Can you shorten the message.txt, I'm on phone

forest depot
#

Sure, sec

#
if(interaction.isSelectMenu) {
        const decision = `${interaction.values}`;
        if(decision != "undefined") {
            if(decision == "raids") {
                //Array database
                const raidMenu = new MessageActionRow().addComponents(
                new MessageSelectMenu()
                    .setCustomId("raidMenu")
                    .setPlaceholder("Please select the raid")
                    .addOptions([
                        {
                            label: "Midnight Skypetal Plains",
                            value: "MSP",
                            description: "Midnight Skypetal Plains raid",
                        },
                        {
                            label: "Skybreak Spire",
                            value: "BT",
                            description: "Skybreak Spire A.K.A Black Tower (BT) raid",
                        },
                        {
                            label: "Scion's Keep",
                            value: "SK",
                            description: "Scion's Keep raid",
                        },
                        {
                            label: "Temple of Eluvium",
                            value: "VT",
                            description: "Temple of Eluvium A.K.A Vortex Temple (VT) raid",
                        },
                        {
                            label: "Nightfall Sanctuary",
                            value: "TT",
                            description: "Nightfall Sanctuary A.K.A Twilight Temple (TT) raid",
                        },
                        {
                            label: "Eternity Temple",
                            value: "ET",
                            description: "Eternity Temple raid",
                        },
                        {
                            label: "Bloodmoon",
                            value: "BM",
                            description: "Bloodmoon raid",
                        }
                    ])
                )
                await interaction.update({ components: [raidMenu] });
                const filter = (interaction) =>
                interaction.isSelectMenu();

                const collector = interaction.channel.createMessageComponentCollector({ 
                    filter,
                    max: 1
                });

                collector.on("collect", async (collected) => {
                    const value = collected.values;
                    console.log(value);
                });
            }
        }
    }
}
mild niche
#

In the command file I suggest making the collectorm

forest depot
#

I did try that, it collects the value of "dungeon" or "raids" whereas collecting it here collects the raid I pick or dungeon I pick

#

But if that'll do, I'll go for that?

mild niche
#

So the way I set it up, the customIds are separated in sections using ':' and later split up and I basically handle the entire thing in one file.

forest depot
#

I am not sure how to do that

#

I am very new to DJS v13, started few hours ago actually

#

The entire, menu thing is awesome but new to me
So placing collector in the command file instead of interactionCreate event is better?

#

Also can I keep adding submenus with interaction.update?

#

I found a solution to the error it's giving, thank you sir!
But my only question now is >Also can I keep adding submenus with interaction.update?

mild niche
#

Yea