A comprehensive Discord bot built with Node.js and Discord.js v14+ featuring a web-based configuration editor, modular architecture, and extensive feature set.
- Modular Architecture: Easy to extend with new modules and commands
- Web Configuration Editor: User-friendly web interface for bot configuration
- Hot Reload: Configuration changes apply instantly without bot restart
- Multi-Server Support: Independent configuration for each server
- Permission System: Role-based permissions for all features
- Kick, ban, mute, unmute commands
- Message clearing with filters
- Warning system with database storage
- Auto-moderation (spam, caps, links, profanity)
- Configurable cooldowns and permissions
- Message and voice XP tracking
- Level cards with custom designs
- Role rewards for level milestones
- XP boosters and multipliers
- Leaderboards and statistics
- Custom welcome/leave messages
- Welcome cards with user avatars
- Auto-role assignment
- Configurable message variables
- Channel-specific settings
- Multiple ticket panels
- Automatic ticket creation
- Transcript saving
- Auto-close functionality
- Role-based access control
- Interactive polls with buttons/select menus
- Timed polls with automatic closure
- Multiple vote options
- Results tracking and display
- Role-based voting restrictions
- YouTube integration
- Queue management
- Volume control
- DJ role system
- Playlist support
- Voice channel management
- YouTube channel monitoring
- Twitter account tracking
- Twitch stream notifications
- Reddit subreddit monitoring
- Webhook integration
- Custom bot status
- Branding removal
- Starboard system
- Temporary voice channels
- Sticky messages
- Verification system
- Suggestion system
- Birthday tracking
- Emoji management
- Node.js 16.0.0 or higher
- npm or yarn package manager
- Discord Bot Token
- FFmpeg (for music features)
-
Clone the repository
git clone <repository-url> cd discord-bot
-
Install dependencies
npm install
-
Configure the bot
- Copy
env.exampleto.envand fill in the values - Optional: Copy
config.yml.exampletoconfig.yml(the web editor will write it) - Optional security: set
WEB_ADMIN_TOKENto protect the editor API
- Copy
-
Start the bot
npm run full
-
Access the web editor
- Open your browser and go to
http://localhost:3000 - Configure your bot settings through the web interface
- Open your browser and go to
bot:
token: "YOUR_BOT_TOKEN"
prefix: "!"
ownerId: "YOUR_USER_ID"
status: "online"
activity:
type: "WATCHING"
name: "Managing servers"Each module can be enabled/disabled and configured independently:
modules:
moderation:
enabled: true
autoMod:
enabled: true
spamProtection: true
capsFilter: true
linkFilter: false
profanityFilter: false
leveling:
enabled: true
messageXP: 15
voiceXP: 10
levelUpMessage: true
levelUpChannel: null
roleRewards: []
xpBoosters: []The web-based configuration editor provides:
- Side Navigation: Organized by module type
- Live Preview: See changes before applying
- Hot Reload: Instant configuration updates
- Validation: Prevent configuration errors
- Export/Import: Backup and restore settings
- Theme Support: Dark/light mode toggle
- Start everything:
npm run full - Open
http://localhost:3000in your browser - Configure your bot settings
discord-bot/
βββ src/
β βββ commands/ # Slash commands
β βββ events/ # Discord events
β βββ modules/ # Feature modules
β βββ utils/ # Utility functions
β βββ web_editor/ # Web configuration editor
β βββ index.js # Main bot file
βββ config.yml # Bot configuration
βββ package.json # Dependencies
βββ README.md # This file
Create a new file in src/modules/:
class MyModule {
constructor() {
this.name = 'myModule';
this.enabled = false;
}
init(bot) {
this.bot = bot;
this.config = bot.config;
this.database = bot.database;
this.logger = bot.logger;
this.loadConfig();
this.setupEventHandlers();
}
loadConfig() {
const config = this.config.get('modules.myModule');
if (config) {
this.enabled = config.enabled || false;
}
}
onConfigUpdate(config) {
this.config = config;
this.loadConfig();
}
setupEventHandlers() {
// Add event listeners here
}
}
module.exports = MyModule;Add your module to config.yml:
modules:
myModule:
enabled: true
# Add your configuration options hereThe module will be automatically loaded by the bot's module system.
Create a new file in src/commands/:
const { SlashCommandBuilder } = require('discord.js');
module.exports = {
data: new SlashCommandBuilder()
.setName('mycommand')
.setDescription('My command description')
.addStringOption(option =>
option.setName('input')
.setDescription('Input description')
.setRequired(true)),
async execute(interaction, bot) {
const input = interaction.options.getString('input');
await interaction.reply(`You entered: ${input}`);
}
};The bot uses SQLite for data storage with the following tables:
users- User leveling datatickets- Ticket system datapolls- Poll data and voteswarnings- User warningssocial_notifications- Social media settingspremium_guilds- Premium feature datastarboard- Starboard messagessticky_messages- Sticky message datasuggestions- User suggestionsbirthdays- Birthday tracking
The bot uses Discord's permission system:
- Administrator: Full access to all commands
- Moderator Roles: Access to moderation commands
- DJ Roles: Access to music commands
- Custom Roles: Module-specific permissions
npm install -g pm2
pm2 start src/index.js --name discord-bot
pm2 startup
pm2 saveFROM node:16-alpine
WORKDIR /app
COPY package*.json ./
RUN npm install
COPY . .
CMD ["npm", "start"]BOT_TOKEN=your_bot_token
BOT_OWNER_ID=your_user_id
BOT_PREFIX=!
WEB_PORT=3000
WEB_HOST=localhost
WEB_ADMIN_TOKEN= # optional security token
DATABASE_PATH=./data/bot.db-
Bot not responding
- Check bot token in configuration
- Verify bot has necessary permissions
- Check console for error messages
-
Web editor not loading
- Ensure port 3000 is available
- Check firewall settings
- Verify all dependencies are installed
-
Music not playing
- Install FFmpeg
- Check voice channel permissions
- Verify YouTube URL format
-
Database errors
- Check file permissions
- Ensure SQLite is properly installed
- Verify database file location
Check the logs/ directory for detailed error logs:
error.log- Error messagescombined.log- All log messages
// Get configuration value
const value = bot.config.get('modules.leveling.messageXP');
// Set configuration value
bot.config.set('modules.leveling.messageXP', 20);
// Save configuration
bot.config.save();// Execute SQL query
await bot.database.execute('INSERT INTO users (id, guild_id) VALUES (?, ?)', [userId, guildId]);
// Query database
const users = await bot.database.query('SELECT * FROM users WHERE guild_id = ?', [guildId]);// Log messages
bot.logger.info('Information message');
bot.logger.warn('Warning message');
bot.logger.error('Error message');- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
- Create an issue on GitHub
- Join our Discord server
- Check the documentation
- Review existing issues
The bot supports hot reloading for configuration changes. Module updates require a restart:
npm run restart- Memory Usage: ~50-100MB depending on server count
- CPU Usage: Minimal when idle
- Database: SQLite for fast local storage
- Scalability: Supports hundreds of servers
- All user input is sanitized
- SQL injection protection
- Rate limiting on commands
- Permission-based access control
- Secure configuration storage
Built with β€οΈ using Node.js and Discord.js