Creating multiple selects command

Hi, i'm currently trying to create a command which utilizes select function, i want to collect 2-3 values one after another but when i try to send new select using .editReply it keeps loading and throws interaction failed, video attached, code below
async execute(interaction) {
const ChannelSelect = new ActionRowBuilder()
.addComponents(
new ChannelSelectMenuBuilder()
.setCustomId('verifychannel')
.setPlaceholder('Select channel')
);

const RoleSelect = new ActionRowBuilder()
.addComponents(
new RoleSelectMenuBuilder()
.setCustomId('verifiedrole')
.setPlaceholder('Select role')
);

await interaction.reply({
content: 'Plase select verify channel!',
components: [ChannelSelect],
ephemeral: true
});

const ChannelCollector = interaction.channel.createMessageComponentCollector({
componentType: ComponentType.ChannelSelect,
time: 15000
});

ChannelCollector.on('collect', async (i) => {
if (i.user.id === interaction.user.id) {
if (i.customId === 'verifychannel') {
channel = i.channels.first();
await interaction.editReply({
content: 'Plase specified verified role!',
components: [RoleSelect]
});
}
} else {
i.reply({
content: `This select menu isn't for you!`,
ephemeral: true
});
}
});

const RoleCollector = interaction.channel.createMessageComponentCollector({
componentType: ComponentType.RoleSelect,
time: 15000
});

RoleCollector.on('collect', async (i) => {
if (i.user.id === interaction.user.id) {
if (i.customId === 'verifiedrole') {
if (channel) {
await interaction.editReply({
content: `Data collected, creating verify button in #${channel.name}!`,
components: []
});
} else {
await interaction.editReply({
content: `Channel wasn't specified, exiting creator.`,
components: []
});
}
}
} else {
i.reply({
content: `This select menu isn't for you!`,
ephemeral: true
});
}
});
async execute(interaction) {
const ChannelSelect = new ActionRowBuilder()
.addComponents(
new ChannelSelectMenuBuilder()
.setCustomId('verifychannel')
.setPlaceholder('Select channel')
);

const RoleSelect = new ActionRowBuilder()
.addComponents(
new RoleSelectMenuBuilder()
.setCustomId('verifiedrole')
.setPlaceholder('Select role')
);

await interaction.reply({
content: 'Plase select verify channel!',
components: [ChannelSelect],
ephemeral: true
});

const ChannelCollector = interaction.channel.createMessageComponentCollector({
componentType: ComponentType.ChannelSelect,
time: 15000
});

ChannelCollector.on('collect', async (i) => {
if (i.user.id === interaction.user.id) {
if (i.customId === 'verifychannel') {
channel = i.channels.first();
await interaction.editReply({
content: 'Plase specified verified role!',
components: [RoleSelect]
});
}
} else {
i.reply({
content: `This select menu isn't for you!`,
ephemeral: true
});
}
});

const RoleCollector = interaction.channel.createMessageComponentCollector({
componentType: ComponentType.RoleSelect,
time: 15000
});

RoleCollector.on('collect', async (i) => {
if (i.user.id === interaction.user.id) {
if (i.customId === 'verifiedrole') {
if (channel) {
await interaction.editReply({
content: `Data collected, creating verify button in #${channel.name}!`,
components: []
});
} else {
await interaction.editReply({
content: `Channel wasn't specified, exiting creator.`,
components: []
});
}
}
} else {
i.reply({
content: `This select menu isn't for you!`,
ephemeral: true
});
}
});
7 Replies
d.js toolkit
d.js toolkit11mo 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! - Marked as resolved by OP
szalik.dev
szalik.devOP11mo ago
No description
d.js docs
d.js docs11mo ago
method MessageComponentInteraction#update() Updates the original message of the component on which the interaction was received on.
d4
d411mo ago
you should use update() instead of editReply() as only update() counts as a reply to an interaction
szalik.dev
szalik.devOP11mo ago
interaction.update()?
d4
d411mo ago
yes actually hold on i'm pretty sure it's i.update()
szalik.dev
szalik.devOP11mo ago
that makes so much more sense thank you d4!
Want results from more Discord servers?
Add your server