Custom Commands Variables
Custom commands allow you to use arguments and defined variables. Here is a list of variables you can use.
Example of custom command using Both Variables and Arguments:
The {user} variables
user variables refer to the user who typed the command
- {user} {user.mention} : user mention | Example: @MEE6
- {user.id} : user id | Example: 159985870458322944
- {user.name} : user name | Example: MEE6
- {user.discriminator} : user discriminator | Example: 4876
- {user.idname} : user tag | Example: MEE6#4876
- {user.avatar_url} : user avatar url | Example: https://bit.ly/39ZSJsb
The {server} variables
server variables refer to the server where the command was executed
- {server} {server.name} : server name | Example: MEE6 Support
- {server.id} : server id | Example: 159962941502783488
- {server.icon_url} : server icon url | Example: https://cdn.discordapp.com/icons/159962941502783488/736c44dc0f5edf4115c0a23e1dbc5d1b.webp?size=1024
- {server.owner_id} : server owner id | Example: 138362511190786048
- {server.region} : server region | Example: eu-west
- {server.member_count} : server member count | Example: 82036
The {channel} variables
channel variables refer to the to channel where the command was executed
- {channel} : channel mention | Example: #channel
- {channel.name} : channel name | Example: channel
- {channel.id} : channel id | Example: 531047198964711424
Miscellaneous
- {user.avatar} : user avatar hash | Example:a03cda55b8b9f1b36b6220f7e34e4de0
- {user.bot} : True - user is a bot, False - user is not a bot | Example: False
- {server.icon} : server icon hash | Example:736c44dc0f5edf4115c0a23e1dbc5d1b
- {server.verification_level} : server verification level: 0 - none, 1 - low, 2 - medium, 3 - high, 4 - tableflip | Example: 2
- {server.joined_at} : date when bot joined server | Example: 2017-04-08T07:24:15.143000+00:00
- {channel.type} : 0 - text, 1 - dm, 2 - voice channel, 3 - group dm, 4 - category | Example: 0
There's also random variables that can be used:
- {random:x:y} picks a random number between x and y. Values must be pre-entered. Example: {random:1:10} would pick a random number between 1 and 10
- {random} picks a random number between 0 and 10
How to use arguments
In the custom command response you can write {n} to copy the nth argument.
You can also use ... to copy a range of arguments.
By combining them you can do for exemple:
{1...} to copy all the arguments
{...3} to copy the first 3 arguments
{2...6} to copy arguments from the 2nd to 6th
Example of Report Command :
Default argument value
By adding :default text at the end of the code, you can add a default value for when the argument is not specified by the user.
By adding :default text at the end of the code, you can add a default value for when the argument is not specified by the user.
If no default value is set, the bot will copy the code to indicate how to use the command.
Same EXAMPLE As Above Without Giving Default Values :
Same EXAMPLE But With Default Values :
SOURCE :https://bit.ly/2y6VJp4