button interaction response problem

When responding to a button interaction, I am trying to disable the clicked button, but the following error keeps occurring. The label is already set during its creation.
3 Replies
d.js toolkit
d.js toolkit4d 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!
변상훈
변상훈OP4d ago
const components = interaction.message.components.map(row => {
return {
...row,
components: row.components.map(component => {
console.log(component);
if (component.customId === interaction.customId) {
if (component.customId === interaction.customId) {
return { ...component, disabled: true };
}
}
return component;
})
};
});
interaction.update({ components });
const components = interaction.message.components.map(row => {
return {
...row,
components: row.components.map(component => {
console.log(component);
if (component.customId === interaction.customId) {
if (component.customId === interaction.customId) {
return { ...component, disabled: true };
}
}
return component;
})
};
});
interaction.update({ components });
this is response code
discord-bot | /root/bot/node_modules/@discordjs/builders/dist/index.js:563
discord-bot | throw new RangeError("Non-premium buttons must have a label and/or an emoji.");
discord-bot | ^
discord-bot |
discord-bot | RangeError: Non-premium buttons must have a label and/or an emoji.
discord-bot | at validateRequiredButtonParameters (/root/bot/node_modules/@discordjs/builders/dist/index.js:563:13)
discord-bot | at ButtonBuilder.toJSON (/root/bot/node_modules/@discordjs/builders/dist/index.js:711:5)
discord-bot | at /root/bot/node_modules/@discordjs/builders/dist/index.js:1479:64
discord-bot | at Array.map (<anonymous>)
discord-bot | at ActionRowBuilder.toJSON (/root/bot/node_modules/@discordjs/builders/dist/index.js:1479:35)
discord-bot | at /root/bot/node_modules/discord.js/src/structures/MessagePayload.js:151:82
discord-bot | at Array.map (<anonymous>)
discord-bot | at MessagePayload.resolveBody (/root/bot/node_modules/discord.js/src/structures/MessagePayload.js:150:49)
discord-bot | at ButtonInteraction.update (/root/bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:235:56)
discord-bot | at responseCharacterSelect (/root/bot/Commands/utility/interactionResponse.js:230:15)
discord-bot |
discord-bot | Node.js v18.20.3
discord-bot | /root/bot/node_modules/@discordjs/builders/dist/index.js:563
discord-bot | throw new RangeError("Non-premium buttons must have a label and/or an emoji.");
discord-bot | ^
discord-bot |
discord-bot | RangeError: Non-premium buttons must have a label and/or an emoji.
discord-bot | at validateRequiredButtonParameters (/root/bot/node_modules/@discordjs/builders/dist/index.js:563:13)
discord-bot | at ButtonBuilder.toJSON (/root/bot/node_modules/@discordjs/builders/dist/index.js:711:5)
discord-bot | at /root/bot/node_modules/@discordjs/builders/dist/index.js:1479:64
discord-bot | at Array.map (<anonymous>)
discord-bot | at ActionRowBuilder.toJSON (/root/bot/node_modules/@discordjs/builders/dist/index.js:1479:35)
discord-bot | at /root/bot/node_modules/discord.js/src/structures/MessagePayload.js:151:82
discord-bot | at Array.map (<anonymous>)
discord-bot | at MessagePayload.resolveBody (/root/bot/node_modules/discord.js/src/structures/MessagePayload.js:150:49)
discord-bot | at ButtonInteraction.update (/root/bot/node_modules/discord.js/src/structures/interfaces/InteractionResponses.js:235:56)
discord-bot | at responseCharacterSelect (/root/bot/Commands/utility/interactionResponse.js:230:15)
discord-bot |
discord-bot | Node.js v18.20.3
Unknown User
Unknown User4d ago
Message Not Public
Sign In & Join Server To View

Did you find this page helpful?