discord.js-bot-template
Overview
This is a bot template using discord.js for quickly and easily creating powerful Discord bots. You don't need much Javascript experience to get started on a project using this template. Not sure where to start? Come join my Discord Server, where I'll try and answer all the questions you have.
With Message Content Access becoming a privileged intent I thought I'd build a template where you're pretty much ready to start working on commands after installing it. This template currently doesn't listen to the messageCreate
event. Update Slash Commands by using the /deploy
command or altering the environmental variables.
Features
Complete | Notes |
---|---|
|
Message Content Access is becoming a privileged intent and that's why this template focuses on Discord's Interaction Commands. In fact, we don't even activily listen to the messageCreate event. |
|
This template comes with an event listener that doesn't use the depracated .bind() method. |
|
This template handles user permission level, required command permissions and additional configurable client & user permissions. |
|
Discord's API auto complete is showcased in the /help command and /src/listeners/interaction/autoCompleteInteraction.js file. |
|
This template has detailed information available in the files themselves, allowing new developer's to jump right in and get started on commands. |
|
Configure your command to be global or test server only. Allowing you to test properly, and finally make it available globally. |
|
Configure command cooldowns for all your commands. Allow infinite usages for a command that barely does anything, and restrict resource-heavy commands to 1 usage in 120 seconds. |
|
Configure a required permission level for your commands. Also configure any additional required Discord Permissions for the client/bot and the member calling the command. Very useful for moderation functionality. |
|
Found a major bug in one of your commands? Disable it in your slash configuration export and the Slash Command will automatically be disabled, be it global or test server. |
|
Configure whether or not your command is SFW and automatically restrict it to NSFW channels if it's not. |
|
This template comes with a /src/util.js file which exports utility functions which will make your everyday tasks a lot easier. |
|
Both the client and member objects have extended properties. member.permLevel is available in all Interaction listeners. Client has multiple extensions which are containerized: client.container. ->commands , config , emoji , colors |
|
This template supports and encourages deep command and command-category nesting |
Incomplete | Notes |
---|---|
|
At the time of writing this, Slash Commands can be called in a bots DM channel. I'd like to add full support for DM Slash Commands. |
Installation
Requirements
- Node/NodeJS - Be sure to check the box that says "Automatically install the necessary tools" when you're running the installation wizard
1) Head over to the download page
2) Download either the zip
or zip.gz
source code
3) Extract it using your favorite zip tool
4) Open the folder containing your recently extracted files
5) Open a console/terminal/shell prompt in this directory
- Run
npm i --include-dev
to install all dependencies
/config/
FOLDER
ALL CONFIGURATION IS DONE IN THE 6) Copy and paste .env.example
from config/
, and rename it to .env
located in config/.env
- Provide all your configuration values in this file
- Get a Bot Token from the Discord developer portal
- Also provide the values in
config/config.json
7) Use node .
to start the application or npm run start:dev
if you have nodemon
installed for automatic restarts on changes