Discord.js v14 Template based on Lyxcode's Handler
Features:
- Supports Only Slash Commands
- Custom Handler for Components
- Custom Handler for Pagination Embeds
- Supports Discord Together command.
Logs Everything to the console when starting
Easy to Read
Slash Commands:
- Example Location of command: "./Commands/(category)/command"
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:
- Example Location of subcommand: "./Commands/(category)/(command)/subcommand"
module.exports = {
subCommand: "commandName.subcommandName",
async execute (interaction, client) => {
// Code here
},
};Components:
- Example Location of component: "/Components/(type)/(component)"
- type: Buttons/ SelectMenus/ Modals
- component: file that matches the custom id that you created -Components can be in any folder/sub folder within their respective folders.
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.exampleto.env(THIS FILE CANNOT HAVE ANY SPACES)-
REQUIRED:
- Paste in your
BotToken,AppID,ClientSecretfrom the Discord Developer Portal - Insert your Developer Guild ID for testing purposes in
DevGuild - Insert your own UserID as
BotOwnerID- If this is not done, commands with
ownerOnlywill not function and your project will error and crash.
- If this is not done, commands with
- Insert your mongoose connection string as
Connect, Get your free connection string Here- If you don't know how to get this string, there are videos on this like this one
- Paste in your
-
-
After you have edited and saved the
envfile to your needs, you are ready ready to start the bot!- Install all dependencies with
npm install<< Remember, DO NOT INCLUDE ANY PACKAGE NAMES HERE! - Run the bot with
nodemon. - Customize the project to your liking and enjoy!
- Install all dependencies with
Found any bugs or have any suggestion about the template? Create an issue or pull request!
