Articles on: Custom Commands Plugin

Custom Commands Variables

Custom commands allow you to use arguments and defined variables. Here is a list of variables you can use.

An example of custom commands 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://cdn.discordapp.com/avatars/136777781005647872/a03cda55b8b9f1b36b6220f7e34e4de0.png?size=1024

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.owner} : server owner mention | Example: @Anis
{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
{username} : will show the name of the temporary voice channel's owner (only useable in the Temporary Channels plugin).
{index} : is used as a counter for Temporary Channels and will display as #1, #2, #3 etc... (only useable in the Temporary Channels plugin).

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 example:
{...} will copy all arguments after the command
{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 a report command

Arguments of a command are pieces of text that are placed just after the command. They are separated by one or multiple spaces.

For example if you type !report @Mario#0001 being offensive:
The command would be report
1st argument ({1}) would be @Mario#0001
2nd range argument ({2...}) would be being offensive

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.

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

Currently if you use new lines in the command response when typing it on Discord the command will not pick up the text on the new lines, it must be in 1 continous line.

If you have questions about arguments or variables in custom commands, do not hesitate to join our support server ✌️

Updated on: 12/05/2021

Was this article helpful?

Share your feedback

Cancel

Thank you!