DiscordAPIError Interaction has already been aknowledged
Hello,
I get the error code from the title and this is the code:
} else if (interaction.isSelectMenu()) {
switch (await interaction.values[0]) {
case 'knight':
await interaction.deferUpdate();
amsg = await interaction.editReply({ embeds: [BuildCharacterKnightEmbed], components: [BuildCharacterClassRow], ephemeral: true })
break;
case 'magician':
await interaction.deferUpdate();
amsg = await interaction.editReply({ embeds: [BuildCharacterMagicianEmbed], components: [BuildCharacterClassRow], ephemeral: true })
break;
}
const filter = i => i.customId === 'build_back' || i.customId === 'build_continue' || i.customId === 'success_continue';
const collector = amsg.createMessageComponentCollector({ filter });
collector.on('collect', async (i) => {
switch (await i.customId) {
case 'build_back':
await i.deferUpdate();
await i.editReply({ embeds: [BuildCharacterEmbed], components: [BuildCharacterRow], ephemeral: true });
break;
case 'build_continue':
await i.deferUpdate();
await i.editReply({ embeds: [BuildCharacterSuccessEmbed], components: [BuildCharacterSuccessRow], ephemeral: true });
database.customQuery(`INSERT INTO roles (user_id, role) VALUES ('${interaction.user.id}', '${interaction.values[0]}')`);
break;
case 'success_continue':
//await i.deferUpdate();
//await interaction.editReply({})
}
})
}
} else if (interaction.isSelectMenu()) {
switch (await interaction.values[0]) {
case 'knight':
await interaction.deferUpdate();
amsg = await interaction.editReply({ embeds: [BuildCharacterKnightEmbed], components: [BuildCharacterClassRow], ephemeral: true })
break;
case 'magician':
await interaction.deferUpdate();
amsg = await interaction.editReply({ embeds: [BuildCharacterMagicianEmbed], components: [BuildCharacterClassRow], ephemeral: true })
break;
}
const filter = i => i.customId === 'build_back' || i.customId === 'build_continue' || i.customId === 'success_continue';
const collector = amsg.createMessageComponentCollector({ filter });
collector.on('collect', async (i) => {
switch (await i.customId) {
case 'build_back':
await i.deferUpdate();
await i.editReply({ embeds: [BuildCharacterEmbed], components: [BuildCharacterRow], ephemeral: true });
break;
case 'build_continue':
await i.deferUpdate();
await i.editReply({ embeds: [BuildCharacterSuccessEmbed], components: [BuildCharacterSuccessRow], ephemeral: true });
database.customQuery(`INSERT INTO roles (user_id, role) VALUES ('${interaction.user.id}', '${interaction.values[0]}')`);
break;
case 'success_continue':
//await i.deferUpdate();
//await interaction.editReply({})
}
})
}
1 Reply
Thought I was missing an
await
but i don't know where :-)