emirate
DIAdiscord.js - Imagine an app
•Created by emirate on 6/30/2023 in #djs-questions
More Builders in Modals
Hey guys,
when do you think
StringSelectMenuBuilder
and ButtonBuilder
will be usable in Modals?
I don't know if it is worth waiting for them or using a different approach in my case.9 replies
DIAdiscord.js - Imagine an app
•Created by emirate on 7/22/2022 in #djs-questions
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({})
}
})
}
2 replies