Skip to content
This repository has been archived by the owner on Aug 22, 2024. It is now read-only.

Support ButtonInteraction #57

Closed
Tenebrosful opened this issue Jun 20, 2021 · 0 comments
Closed

Support ButtonInteraction #57

Tenebrosful opened this issue Jun 20, 2021 · 0 comments

Comments

@Tenebrosful
Copy link

Tenebrosful commented Jun 20, 2021

Hi, this is a proposal to use MessageComponents like Buttons easier like Slash commands are easier with decorators.

I'm not a English native, sorry if some explanation are weird or something like that.

Proposal 1 - Split interaction event in two

For now interaction are handle like this

client.on("interaction", (interaction) => {
    client.executeSlash(interaction);
  });

But interaction can be CommandInteraction or ButtonInteraction.

I think it's could be nice to split this event in two like (feel free to change event's name)

client.on("interaction", (interaction) => {
   //Switch statement with interaction.type or things like that
  });

client.on("command", (interaction: CommandInteraction) => {
    client.executeSlash(interaction);
  });

client.on("button", (interaction: ButtonInteraction) => {
    client.executeButton(interaction);
  });

Proposal 2 - Create a decorator @Button('customID')

Like @slash, it could be nice to create a decorator to handle ButtonInterraction

@Discord()
abstract class ButtonExample{

    //param is customID, see https://discord.js.org/#/docs/main/master/class/ButtonInteraction?scrollTo=customID
    @Button('buttonExample-1')
    //@Guard(...)
    private buttonExample1(
        interaction: ButtonInteraction
    ) {
        //...
    }
}
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant