[Bug]: ButtonComponent without id was not produced
See original GitHub issueWhat happened?
@ButtonComponent()
mybtn(interaction: ButtonInteraction) {
console.log('processing')
if (interaction.customId === 'hello-btn') {
interaction.reply(`👋 ${interaction.member}`);
}
}
Was not produced
Reproduction
client.on("interactionCreate", (interaction: Interaction) => {
if (interaction.isButton()) {
console.log(interaction.customId)
}
client.executeInteraction(interaction);
});
^ there customId will be logged
@Discord()
class buttonExample {
@Slash("hello")
async hello(
@SlashOption("user", { required: true, type: "USER" }) user: Snowflake,
interaction: CommandInteraction
) {
await interaction.deferReply();
const helloBtn = new MessageButton()
.setLabel("Hello")
.setEmoji("👋")
.setStyle("PRIMARY")
.setCustomId("hello-btn");
const row = new MessageActionRow().addComponents(helloBtn);
interaction.editReply({
content: `${user}, Say hello to bot`,
components: [row],
});
}
@ButtonComponent()
mybtn(interaction: ButtonInteraction) {
console.log('processing')
if (interaction.customId === 'hello-btn') {
interaction.reply(`👋 ${interaction.member}`);
}
}
}
there console.log('processing')
will be never called.
Version
Stable
Relevant log output
No response
Code of Conduct
- I agree to follow this project’s Code of Conduct
Issue Analytics
- State:
- Created 2 years ago
- Comments:12 (12 by maintainers)
Top Results From Across the Web
How do I get the id of a button that was clicked? ReactJS
Another way to grab hold of the element and its attributes is to use React refs. This is more general when trying to...
Read more >Building a button component - web.dev
In this post I want to share my thoughts on how to build a color-adaptive, responsive, and accessible <button> element.
Read more >The Button element - HTML: HyperText Markup Language
The HTML element is an interactive element activated by a user with a mouse, keyboard, finger, voice command, or other assistive technology.
Read more >Buttons - Bootstrap
Use Bootstrap's custom button styles for actions in forms, dialogs, and more with support for multiple sizes, states, and more.
Read more >React Button component - Material UI - MUI
Buttons allow users to take actions, and make choices, with a single tap. ... and Icon Buttons are built on top of the...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
hah, i noticed thats because of
-
symbol in customid. Without it working like as i expect.the more you know i guess ♥