menu's

I'm so confused, I have it so that if I send a command and the bot replies with a menu, and an user selects option 1 for example, I have interaction.editReply() so the bot edits his own message to the chosen option, but for me the bot just does a followUp()
4 Replies
Unknown User
Unknown User16mo ago
Message Not Public
Sign In & Join Server To View
Dannyxz
Dannyxz16mo ago
const {
SlashCommandBuilder,
EmbedBuilder,
ActionRowBuilder,
StringSelectMenuBuilder,
} = require("discord.js");

module.exports = {
data: new SlashCommandBuilder()
.setName(`selectmenu`)
.setDescription(`This is a select menu`),
async execute(interaction) {
const menu = new ActionRowBuilder().addComponents(
new StringSelectMenuBuilder()
.setCustomId("select")
.setMaxValues(1) // Updated to allow only one option to be selected
.setPlaceholder("Nothing Selected")
.addOptions(
{
label: "1st option",
description: "This is the first description",
value: "option 1",
},
{
label: "2st option",
description: "This is the second description",
value: "option 2",
}
)
);
await interaction.deferReply();
const message = await interaction.editReply({
content: "This is a select menu!",
components: [menu],
});

return message;
},
};
const {
SlashCommandBuilder,
EmbedBuilder,
ActionRowBuilder,
StringSelectMenuBuilder,
} = require("discord.js");

module.exports = {
data: new SlashCommandBuilder()
.setName(`selectmenu`)
.setDescription(`This is a select menu`),
async execute(interaction) {
const menu = new ActionRowBuilder().addComponents(
new StringSelectMenuBuilder()
.setCustomId("select")
.setMaxValues(1) // Updated to allow only one option to be selected
.setPlaceholder("Nothing Selected")
.addOptions(
{
label: "1st option",
description: "This is the first description",
value: "option 1",
},
{
label: "2st option",
description: "This is the second description",
value: "option 2",
}
)
);
await interaction.deferReply();
const message = await interaction.editReply({
content: "This is a select menu!",
components: [menu],
});

return message;
},
};
client.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isStringSelectMenu()) return;

if (interaction.customId === "select") {
let choices = "";

await interaction.deferReply();

await interaction.values.forEach(async (value) => {
choices += `${value}`;
});

await interaction.editReply({ content: `${choices}` });
}
});
client.on(Events.InteractionCreate, async (interaction) => {
if (!interaction.isStringSelectMenu()) return;

if (interaction.customId === "select") {
let choices = "";

await interaction.deferReply();

await interaction.values.forEach(async (value) => {
choices += `${value}`;
});

await interaction.editReply({ content: `${choices}` });
}
});
Unknown User
Unknown User16mo ago
Message Not Public
Sign In & Join Server To View
Dannyxz
Dannyxz16mo ago
did interaction.update and removed the deferReply() works now thanks