Discord.js v14 Template based on Lyxcode's Handler
Features:
Logs Everything to the console when starting
Easy to Read
Slash Commands:
const { SlashCommandBuilder, PermissionsBitField } = require("discord.js");
module.exports = {
ownerOnly: boolean, // whether command can only be used by the bot owner? true or false
developer: boolean, // weather the command is for developer guild or global: true or false
data: new SlashCommandBuilder()
.setName('name') // command name - Must be lowercase!!
.setDescription('description') // command description
.setDefalultMemberPermissions(PermissionsBitField.Flags.<permission>), // member permissions
async execute (interaction, client) => {
// Code here
},
};
SubCommands:
module.exports = {
subCommand: "commandName.subcommandName",
async execute (interaction, client) => {
// Code here
},
};
Components:
module.exports = {
id: "custom_id", // Must be lowercase
async execute (interaction, client) => {
// Code here
},
};
Click Use this template
at the top of this page or fork the repo to your own profile.
Rename .env.example
to .env
(THIS FILE CANNOT HAVE ANY SPACES)
REQUIRED:
Paste in your BotToken
, AppID
, ClientSecret
from the Discord Developer Portal
Insert your Developer Guild ID for testing purposes in DevGuild
Insert your own UserID as BotOwnerID
ownerOnly
will not function and your project will error and crash.Insert your mongoose connection string as Connect
, Get your free connection string Here
After you have edited and saved the env
file to your needs, you are ready ready to start the bot!
npm install
<< Remember, DO NOT INCLUDE ANY PACKAGE NAMES HERE!nodemon
.#
#
Found any bugs or have any suggestion about the template? Create an issue or pull request!