Arguments and this article are closely related to Variables. To learn more about Variables please visit this article.
Take advantage of both Arguments and Variables to create awesome Custom Commands for you and your server members.
What Exactly Is an Argument?
An Argument is a placeholder within a custom command that you can replace with specific text or value.
When an argument is correctly setup and used, MEE6 bot will copy arguments and use them in the reply.
Important to Know About Arguments:
- Arguments are always separated by one or multiple spaces
- Arguments can have default values that will be used by the bot if none were provided by the user
- If no default values are set and nothing is provided by the user, the bot will copy the code to indicate how to use the command
- Arguments follow programmatic logic and can be set to output only a specific amount of words\values
- You can use external links, Discord links, usernames, and some other elements as values for your Custom Commands arguments
Arguments Usage Example:
Here we have a !report command with one variable {user} and 5 arguments, numbered from {1} to {5}.
When we execute this command and include additional text separated by space, this is how MEE6 will reply:
Default Values for Your Arguments
Not every command needs an argument. If you want to make them optional and avoid MEE6 outputting plain syntax, you can specify default values that will be used when the user does not provide anything.
Default values are inserted after the : symbol, like this {1:Report sent to the mod team, thank you!}.
Here's a visual example of the custom command configuration with default values:
Here is the output that MEE6 makes for this command when we type only !report and nothing else:
Easy and Practical Arguments:
To make the usage of a particular command easier for normal users, you can insert the {1...} argument.
This exact syntax would make MEE6 copy all the text provided by the user after the command.
Here's an example of command configuration:
Here is the output that MEE6 makes when we insert text after !report command:
You can customize this syntax further, to specify the exact amount of elements your command will accept.
It works very similar to a programming logic used in many languages:
- {x...} copies everything from element X until the end.
- {...x} copies everything from the start till the element number X.
- {x...y} copies all elements between X and Y, including these.
Here are visual examples of how bot will react to using these arguments:
Feel free to experiment with Variables and Arguments to build the perfect custom commands that will benefit your server!
If you have any questions about this, do not hesitate to join our Support Server✌️