Simple Slash Command: Confession
In this guide, you will learn how to make a simple slash command called /confess
, where user can use to send a confession in a beautiful embed like this:
1. Create a command
The first step is to create a new slash command:
- Head to your server in dashboard
- Click
Slash Command Builder
- Construct the confess command (follow the next GIF)
2. Responding To Code
Next, Let's write the code that will respond when user runs the slash command:
- Head to your server in dashboard
- Click
Manage Your Commands
- Click
Create
- In Command Settings, select the Trigger Type to be "Slash Command", then select
/confess
- For Code:
- To respond to the user, you can do so with
$interactionReply[message]
where message is the text you would like to display:
For example: $interactionReply[Hello World]
- To receive user input of confession, we can use $getOption[option name], where
option name
is same option name we used while building the slash command which ismessage
For example: $getOption[message]
- So we would combine both and code would look like:
- To respond to the user, you can do so with
$interactionReply[Your confession is
$getOption[message]
]
3. Output (Normal Message)
That is all, let's test it out 🤩
It works :happy:! but... what about making the respond into a beautiful embed?
4. Modify Code To Respond With Embed
To build an embed, we need to use curl message format. Curl is a way for you to build an embed in the place of the message
input, for example to set up an embed with description and title we will use:
{desc:My embed description}
{title:My embed title}
You can see the full list here
So, We will modify the message content of $interactionReply
and use the curl message format, code would look like:
$interactionReply[
{title:$username's confession}
{desc:
$getOption[message]
}
{color:GREEN}
]
5. Output (Message With Embed)
Let's test again!
Congratulations, You made a functional slash command 🎉!
Of course this might be simple, but it's good start!