Options
Last updated
Last updated
When running a command, have you ever wanted anyone to tag a channel, or a member? With options, you can! Depending on the type of option you use, you can ask the user who runs your command to attach a file, tag a member, add some text and more.
In the command builder, there are nine option blocks you can choose from. Each are customizable, allowing you to set a name, description, set as required and on some, you can define pre-set choices for users to select from.
Option blocks can only be accessed in the command builder, not in any event builders.
Below is a list of all of our option blocks and a brief description on each.
Attachment
Run the command and add in a file, e.g. attach an image.
Boolean
Useful for asking the interacting user true or false questions.
Channel
Have an option to tag a channel each time the command is run.
Integer
Forces a whole number to be inputted for this option. E.g., 1
, 0
or -1
.
Mentionable
Search and tag either a member or a role from your server.
Number
Ask the user to enter any numbers including even, odd, negative and more.
Role
Use a role option to easily tag a role each time you use your command.
Text
Text options have no limitations. Any characters can be used in this option.
Member
Have an option to easily mention a member from your server.
With each option, you can refer back to what the command user entered. For instance, if you have a text option in your command named text
, you can return its value by using {option_text}
.
Some options can return unique information, such as for attachments, you can find whether the file was marked as a spolier; to do so, you can use {option_name[spoiler]}
. This is done by refering to a JS property. E.g., spolier
is a property of an attachment.
For every option, the properties will be diverse as attachments, members, roles etc have different values. Each option's properties will be explained further for each option, but to find more about Discord JS properties, visit Discord JS.
In this page, {option_name}
is provided frequently as an example. Make sure to replace name
with one of your option's names. Otherwise, these variables will not work for you.
To add a preset choice, write the choice you'd like to add and press enter. From here, an option condition can be used to determine which choice the user picked and you can decide to add actions depending on the choice selected.
Configuring the option condition is straightforward. Start by selecting your option with the preset choices and typing in the first choice e.g. option 1
. Repeat this step for as many preset choices you have, and once you are finished you should have an option block similar to the example below.
You are only able to define pre-set choices on the integer, number and text options.
By default, options will be optional to answer. Meaning, the user that uses the command does not need to fill in your option and they can run the command even if your option is left blank. When setting options to required, users must complete your option.
With this option condition, your null condition will be triggered if your option was left empty. Otherwise, your else condition will run as an option will been filled out. Therefore, you can now run unique actions based upon if the user completed an option.
Once you have a few options created in your command, you can change the order in which they appear when you run your command. For example, my command currently starts by asking the user to select a number of winners for a giveaway. Instead, I want to start by asking for the host.
To reorder options, you can simply edit the command (by using the pencil icon) and head to the options tab. To reorder your options, use the up and down arrows at the right side of each option. For your required options, they will have a locked icon; whereas unrequired options will have an unlocked icon.
Need a file attached, such as for proof for a ban command? Use an attachment option and allow users to upload files such as an image. With this attachment option, if your attachment file is an image, you can refer to an image by using the variable {option_name[url]}
.
With attachment options, you can access more than just the url. For example, you can grab it's content type, description and if it has been marked as a spolier e.g., by using the variable{option_name[spolier]}
. With each variable, make sure to replace name
with your option's name.
To find every property you can access (e.g., spolier
is a property), visit the Official Discord JS page or see our Discord JS walkthrough guide talking about using variables and properties.
Per Discord's limitations, the maximum file size for non-Nitro users is 25MB. Those with Nitro Basic can upload files up to 50MB, and Nitro subscribers can upload files up to 500MB. With these limitations in mind, all images and GIFs will be small enough to upload, even if you do not have a Nitro subscription.
Unlike an attachment option, boolean options do not have any other information you can grab.
When checking to see whether the command executor chose true or false, start by placing an option condition block. From here, create a new condition as shown below. After, if the user chose True
your condition will fire. Otherwise, your else condition will run.
Useful for tagging a giveaway channel, for example, the channel option allow users who use the command to tag a channel. With this option, a list of channels, including categories, will pop up. Users will only be able to select a channel, and no other text can be entered.
Depending on the channel's type that was selected, e.g. whether it was a category, voice channel or text channel, depends on what you can return when using Discord JS properties. To find all of the properties you can use, see this Discord JS documentation page.
For instance, you can find the last message, last pin timestamp and the channel's topic by using a variable such as {option_name[topic]}
. In this variable, just replace topic
with the property you wish to use e.g., {option_name[lastMessage]}
.
When using {option_name}
it will return the channel's ID. To tag the channel in a message, please use <#{option_name}>
. For more on message formatting, how to tag emojis, users and other formats, see this Discord Developer Documentation page.
Integer options, unlike number options, ask command users to enter a whole number (e.g. 1
, 0
or -1
). Other numbers such as 1.2
are unable to be entered for this option, as shown below. Therefore, this option is great for asking for a number of giveaway winners for example.
Mentionable options allow users to select any role or member. Unlike other options, you are unable to enter pre-set choices for a mentional option. However, similar to an attchment option, there are properties available to gather further information.
For example, if a role is given you can find properties such as its colour, time the role was created, icon, and name. To find a list of all role properties, visit this Discord JS page. E.g., to find a role's colour, you can use the variable {option_name[color]}
.
Likewise, if a member is selected, you can find a member's avatar, display color, id, nickname, status and more. To find every property you can use, feel free to visit this Discord JS page. E.g., you can find a member's status by using the variable {option_name[presence.status]}
.
To find out more about properties and what variables you can use, visit Discord JS.
Since the user running the command and pick from any member or role, sometimes you may need to find out which - a member or role - they picked. This is especially important for using the correct variables, e.g. {option_name[color]}
vs {option_name[presence.status]}
, as only one variable works with roles and the other with members.
There are multiple ways to check whether the ID returned is a role or a member, but the easiest way would be to use a comparison condition. In this condition, you can check to see if {option_name[color]}
is undefined. If so, the ID is a member's ID. Yet if it is not undefined, the ID belongs to a role.
For a number option, you can enter any number values such as 1
, 0
, 0.1
, -1
etc. Handy for managing an economy, these options restrict users from entering non-numeric content. With a number option, you can define pre-set choices for command users to choose from.
Similar to a channel option, role options force users to select a role from the server. Helpful for commands such as an add-role command, the role option prohibits users from entering anything other than a role, and it automatically provides a list of roles ready for selection.
Role options allow you to possess its properties. For instance, you can gather additional information on the role such as its name, colour, time of creation, and more. To do so, you can use a variable such as {option_name[name]}
to access the role's name.
There are more properties than those mentioned above (e.g., a role's name is a property). To found out more on Discord JS properties, visit Discord JS. However, to find a full list of properties for a role, please visit this official Discord JS page.
Text options are free of limitations, meaning that any character can be used. Thus, these options can be useful for moderative commands, for example, as you can add a custom reason. Unlike other options, text options let you configure pre-set choices.
Member options allow you to select a server member. This is useful for commands that require user-specific actions, such as sending a direct message or selecting a user to moderate. Like role options, member options restrict input to server members only, and provide a brief list of members to pick from.
You can also retrieve various details about the member using variables such as {option_name[user.username]}
, {option_name[displayName]}
, and more using guild member properties. For a list of these properties, please refer to this Discord JS documentation page.
For unrequired options, you can use an option condition block () to check if your option was completed or not. To do so, you will need to check if your {option_name}
is equal to null. When using your option condition, select your own option by using the target option dropdown.
Need the user to answer a yes or no question, or select weither something is true or false? Introducing boolean options! Ask questions related to your command and you can use an later on to distinguish their answer. E.g., for a giveaway command, you can ask if you'd like it to start now!