These guidelines are intended for public bots running on public guilds. If your bot is restricted to private guilds, this document most likely does not apply to you.
If you have an idea for an addition or change to this document, please make a pull request and we can discuss it.
Bots should not be activated during a normal conversation. Instead, they should use a command prefix and/or respond when the bot is directly mentioned.
Single-character prefixes, such as !
, $
, and .
, are commonplace for activating
commands and can overlap with other bots. Should you opt to use a prefix for your bot,
consider using words (owl
) or use unique Unicode characters ("
). Avoid using #
,
@
, :
, or /
as prefixes since they are used for Discord-specific actions like mentioning
a user. Ideally, a bot's prefix should be configurable on a guild-by-guild basis so that
a guild owner can ensure every bot has its own unique prefix.
Restrict yourself to a small number of prefixes, preferably one, to avoid the risk of colliding with others.
Try your best to avoid mentioning the user when replying to a command. Doing this can lead to bot reply loops. If a long-running command is executed, mentions are generally acceptable; however, private messages are preferred in this case.
Info commands should provide information about the bot, such as what framework it is
using and its version. It should also include any help
commands, and, most importantly,
who made it.
If a user attempts to use a command that does not exist, do not reply with anything. Let the command fail silently, and avoid things like "invalid command." If there is more than one bot in a server that shares a prefix, this can result in very obnoxious usage. Although, if the user ran a correct command but the arguments are wrong, then it is okay to reply with "invalid argument(s)." If your bot's prefix is configurable, this rule can be most likely be safely disregarded, however we still recommend following it.
Bots that abuse and misuse the Discord API ruin things for everyone. Consider adding things like rate-limiting and backoff, and be intelligent about using the API. If you are unsure about the correct way to implement things, ask for help. Also, any bots that breach the Discord Terms of Service could result in both the bot's and the user's account to be terminated. (Terms of Service - Developer / API Terms of Service)
This helps prevent infinite self-loops and potential security exploits. Using a zero
width space such as \u200B
and \u180E
at the beginning of each message also prevents
your bot from triggering other bots' commands. The Discord API also tells you if a user
is a bot (bot
property on User
objects -
see the reference).
All NSFW commands or features should only work in Discord's NSFW-marked channels. If these commands can be activated outside of these channels, it can cause your bot to quickly be banned as that is against the Discord Terms of Service.
Allow users to mention the bot as an alternative to using prefixes ("@MyBot help"). This will help users who are new to your bot get started. Make sure that, however, places to ask for help can easily be found. One of the best ways to do this is using a bot's presence. Mentioning is truly the most unique prefix of all.
Whenever a bot responds to anything, ensure that it escapes mentions
(particularly @everyone
and @here
). While the user may not have permission to mention
@everyone
, your bot might, which can result in "mention injection."
- Note: Some libraries do this automatically for you by default, but others will require you to set mentions to (not) parse. See the Allowed Mentions section of Discord.