Shandler
  • Shandler
  • Information
    • Basic Usage
    • SHClient and Interaction
    • Deleting Commands
  • Interactions
    • Methods
  • Buttons
    • Getting Started with Buttons
    • Dropdowns
    • buttonClick Event
    • Buttons Documentation
Powered by GitBook
On this page
  • The Basics
  • Adding Buttons to Commands
  • Action Rows

Was this helpful?

  1. Buttons

Getting Started with Buttons

PreviousMethodsNextDropdowns

Last updated 3 years ago

Was this helpful?

The Basics

First, I recommend checking out the and in our documentation. Click to see all of the button's documentation.

Adding Buttons to Commands

To add a button or buttons to a command we need to set it up a little like this. ****

let cmp = [
    {
        "type": 1, "components": [
            { "type": 2, "style": 1, "label": "Button 1", "custom_id": "1" }, //this is your first button
            { "type": 2, "style": 4, "label": "Button 2", "custom_id": "2" } //this is your second button
        ]
    }
]
interaction.reply("Pong!", { components: cmp, type: 4 })

Find all the possible components for the payload .

You can find all options for "type" . Find all the options for "style" . "label" is the name of the button that will be shown. The "custom_id" is the id of the specific button to be accessed later, we will address this more later.

Action Rows

let cmp = [
    {
        "type": 1, "components": [
            { "type": 2, "style": 1, "label": "Button 1", "custom_id": "1" }, //this is your first button on the first row
            { "type": 2, "style": 4, "label": "Button 2", "custom_id": "2" } //this is your second button on the first row
        ]
    },
    {
        "type": 1, "components": [
            { "type": 2, "style": 1, "label": "Button 3", "custom_id": "11" }, //this is your first button on the second row
            { "type": 2, "style": 4, "label": "Button 4", "custom_id": "22" } //this is your second button on the second row
        ]
    }
]

Adding multiple rows of buttons looks a little like this. ****

Example
here
Example
Overview
Example Payload
here
here
here