Discord Interactions
In December 2020, Discord released their first interaction: the slash command. Since then, Discord has added and updated Interactions a lot. Different types of Interactions include:
- Buttons: Buttons are attached to a message and can be clicked on to perform an action.
- Select Menus: Drop-down menus are used to select a few options from a list.
- Modals: Form-like modals can be used to ask for input from a user.
- Slash Commands:
Commands that can be used with the
/
prefix. - Context Menu Commands: Commands that can be used from the right-click menu.
- User Commands: Commands that can be used on a user by Alt-clicking/selecting on them.
- Message Commands: Commands that can be used on a message by Alt-clicking/selecting on it.
Message Components
Message Components are fairly new features in Discord, allowing developers to give their bots a fast and understandable user interface. Message Components are easy to use and make your bot look modern, sleek, and downright awesome.
Views
Views are not an Application Command nor are they a Message Component. Views are the invisible
placeholders or grid that Message Components lie in. Views can have up to 5
Action Rows
. Action
Rows
can have a maximum of 5 slots. Below you can find a table of how many slots a Message
Interaction takes up.
Component | Slots |
---|---|
Buttons | 1 Slot |
Select Menus | 5 Slots |
Text Modals | 1 Slot (opened via a button) |
So, based on this, you could have a maximum of 25 buttons in a View with no Select Menus and 5 Select Menus with no Buttons in a View. This doesn't mean you can't have them both in a View. You can have a combination, such as 20 Buttons and a Select Menu or 10 Buttons and 3 Select Menus.
Buttons
Buttons are the first of the Message Components. They allow for quick responses to prompts, such as a "cancel" or "continue" button. Of course, these aren't the only uses. People have created awesome things with buttons, such as calculators, games, and more!
This is what a Button looks like. Very simple and modern. To learn more about buttons, refer to our buttons page.
Select Menus
Select Menus are the second of Discord's Message Components. They allow for quick choices by the user that your bot can use. Select Menus are good for things such as choosing features, pages of a help menu, and more.
This is what a Select Menu looks like. While not looking as good as Buttons, they still look great and have even greater possibilities. To learn more about Select Menus, please refer to our Select Menus page.
Modal Dialogs
Text Modals are the most recent Message Component in Discord. They're useful for text input and filling out forms such as a sign-up for your bot's service. These are meant to replace long bot setup processes by allowing users to fill out a form, as well as replace having to make the user send messages that the bot uses in general. Modals are accessed by invoking an application command or by interacting with another UI Component.
This is what a Text Modal looks like. Easy to use and one of the most useful Message Components yet. To learn more about text modals, please visit our Modal Dialogs page
Application Commands
Application Commands are also a new feature to Discord that allow easier ways to use commands that don't compromise Discord safety and privacy. Application Commands are easy to add to your bot and give users an easier and safer way to use commands.
Slash Commands
Slash Commands were the first Discord Interaction. Slash Commands are easy to use and create. They allow for an alternative to prefix commands without the need for the message content intent.
note
Preferring prefix commands over Application Commands is not a valid reason to apply for the message content Privileged Intent. Using this as a reason will get your application denied.
This is what a slash command looks like. Very simple, not very different from a normal command other apart from the note telling you who used the command. Slash Commands support fields for the following:
- Members
- Roles
- Channels
- Attachments
- Text
Just about as good as it gets.
Message and User Commands
Message Commands and User Commands were both introduced around the same time, and are very similar to
each other, so we'll be introducing them together. These commands are found in the apps
tab when
alt-clicking. The only difference between the two is that Message Commands only appear in the apps tab
of a message, while User Commands are only found in the apps tab of a user. Message Commands are
useful for having a function to report a message, warn a user for that message, and more. Whereas User Commands
are useful for having a function to add a user to a ticket, warn a user, and more.
Here's an example of a Message Command:
And here's an example of a User Command:
Pretty cool, right? To learn more about these two, please read the Context Menus guide.
Application Commands vs. Prefix Commands
Ever since Discord was created, apps on it have used prefixes. This means that you'd have to put a
certain character or string of characters in front of your command, such as !ping
. The way this
worked was that your bot listened for messages and picked out the ones that had their prefix, and then
responded with the command. Now, Discord is encouraging developers to switch their applications to
Application Commands, a new system meant to preserve the privacy and safety of Discord's users. But
why exactly is Discord making us switch? What's the better option, Application Commands or prefix
commands? Below we discuss everything you need to know.
Discord's Decision
Application Commands became a thing because of privacy concerns. When Discord was young and new, they weren't very concerned about how bots have access to message content with every message event with the API. However, as Discord grew, this became more of a problem. Hypothetically, bots could simply listen to every message they receive via the Discord API and give off that information to a company. Maybe an advertisement company like Google or Facebook. This is a problem since that data is supposed to be private to Discord. As such, they locked down message content into a privileged intent and introduced Application Commands for bot devs to use.
Prefix commands work by reading messages, as described before. Application Commands, however, don't work this way. Application Commands work by Discord sending your bot information for when a command was used. This way, Discord can limit message reading to only bots that absolutely depend on it, such as auto-moderation bots.
Who has to Use Application Commands
Any verified bot without a reason that Discord deems acceptable must use Application Commands. Discord is allowing applications for the Message Content intent, however they don't want to support prefix commands for privacy reasons, so they will automatically decline any application for message content intent used only for prefix commands. So, if your bot doesn't have an automoderator, message detector, or anything that reads messages, you're out of luck.
Unverified bots, however, don't have to use Application Commands. This is because the Message Content
intent is a Privileged Intent
, meaning that you must apply for it and it only needs to be applied
for if your bot is verified or going to be verified. Unverified bots don't have to apply for intents
until they need to get verified, so they can use Privileged Intents freely.
So if your bot is for a couple of servers, you can use prefix commands. If you plan on going somewhere with your bot, it'll have to use Application Commands.
What's the Better Option
What's truly the better option is up to you as a developer. But, there isn't really an option. If you plan on growing your bot, you have to use Application Commands. Developers with bigger bots don't have a choice, so we'll just have to get used to it.