Buttons¶
This Section will cover how to create a button, multiple buttons and also detect and handle button inputs.
This Page explains using Mods!
- This Page includes Content using Community Created Mods and may vary from your experience!
- Go to Documentation page for Mods
Important
- Each Button needs a Custom ID to detect when it was Pressed
- You can get a Emoji on Windows using Win+.
Slash Command Structure
Create One Button¶
- This Alignment will Trigger on the Slash Command /buttons and, which will create and send the button with the
Send Message/Interaction (Multi)
Block.
Create Multiple Buttons¶
Detect and handle a Button Press¶
- You can use the
Interaction [Event]
to detect a Button Press using the Custom ID. Also to get the Current Time and Date you use theCreate Date
Block and using theFormat Date
Block you can get the Date in a Text Type. -
- To now send a message back to the User that used the Button, you can use the
Send Message/Interaction (Multi)
Block. -
(Ephemeral means only visible to the user)
- To now send a message back to the User that used the Button, you can use the
Testing Everything¶
Edit a Button¶
- You can also edit a Button, for example when you want to change the Label or the Style.
Example Button to edit¶
- To edit a Button you need a button that you want to edit, for this we are going to use a slash command which is going to create the button and then reply it to the interaction.
Getting to the Edit Button¶
- Now you have multiple ways how and when to edit the button, the simplest is to take the Interaction Event Block and then use Get Message Buttons Block to get the Buttons from the Message and then use the Edit Button Row Block to edit the Button of the Message. At the end use the Interaction Update Block to update the Interaction with the New Button and a New Text/Embed.
How it looks in Discord¶
Still Issues or Questions?¶
- If you have Issues or any questions you can always ask on the Discord Bot Builder Discord, or send me a DM:
xcrafttm
!