Concepts
WarningThis page is still a work in progress.
Intents
Intents are a security feature discord has. This tells discord what your bot’s intentions are.
You can find a list of intents here.
NoteThere are two types of intents:
- Standard : can be passed with no additional settings or configurations.
- Privileged : have to be toggled in your bot’s settings before passing. For bots within 100+ guilds you also need to apply for said intents after verification.
Commands
Discm has two base types of commands:
- Text
- Slash
Text Commands
Text commands are not uploaded to discord for deployment, as all it does is look for messages, read the contents, and determine if it is a command or if it is just a message.
Text commands require GuildMessages
and MessageContent
intents.
Prefixes help determine which messages are commands and which aren’t, your bot’s prefix can be set via DiscmClient#prefix
.
Text commands can accept arguments, however it is not as easy as slash command arguments, as you would have to parse everything yourself.
TipDiscm automatically parses arguments for you, but if you wish to parse yourself, do not define
DiscmCommand<"text">#options
Slash Commands
Slash commands have to be uploaded to discord for deployment, which is automatically handled by discm.
They can either be deployed globally (meaning every guild the bot is a member of) or privately by specifing the guild id to deploy to (if the bot is a member of that guild).
To deploy commands privately set DiscmClient#global
to false. It is set to true by default.
You can also delay the deployment of every command or individual commands via DiscmClient#delayDeploy
or DiscmCommand#delayDeploy
.
These commands will not deploy until DiscmClient#deploy
or DiscmClient#deployCommand
are called.
NoteIf
DiscmClient#global
is set to false, you need to provide either a singular guild id, or an array of guild ids to the login function.The login function on
DiscmClient
overloads discord.js’sClient#login
typescriptundefined
Slash commands can also accept arguments, which are automatically parsed for you by discord.
Events
Events tell us when something in the guild happens, like when a message is sent or deleted, when a member joins or leaves the guild, or when someone uses a slash command.
Discm listens to InteractionCreate
and MessageCreate
to detect and run commands, you can still listen to these commands manually, however it will be ran after the discm code is ran.