Skip to content
/ djs-template Public template

Simple template for your discord.js bot with discord.js Guide explanations.

Notifications You must be signed in to change notification settings

DevVali/djs-template

Repository files navigation

discord.js v14 template

A simple template for your discord.js bot with discord.js Guide explanations.

Features

  • Slash commands support
  • Status and activity configuration
  • Command handler
  • Event handler
  • Components handler
  • Working with databases (sequelize, keyv)
  • Working with APIs (undici)
  • Logging interactions and errors
  • Using modern ES6 syntax

Installation

To install this repository properly, run this in your command-line interface.

git clone https://github.com/DevVali/djs14-template.git

After cloning the repository, you can install all required packages.

npm i

Tip: If you want to install only the packages of your choice, continue reading.

Packages

All packages are installed by default, but you may not need some packages (e.g. you will not be working with databases).

discord.js

A package to interact with the Discord API. Required to run the bot properly.

npm i discord.js

keyv

Simple key-value storage that allows you to work with databases.

npm i keyv

Additionally, install @keyv/sqlite (we used SQLite in this template).

npm i @keyv/sqlite

eslint

ESLint is a tool for identifying and reporting on patterns found in ECMAScript/JavaScript code.

npm i --save-dev eslint

Additionally, install the appropriate plugin(s) for your editor of choice.

sequelize

Sequelize is an object-relational-mapper that allows you to work with databases.

npm i sequelize sqlite3

undici

An excellent library for making HTTP requests.

npm i undici

Editor plugins

Jump to

Examples and explanations from the discord.js Guide.

Commands

Components

Starting the bot

Tip: Don't forget to edit the config.json file with your bot's configuration.

Before getting into the process of starting your discord.js bot, you will have to register your commands to Discord.

node deploy-commands.js

Refresh your Discord client and if you see your bot's commands, you're good to go!

Let's start your bot.

node index.js

If you see "Ready!" after a few seconds, congratulations on starting your discord.js bot. 🎉

Initializing database (sequelize)

node dbInit.sequelize.js

Contributing

This project was made as a help for programmers learning discord.js on providing them some examples how discord.js code should look like. If you found that we are missing a resource, feel free to add one by yourself and open a PR. 💖 If you decide to do so, don't forget to use the recommended editor plugins.

About

Simple template for your discord.js bot with discord.js Guide explanations.

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published