Understanding Discord — Slash Commands
Bots are an integral part of running servers efficiently on Discord since many offer features that are not a part of the application such as automated moderation and role management. Community builders often also use bots to make a community more engaging with rewards for activity and fun commands. However, a problem that Discord bots have faced up until now is that they never felt integrated into the platform like Discord’s own native features. That’s all changing with Slash Commands.
Slash Commands are actually not new. For the longest time, they have existed in the form of simple text commands like “/me” and “/tableflip”. What’s new is that Discord has upgraded Slash Commands and made them available to bots. This allows Discord bots to offer a more seamless experience since they can offer more functionality within the application itself, like command suggestions and modal popups. Since so much has changed, let’s look at how we use Slash Commands.
How to use Slash Commands
As mentioned earlier, Discord has had Slash Commands for a long time. We will use two of these built-in commands to show how you use Slash Commands.
In the GIF below you will see me use two commands “/me” and “/nick”. One makes an entire message italic, and the other is to quickly change my nickname on the server.
Upon typing /, you will get a list of commands that you can either type out or click on. Some commands also include extra “Options” such as the “new_nick” Option on the “/nick” command. Options are like command arguments in prefix commands, passing information for the command to use.
Next, let’s look at what built-in commands Discord already has.
Integrated Slash Commands
Integrated Slash Commands allows you to perform some basic functions and searches via built-in commands. Discord has expanded this list over the years to include some other functions such as banning or kicking, creating threads, and even quickly direct messaging a user. Below is a list of these commands and what they do
/giphy— Searches Giphy for a GIF by keyword.
/tenor— Searches Tenor for a GIF by keyword.
/shrug— Appends ¯\_(ツ)_/¯ to the end of your message if used with the option, else it just sends it on its own.
/tableflip— Appends (╯°□°）╯︵ ┻━┻ to the end of your message if used with the option, else it just sends it on its own.
/unflip— Appends ┬─┬ ノ( ゜-゜ノ) to the end of your message if used with the option, else it just sends it on its own.
/me— Italicizes an entire message.
/nick— Used to change your nickname in a server.
/thread— Starts a new thread in the channel.
/kick— Kick a user from the server.
/ban— Ban a user from the server.
/timeout— Place a user on chat timeout.
/msg— Quickly direct message a user.
There are some important Integrated Slash Commands for managing your server built into Discord, but you might be wondering how you restrict the usage of Integrated Slash Commands in your server.
Access Control for Built-in Commands
In the days of prefix commands, you used to rely on a bot’s developer to offer a way to control access to commands. Some went even further, offering the ability to restrict command usage to certain channels through the bot’s settings. The point is you were at the mercy of how granular they decided to make these settings. With Slash Commands, Discord has put that control in your hands with new settings and permissions for all commands.
Before diving into bot commands, we should mention that some built-in commands are linked to specific permissions. These are:
- /kick — Requires “Kick Members”
- /ban — Requires “Ban Members”
- /timeout — Requires “Timeout Members”
- /thread — Requires “Create Public Thread”
- /nick — Requires “Change Nickname”
(To learn more about permissions check out this article).
The permission “Use Application Commands” is how you universally enable or disable Slash Commands. You can find this permission under the Text Channel Permissions of any role and is also available in a channel’s permissions overwrites.
In all cases, Slash Command will not show in the list when a user types / if they do not have the required Discord permission to use it.
This is the basics of controlling Slash Commands by permissions, but you have more options when it comes to Discord bots.
Slash Commands and Bots
Before you start using Slash Commands with a bot, you must ensure the bot has them. After adding a bot, you can check if they have Slash Commands by typing / and checking the Slash Commands list.
Managing the bot and its commands will be like it has always been with one major difference, controlling the usage of commands within the server.
As mentioned before, some bots offer a way to control where it can be used and by whom. However, bots cannot control the permissions of their Slash Commands in your server (well, not directly which we’ll discuss at the end), so the bot won’t be able to control command visibility. This might result in someone trying to use a blocked command in a specific channel simply because they can see it in the list. To stop this, you can use the Integrations tab in your Server Settings to disable and enable Slash Commands in specific channels or for specific roles.
You can change access to the command by role and channel from this page using Command Permissions. For example, if you wanted to restrict the usage of commands to a specific channel such as a #bot-commands channel, you can click on “Add Channels”, select the channel(s) you want commands allowed in, enable the command for that channel, and disable it for All Channels. The GIF below demonstrates how to do this.
You can repeat the process for Roles as well. When clicking on a command directly, you will get a similar menu to add channels and roles. You can also sync a command to the global settings when it has had its settings changed, like how a channel in a category can have its settings synced to that category. (If you would like to learn more about setting up permissions by category and channel check out this article).
By setting these command permissions, you not only restrict where the commands are allowed, but also if they appear when someone types / in a channel. Note that server owners and users with the Administrator permission will override these settings and be able to use the commands anywhere at any time.
In this article, I covered using Slash Commands and how to manage them through the Integrations tab. There is much more to this new system as Slash Commands are only a part of the larger “Interactions” ecosystem — which allows bots to also use drop-down menus, buttons, modals, etc. While many bots are only implementing Slash Commands because it has integrated support from the platform, some bots take it further and I’ll be looking at those advanced usages in a future article.
To conclude, it is great to see that Discord is finally recognizing the importance of bots and what they do for the communities that use the platform. I look forward to seeing what lies ahead for this part of the application!
If you liked this article and publication, please consider leaving a 👏 applaud. It will let our authors know that you found this kind of information worthwhile.
If you want to continue discussing this article and other ideas in this blog or related topics, join the Community Builders on Discord where community discussions are occurring!
Our blog is sponsored by Statbot, the premier statistics and analytics Discord bot and dashboard for your community. It is an absolute must-have for any server that is serious about its growth and well-being. When a server has Statbot in it, you know it’s aiming to be the best of its kind! Statbot tracks member count, messages, minutes spent in voice, activity, and statuses. It offers many ways to view and use this data to help grow your community, such as, automatic role assignment according to users activity in your Discord server (A.K.A. Statroles), and channel counters that allow you to display all kinds of stats about your community to others as a channel (A.K.A. Statdocks). If you run a Discord server we highly recommend getting Statbot to help track your growth and augment your community.
Have ideas for content you’d like to see on the blog? Make a suggestion!
Think you have what it takes to write for CBB? We’re hiring authors! If you are interested, please fill out this application and join the Statbot Discord server where blog operations are based. We look forward to seeing you!