Skip to content

Instantly share code, notes, and snippets.

Forked from Zomatree/
Last active Apr 28, 2021
What would you like to do?


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 stop 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"}


extending message payload.

Key Value
components? list of Component


Key Value Description
type ComponentType the type of component
style? ComponentStyle 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? PartialEmoji used for an emoji in the button text
disabled? boolean used to enabled and disable the button - defaults to false
components? list of Component children components

Component Limits

Key Limit (number of characters)
custom_id 100
label 80
url 500


Key ID Description
action_row 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


Key ID Description
primary 1 a blurple coloured button
secondary 2 a grey coloured button
success 3 a green coloured button
danger 4 a red coloured button
link 5 a grey hyperlink button, set the link in the url key

If a url is given to a button, they must have a style set to 5. You can't have custom_id and url. url based buttons do not dispatch INTERACTION_CREATE.


Key Value
name? string
id? snowflake


extending interaction data payload.

Key Value
custom_id? string
component_type? ComponentType


Key ID Description
DeferredMessageUpdate 6 Signals that a message update will appear later (not required, basically an ACK). No body
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment