discord-webhooks icon indicating copy to clipboard operation
discord-webhooks copied to clipboard

Support for component types such as buttons and select menus

Open MinnDevelopment opened this issue 3 years ago • 3 comments

Since this library can be used to handle interaction webhooks, it should also support message components. This would need to be added to WebhookMessage and WebhookMessageBuilder. For more details on components, read up here: Message Components.

A possible implementation could look like this:

ActionRow buttons = ActionRow.of(
  Button.primary("custom_id", "Label")
);

WebhookMessage message = new WebookMessageBuilder()
  .addComponents(buttons)
  .build();

ActionRow would be an implementation of LayoutComponent and Button would be an ActionComponent.

interface Component extends JSONString {
  int getType();
}

interface LayoutComponent extends Component {
  List<ActionComponent> getComponents();
}

interface ActionComponent extends Component {
  String getCustomId();
}

Since this library only handles incoming webhooks, events and similar cannot be supported. I'm only looking for the support of sending message components in webhook messages.

MinnDevelopment avatar Oct 03 '21 16:10 MinnDevelopment

Are there any plans to implement this soon? I saw there was a pr but it got closed...

Cardistymo avatar Jun 01 '22 12:06 Cardistymo

Would love for this to be introduced. @RohanGoyalDev, what happened with #56?

MrGraversen avatar Jun 02 '22 10:06 MrGraversen

is this happening any time soon ?

LoicMaitreDuFeu avatar Mar 12 '23 13:03 LoicMaitreDuFeu