Skip to content

Discord-Robots/Discord.js-v14-Template

Repository files navigation

Discord.js-v14-Template

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

Imgur

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
  },
};

Getting Started

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
        • If this is not done, commands with ownerOnly will not function and your project will error and crash.
      • 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
  • After you have edited and saved the env file 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!

Found any bugs or have any suggestion about the template? Create an issue or pull request!

About

Discord.js v14 Template based on Lyxcode's Handler

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published