DEV Community

Cover image for How (and how not) to make better Discord bots

Posted on • Updated on


How (and how not) to make better Discord bots

You clicked on this post, which probably means you too make bots, like me. Or you want to. Before I get into this article, I want to clarify that this is not a guide, but a bunch of ways in which you can improve your bots.

Curb your prefix

It is very common among bot developers to come up with complex and unique command prefixes for their bot, to perhaps stand out. While thinking of a prefix, keep mobile users in mind.

A simple symbol like ., $, ! serves the purpose very well, and easy to locate on any keyboard. A short word prefix (2-4 letters) is also a good idea.

Avoid having multiple symbols or a combination of letters and symbols. Some notable examples are: $!help, bot-name!help. Better yet, use slash commands.

Use slash commands

Slash commands are somewhat new to Discord and still evolving. I believe that they are the future of bot interaction in Discord. Unless you have been living under a rock, you must have seen or used slash commands.

Slash command menu

By pressing /, you can see all the available commands for a bot, along with its description. When you use a command, you can see all its parameters. And that's not all! You can even specify what type each parameter should be, so that oblivious users don't enter a string in an integer type parameter.

However, every coin has two sides. slash commands need to be registered beforehand and handled according to their custom_id, which makes it a tedious job to implement them. To solve this problem, I wrote djs-marshal, check it out.

Use Message Components

Similar to the point above, message components such as Buttons and Select Menus are a much better way to take input from the user. Are you making the user send a particular reaction to make a choice or to proceed? Toss that out and use buttons or select menus!.

using reaction

using message button

Make a help command

Unless your bot is meant to be used by a single person, you should try to add a help command to your bot. This should give a brief description of what the bot does, list all the available commands of your bot, as well as some related links like support server invite and bot invite.

Pro tip #1: Make the bot say something along the lines of Use /help for help when the bot is pinged.

Pro tip #2: Set the bot's description and activity to a message that includes its help command. This way, no matter how a Discord user finds the bot, they will be able to get relevant information about the bot without having to search it up.


Don't add vote-walls

A lot of bots block their commands behind a vote-wall. This means that you must vote for the bot on some bot list in order to use it. Though it might bring you a lot of votes fast, it is not the way. This may even trigger people to write negative reviews and use an alternative bot. By all means, promote your bot by requesting users to vote for it, but forcing them to do so is not a good idea.

Top comments (0)

🌚 Friends don't let friends browse without dark mode.

Sorry, it's true.