Production-ready Discord.js v14 bot handler with slash commands, event system, and modular architecture
โก Quick Start โข ๐ฏ Commands โข โ Add Commands โข ๐ค Contribute
- ๐ฎ Latest Discord.js v14.14.1 - Built with the most recent Discord API features
- ๐งฉ Modular Architecture - Clean separation of commands and events
- โก Slash Commands Ready - Native support for Discord's slash commands
- ๐๏ธ Prefix Commands - Traditional command support for backward compatibility
- ๐ก๏ธ Production-Ready - Robust error handling and logging
- ๐ฆ Lightweight - Minimal dependencies with maximum performance
- ๐ฅ Hot Reloading - Easy command and event development
- ๐งฐ Developer-Friendly - Simple API for creating new features
- Discord.js - Discord API library
- Node.js - JavaScript runtime
- dotenv - Environment management
- Node.js 18.0.0 or higher
- npm 7.0.0 or higher
- A Discord bot token (Get one here)
# Clone the repository
git clone https://github.com/IN3PIRE/discord-js-handler.git
cd discord-js-handler
# Install dependencies
npm install
# Configure environment
cp .env.example .env
# Edit .env with your favorite editor and add your tokens
nano .env
# Deploy slash commands (required)
npm run deploy
# Start the bot
npm start| Variable | Description | Required |
|---|---|---|
DISCORD_TOKEN |
Your bot token from Discord Developer Portal | โ Yes |
CLIENT_ID |
Your Discord application ID | โ Yes |
GUILD_ID |
Test guild ID (optional, for guild-specific commands) | โ No |
| Command | Description |
|---|---|
/ping |
Check bot latency and API response time |
/server |
Display detailed server information |
/user |
Show basic user information |
/userinfo |
Display comprehensive user statistics |
/uptime |
Show how long the bot has been running |
| Command | Description |
|---|---|
!help |
Display available commands and usage |
!info |
Show bot information and statistics |
!time |
Display current server time |
Create a new file in src/slashcommands/:
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('commandname')
.setDescription('Description of what this command does'),
async execute(interaction) {
// Your command logic here
await interaction.reply('Command executed successfully!');
},
};Create a new file in src/prefixcommands/:
module.exports = {
name: 'commandname',
description: 'Description of what this command does',
execute(message, args) {
// Your command logic here
message.reply('Command executed successfully!');
},
};Create a new file in src/events/:
module.exports = {
name: 'eventName', // Event name from Discord.js
once: false, // true = execute once, false = execute on every event
execute(...args) {
// Your event logic here
console.log('Event triggered:', this.name);
},
};# Deploy slash commands globally
npm run deploy
# Start the bot in production
npm start
# Start with auto-restart on file changes (requires nodemon)
npm run dev
# Install dependencies
npm installdiscord-js-handler/
โโโ src/
โ โโโ events/ # Event handlers
โ โโโ prefixcommands/ # Prefix-based commands
โ โโโ slashcommands/ # Slash commands
โ โโโ deploy-commands.js # Command deployment script
โ โโโ index.js # Main bot file
โโโ .env.example # Environment template
โโโ .gitignore # Git ignore rules
โโโ package.json # Dependencies and scripts
โโโ README.md # Documentation
We love your input! We want to make contributing as easy and transparent as possible. Please read our detailed Contributing Guide for the full process.
- โญ Star the repo (top-right corner) - Required for PR merge
- Find an issue: Look for
good first issueorhelp wantedlabels - Comment: Say "I would like to work on this" on the issue
- Wait for assignment: Don't start until officially assigned
- Fork & create branch:
git checkout -b feature/amazing-feature - Submit PR: Follow our contribution guidelines
good first issue- Perfect for newcomershelp wanted- Extra attention neededbug- Something isn't workingenhancement- New feature or improvementdocumentation- Docs need updating
Why the star requirement?
- โจ Shows support for the project
- ๐ค Verifies human contributors
- ๐ซ Makes you part of our community
This project is licensed under the MIT License - see the LICENSE file for details.
If you like this project, please give it a โญ star!
Made with โค๏ธ by the IN3PIRE Team