📐 Discord Commands
Discord Commands are the old way to provide user-to-bot interaction. They use the message's content, and DiSky parses it as you request when you're defining the command.
Even if they are old and Discord does not recommend anymore to use them, DiSky will keep the support for them, and this page will describe how to create simple Discord Command.
They now require a specific intent enabled, to retrieve message's content. We highly recommend you to use Slash Commands instead, as they are more user-friendly and easier to use.
Creating the command
Any discord command is defined via a Scope:
Okay, here's the base structure. The placeholder you can replace now are:
<name>The discord's command name.
<prefixes>The discord's command prefixes, separated by
<code>The Skript code that will be run once the command is executed.
DiSky will fire the code once any bots receive the following message:
If you had a help command with the
! prefix, it will look something like this:
Let's take a real example, and create a discord command that replies with
Easy, right? Now, whenever someone type
!ping, the bot will reply with
Let's try to make more complicated commands now. DiSky provide a way to ask for Arguments inside discord commands. When defining the command, as we did above, you are able to specify, right after the name, the arguments:
- Either the argument is optional or not.
- The argument's Type (Skript's type), the specified type MUST be able to be parsed in the command context.
- Optionally, the default value if the argument is marked as optional and no values are provided when someone execute the command.
It basically looks like that:
|Type||Is optional?||Default Value||Result|
As you may notice, Optional arguments are simply surrounded by
[ ] while keeping the default
< > argument delimitation.
So let's make a simple
reply command, that will reply with what the first argument is set to:
The discord commands also come with features that are there to make your life easier.
You can specify where your command can be executed through the
executable in, where the input can either be
private message entry:
Permission & Permission Message
Instead of using Skript conditions, DiSky can do that for you. It will check if the user who's executing the command has the specified permissions. If not, then the permission message will be sent back, all that through
permission message entries:
Some entries are just here as placeholders and can only be managed through Skript code. For example, any command can have a
category entry. However, it can only be accessed through Skript's syntax, and is not shown in Discord in any way: