Skip to content

Smokyy14/discord.js-bot

Folders and files

NameName
Last commit message
Last commit date

Latest commit

Β 

History

3 Commits
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 
Β 

Repository files navigation

πŸ€– Discord.js Bot

A modular Discord bot developed with discord.js v14, designed so anyone can clone it and easily build their own bot with custom commands.

πŸš€ Features

  • βœ… Modular command structure (Slash Commands)
  • βš™οΈ Automatic command loading system

🧰 Requirements

πŸ“¦ Installation

Clone the repository:

git clone https://github.com/Smokyy14/discord.js-bot.git
cd discord.js-bot

Set your variables in the .env file:

DISCORD_TOKEN=your_token_here
CLIENT_ID=your_clientID_here
GUILD_ID=your_guildID_here

Run this to:

npm run start
  1. Install dependencies
  2. Start the program

This will also automatically register the slash commands.

πŸ—‚οΈ Project structure

.
β”œβ”€β”€ commands/            # Folder for your slash commands
β”œβ”€β”€ handlers/
β”‚   └── deploy.js        # 
β”‚   └── loadCommands.js  # Dynamic command loader
β”œβ”€β”€ .env                 # Token and sensitive configurations
β”œβ”€β”€ package.json
└── main.js              # Main entry point of the bot

πŸ› οΈ How to Create a Command

πŸ“ Location

All commands should be in this folder:

/commands/

Each command is a .js file that exports a valid Slash Command object, using the SlashCommandBuilder from discord.js.

🧱 Basic Structure of a Command

// commands/ping.js

const { SlashCommandBuilder } = require('discord.js');

module.exports = {
  data: new SlashCommandBuilder()
    .setName('ping')
    .setDescription('reply with Pong!'),

    async execute(interaction) {
    await interaction.reply('πŸ“ Pong!');
  },
};

🧩 Important Details

data: Defines the name and description of the command. execute: This is the function that is executed when the user uses the command.

The bot already includes a system that automatically detects these files thanks to loadCommands.js. You will need to restart the bot to be able to register slash commands.

πŸ”„ Command not appearing?

Make sure:

The file is in /commands/ The bot has the correct application permissions Handlers/deploy.js was successfully executed on startup

🀝 Contributions

Contributions are welcome! You can submit issues, suggestions, or pull requests.

πŸ“„ License

This project is under the ISC license. Use, modify, and distribute it as you wish.

🌐 Credits

Created by Smoky with πŸ’™ for the Discord community.

About

A simple Discord bot built with Discord.js

Topics

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published