Trying to make a help menu using button builder

Im trying to create a menu for my help menu that changes it's buttons based on what page it's on and change the embed accordingly. I got the basic idea of it working with the embed and buttons changing however discord then throws an error "Interaction Failed". I also don't know how to approach making the command listen for buttons after the first one is clicked. Any help much appreciated!
8 Replies
d.js toolkit
d.js toolkit9mo 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
Sup3r
Sup3rOP9mo ago
Sup3r
Sup3rOP9mo ago
Sup3r
Sup3rOP9mo ago
Theres also an issue when trying to use /help again where an error is thrown If you guys know of any examples of this concept, that might just be the best way to help! So how would i fix that? interaction.Update?
d.js docs
d.js docs9mo ago
:method: ButtonInteraction#update() Updates the original message of the component on which the interaction was received on.
Sup3r
Sup3rOP9mo ago
thx Tried this
switch (confirmation.customId) {
case 'profile':
btnManager('profile')
await interaction.update({
embeds: [profileEmbed],
components: [oRow]
});
break;
case 'settings':
btnManager('settings');
await interaction.update({
content: 'Settings command selected',
components: [oRow]
});
break;
case 'questions':
await interaction.update({
content: 'Questions command selected',
components: [oRow]
});
break;
case 'manage':
await interaction.update({
content: 'Manage command selected',
components: [oRow]
});
break;
default:
await interaction.update({
content: 'Invalid selection',
components: []
});
break;
}
switch (confirmation.customId) {
case 'profile':
btnManager('profile')
await interaction.update({
embeds: [profileEmbed],
components: [oRow]
});
break;
case 'settings':
btnManager('settings');
await interaction.update({
content: 'Settings command selected',
components: [oRow]
});
break;
case 'questions':
await interaction.update({
content: 'Questions command selected',
components: [oRow]
});
break;
case 'manage':
await interaction.update({
content: 'Manage command selected',
components: [oRow]
});
break;
default:
await interaction.update({
content: 'Invalid selection',
components: []
});
break;
}
alr Thx that worked with the first issue, how would i attach listeners after clicking the first button? No
Sup3r
Sup3rOP9mo ago
Sup3r
Sup3rOP9mo ago
kk When using that, its returning this error, TypeError: confirmation.update is not a function at Object.execute (C:\Users\forst\Coding\VS Code Workspace\Projects\Server Rift\Main App\Bot\commands\Utils\help.js:57:40) at process.processTicksAndRejections (node:internal/process/task_queues:95:5) at async Object.execute (C:\Users\forst\Coding\VS Code Workspace\Projects\Server Rift\Main App\Bot\Events\interatctionCreate.js:46:7)
try {
const confirmation = await response.createMessageComponentCollector({
filter: collectorFilter
});

switch (confirmation.customId) {
case 'profile':
btnManager('profile')
await confirmation.update({
embeds: [profileEmbed],
components: [oRow]
});
break;
case 'settings':
btnManager('settings');
await confirmation.update({
content: 'Settings command selected',
components: [oRow]
});
break;
case 'questions':
await confirmation.update({
content: 'Questions command selected',
components: [oRow]
});
break;
case 'manage':
await confirmation.update({
content: 'Manage command selected',
components: [oRow]
});
break;
default:
await confirmation.update({
content: 'Invalid selection',
components: []
});
break;
}

} catch (e) {
await interaction.editReply({
content: 'Response not received within 1 minute, buttons removed.',
components: []
});
console.error(e);
}
try {
const confirmation = await response.createMessageComponentCollector({
filter: collectorFilter
});

switch (confirmation.customId) {
case 'profile':
btnManager('profile')
await confirmation.update({
embeds: [profileEmbed],
components: [oRow]
});
break;
case 'settings':
btnManager('settings');
await confirmation.update({
content: 'Settings command selected',
components: [oRow]
});
break;
case 'questions':
await confirmation.update({
content: 'Questions command selected',
components: [oRow]
});
break;
case 'manage':
await confirmation.update({
content: 'Manage command selected',
components: [oRow]
});
break;
default:
await confirmation.update({
content: 'Invalid selection',
components: []
});
break;
}

} catch (e) {
await interaction.editReply({
content: 'Response not received within 1 minute, buttons removed.',
components: []
});
console.error(e);
}
do i need to remove the filter? Got it working
Want results from more Discord servers?
Add your server