$addButtonTo
$addButtonTo
will add a button to a specific message.
Usage
$addButtonTo[channelId;messageId;index;label;style;customID;disabled?;emoji?]
Parameters
Field | Type | Description | Required |
---|---|---|---|
channelId | number | The channel id. | true |
messageId | number | The message id. | true |
index | number | In which (action)row the button appears. | true |
label | string | The text that will be displayed on the button as label. | true |
style | string | The button style. | true |
customID | string | The component custom ID used to identify the button. | true |
disabled? | boolean | Make the button unusable/disabled? 1. true 2. false (default) | false |
emoji? | string | The emoji displayed in the button. | false |
Button Types
Name | Value | Color | |
---|---|---|---|
Primary | 1 | blurple | $addButton[1;Example Button!;primary;customID;false] |
Secondary | 2 | grey | $addButton[1;Example Button!;secondary;customID;false] |
Success | 3 | green | $addButton[1;Example Button!;success;customID;false] |
Danger | 4 | red | $addButton[1;Example Button!;danger;customID;false] |
Link | 5 | grey, navigates to a URL | $addButton[1;Example Button!;link;https://discord.gg;false] |
Premium | 6 | blurple, restricts the interaction to premium-only users | $addButton[1;Example Button!;premium;customID;false] |
Custom Emoji | any | any | $addButton[1;Example Button!;link;customID;false;emojiName/emojiId/emojiString] |
Unicode Emoji | any | any | $addButton[1;Example Button!;link;customID;false;😀] |
Example(s)
This adds a primary and link button to the bot’s message:
1client.command({2 name: "addButtonTo",3 code: `4 Hello!5 $addButtonTo[$channelId;$messageId;1;Example Button!;primary;exampleButton;false;💔]6 $addButtonTo[$channelId;$messageId;1;Example Button!;link;https://discord.gg;false]7 `8});
1client.interactionCommand({2 name: "exampleButton",3 prototype: "button",4 code: `5 $interactionReply[Awesome Button Interaction!]6 `7});
This adds a primary and link button to the bot’s message:
1module.exports = [2 {3 name: "addButtonTo",4 code: `5 Hello!6 $addButtonTo[$channelId;$messageId;1;Example Button!;primary;exampleButton;false;💔]7 $addButtonTo[$channelId;$messageId;1;Example Button!;link;https://discord.gg;false]8 `9 },10 {11 name: "exampleButton",12 type: "interaction",13 prototype: "button",14 code: `15 $interactionReply[Awesome Button Interaction!]16 `17 }18];