Button clicked

Receive the event

Once a user clicked on the button, we want to response too but with a dropdown menu this time

client.on("buttonClicked", btn => {
    console.log(btn)

    // Response to the button with a dropdown menu
    btn.reply({
        content: "Last component :)", // the message content
        components: [
            new utils.Dropdown({
                placeholder: "Placeholder", // custom placeholder text if nothing is selected, max 100 characters
                min: 0, // the minimum number of items that must be chosen; default 1, min 0, max 25
                max: 3, // the maximum number of items that can be chosen; default 1, max 25
                options: [
                    new utils.DropdownOption({
                        label: "Label 1", // the user-facing name of the option, max 25 characters
                        value: "Value 1", // the dev-define value of the option, max 100 characters
                        description: "Description" // an additional description of the option, max 50 characters
                    }),
                    new utils.DropdownOption({
                        label: "Label 2",
                        value: "Value 2",
                        description: "Description",
                        default: true
                    }),
                    new utils.DropdownOption({
                        label: "Label 3",
                        value: "Value 3",
                        description: "Description"
                    })
                ],
                ID: "lel" // a developer-defined identifier for the button, max 100 characters
            })
        ]
    })
})

Last updated