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
  • Overview
  • Example Payload
  • Message
  • Component
  • ComponentType
  • ComponentStyle
  • PartialEmoji
  • InteractionData

Was this helpful?

  1. Buttons

Buttons Documentation

Overview

Messages can be sent with the components key to add buttons and other components (when discord brings them out), you can edit and add new buttons via editing the message, this is useful for the disabled key to stopping people from clicking it.

Example Payload

{
    "content": "this is an example message for components",
    "components": [
        {"type": 1, "components": [
            {"type": 2, "style": 2, "label": "Button 1", "custom_id": "1"},
            {"type": 2, "style": 2, "label": "Button 2", "custom_id": "2"}
        ]}
    ]
}

Message

Extending the message payload.

Key

Value

components?

Component

Key

Value

Description

type

the type of component

style?

the style of button

custom_id?

string

the internal id of the button, set this yourself, mutually exclusive with url

label?

string

the text on the button

url?

string

used to set the url for hyperlinks

emoji?

used for an emoji in the button text

disabled?

boolean

used to enabled and disable the button - defaults to false

components?

children components

ComponentType

Key

ID

Description

buttons

1

used as the parent of buttons, takes a list of components with the components key with the type of 2

button

2

an actual button

ComponentStyle

Key

ID

Description

blurple

1

a blurple-colored button

grey

2

a grey-colored button

green

3

a green-colored button

red

4

a red-colored button

hyperlink

5

a grey hyperlink button, set the link in the url key

PartialEmoji

Key

Value

name?

string

id?

snowflake

InteractionData

Extending the interaction data payload.

Key

Value

custom_id?

string

component_type?

PreviousbuttonClick Event

Last updated 3 years ago

Was this helpful?

list of

list of

Component
ComponentType
ComponentStyle
PartialEmoji
Component
ComponentType