A powerful, feature-rich Discord bot with music, economy, moderation, and more!
- High-quality music playback with YouTube integration
- Queue management with playlist support
- Advanced controls (pause, resume, skip, stop)
- Voice channel management
- Virtual currency with daily rewards
- Job system with multiple tiers
- Gambling games and coin trading
- Leaderboards and statistics
- XP tracking and level progression
- Customizable level rewards
- Server-wide leaderboards
- Advanced permission system
- Server setup automation
- Giveaway management
- Staff help commands
- Interactive games (TicTacToe, Connect4, RPS)
- Fun commands and utilities
- Math calculator and dice rolling
- Support ticket creation and management
- Application system
- User access control
Node.js 16.9+ is required.
node --version
# Should be 16.9.0 or higher-
Clone the Repository
git clone https://github.com/muneebwanee/AlphaBot.git cd AlphaBot -
Recommended: Manual Installation Install dependencies manually first, then start the bot with auto-install disabled.
npm install node index.js --no-install
-
Alternative: Auto-Install Let the bot handle dependency installation automatically.
node index.js --show-install-output
The bot uses these key packages:
{
"discord.js": "^13.1.0",
"better-sqlite3": "^7.4.3",
"mysql": "^2.18.1",
"@discordjs/voice": "^0.6.0",
"ytdl-core": "^4.9.1",
"yt-search": "^2.10.1",
"ffmpeg-static": "^4.4.0",
"chalk": "^4.1.2",
"yaml": "^1.10.2"
}-
Create Configuration File Create a
config.ymlfile in the root directory.# Main Bot Configuration Token: "YOUR_BOT_TOKEN_HERE" Prefix: "!" YouTubeAPIKey: "YOUR_YOUTUBE_API_KEY" # Database Configuration Database: Type: "sqlite" # or "mysql" # For MySQL (optional) MySQL: Host: "localhost" User: "root" Password: "password" Database: "alphabot" # Embed Colors EmbedColors: Success: "#00ff00" Error: "#ff0000" Info: "#0099ff" # Leaderboard Settings Leaderboards: UsersPerPage: Levels: 10 FilterUnknown: true
-
Database Setup The bot automatically creates the required database tables upon the first run.
-- Auto-generated tables include: CREATE TABLE IF NOT EXISTS users (user TEXT, guild TEXT, coins INTEGER, xp INTEGER, level INTEGER); CREATE TABLE IF NOT EXISTS guilds (guild TEXT, prefix TEXT); CREATE TABLE IF NOT EXISTS giveaways (messageID TEXT, name TEXT, channel TEXT, guild TEXT, ended BOOLEAN, end INTEGER, winners INTEGER, creator TEXT, description TEXT); CREATE TABLE IF NOT EXISTS modules (name TEXT, enabled BOOLEAN); CREATE TABLE IF NOT EXISTS commands (name TEXT, enabled BOOLEAN); CREATE TABLE IF NOT EXISTS tickets (channelID TEXT, userID TEXT, guildID TEXT, reason TEXT); CREATE TABLE IF NOT EXISTS game_data (user TEXT, guild TEXT, data TEXT);
-
Discord Bot Setup
- Go to the Discord Developer Portal.
- Create a new application.
- Go to the "Bot" section and click "Add Bot".
- Copy the bot's token and paste it into your
config.yml. - Enable the required Privileged Gateway Intents:
- ✅ Server Members Intent
- ✅ Message Content Intent
- ✅ Presence Intent
!play <song name>: Play a song.!queue: View the current queue.!skip: Skip the current song.!pause: Pause playback.!resume: Resume playback.!stop: Stop music and clear the queue.
!coins: Check your balance.!daily: Claim your daily reward.!work: Work at your job.!pay <@user> <amount>: Send coins to a user.!slots <bet>: Play the slot machine.!coinflip <heads/tails> <bet>: Flip a coin with a bet.
!level: Check your level.!level <@user>: Check another user's level.!leveltop: View the level leaderboard.!leveltop <page>: View a specific page of the leaderboard.
!gcreate: Start the interactive giveaway setup.!gstop <giveaway name>: Stop a giveaway.!greroll <giveaway name>: Reroll a giveaway winner.!gdelete <giveaway name>: Delete a giveaway.
!setup: Automatically set up server roles and channels.!setprefix <new prefix>: Change the bot's prefix.!staffhelp: View the list of staff-only commands.!module enable music: Enable the music module.!command disable eval: Disable theevalcommand.
!tictactoe <@user>: Play TicTacToe.!connect4 <@user>: Play Connect 4.!rps <rock/paper/scissors>: Play Rock Paper Scissors.!8ball <question>: Ask the Magic 8-Ball a question.!math <expression>: Solve a math problem.!rolldice: Roll a dice.
AlphaBot/
├── 📁 addons/
│ └── 🎵 music.js # Music system
├── 📁 commands/
│ ├── 📁 coins/ # Economy commands
│ ├── 📁 entertainment/ # Games and fun commands
│ ├── 📁 exp/ # Experience commands
│ ├── 📁 general/ # General utility commands
│ ├── 📁 giveaways/ # Giveaway system
│ ├── 📁 info/ # Information commands
│ ├── 📁 management/ # Admin commands
│ ├── 📁 minecraft/ # Minecraft integration
│ ├── 📁 staff/ # Staff utilities
│ └── 📁 tickets/ # Ticket system
├── 📁 modules/
│ ├── 🗄️ database.js # Database abstraction layer
│ ├── 📁 handlers/ # Event & command handlers
│ ├── 📁 methods/ # Utility methods
│ └── 🎨 embed.js # Embed generator
├── ⚙️ config.yml # Main configuration
├── 🌐 lang.yml # Language strings (1500+ lines)
├── 📋 commands.yml # Command definitions & permissions
├── 🎨 embeds.yml # Embed templates
├── 🌐 TLDs.yml # Domain validation list
└── 📦 package.json # Project dependencies
The bot uses a unified database abstraction layer supporting both SQLite and MySQL.
// Example Database Access Patterns
const coins = await Utils.variables.db.get.getCoins(member);
const xp = await Utils.variables.db.get.getExperience(member);
await Utils.variables.db.update.coins.updateCoins(member, amount, 'add');
await Utils.variables.db.update.giveaways.addGiveaway(giveawayData);// Command Handler Initialization
const CommandHandler = require('./modules/handlers/CommandHandler').init();
// Event Handler Initialization
const EventHandler =require('./modules/handlers/EventHandler').init(bot);Enable or disable entire feature sets for your server.
!module list: List all available modules.!module enable music: Enable the music module.!module disable coins: Disable the economy module.!module giveaways: Check the status of the giveaway module.
Control individual commands.
!command list: List all commands.!command eval disable: Disable theevalcommand (recommended).!command setup enable: Enable thesetupcommand.
Configure command permissions in commands.yml.
Permissions:
eval:
- "OWNER_ID_HERE" # Restrict dangerous commands
setup:
- "ADMIN_ROLE_ID" # Admin-only commands
staffhelp:
- "STAFF_ROLE_ID" # Staff commandsCustomize all bot messages in lang.yml.
GiveawaySystem:
Commands:
Gcreate:
Embeds:
Setup:
Questions:
- "How long would you like the giveaway to be?"
- "What do you want to giveaway?"
- "Please explain the item you are giving away."
- "How many winners will there be?"
CoinsModule:
Commands:
Daily:
Title: "💰 Daily Coins"
Description: "You have claimed your daily **{amount}** coins!"- Disable
evalcommand immediately:!command eval disable - Never share your bot token.
- Restrict admin commands to trusted users only using
commands.yml. - Perform regular backups of your database (
database.dbfor SQLite). - Monitor bot logs (
errors.txt,console.log) for suspicious activity.
Use a process manager like PM2 for better stability and management.
# Start with PM2
pm2 start index.js --name "AlphaBot" -- --no-installFor advanced users, you can modify the bot to use a .env file with dotenv.
DISCORD_TOKEN=your_bot_token_here
YOUTUBE_API_KEY=your_youtube_api_key
DATABASE_TYPE=sqlite
PREFIX=!
-
Bot won't start:
- Check Node.js version (
node -vmust be 16.9+). - Delete
node_modulesandpackage-lock.json, then reinstall withnpm install. - Start with debug output:
node index.js --show-install-output
- Check Node.js version (
-
Music not working:
- Ensure audio dependencies are installed:
npm install @discordjs/opus ffmpeg-static - For Linux, you may need to install
ffmpegsystem-wide:sudo apt-get install ffmpeg
- Ensure audio dependencies are installed:
-
Database errors:
- For SQLite, ensure
better-sqlite3is installed:npm install better-sqlite3. - For MySQL, ensure
mysqlis installed:npm install mysql. - Check file permissions for
database.dbif using SQLite.
- For SQLite, ensure
-
Permission errors:
- Ensure the bot has the necessary permissions in your Discord server settings (Role > Bot Role).
- Required permissions include:
- Send Messages
- Embed Links
- Add Reactions
- Connect (for music)
- Speak (for music)
- Manage Messages (for giveaways)
The bot creates several log files in the root directory:
errors.txt: Detailed error logs.console.log: General logs and bot activity (if configured).database.db: The SQLite database file.
!botinfo: Check the bot's status and uptime.!module list: Check the status of all modules.!command list: Check the status of all commands.!stats: View bot and database statistics (if implemented).
- Weekly: Check
errors.txtfor recurring issues. - Monthly: Update dependencies with
npm update. - Quarterly: Clean up the database by removing old, inactive entries.
- As needed: Apply security updates and patch bugs.
-- Database optimization (SQLite)
PRAGMA optimize;
VACUUM;
-- Example: Clear old giveaway data from the database
DELETE FROM giveaways WHERE ended = 1 AND end < (strftime('%s', 'now') - 2592000);- Fork the repository.
- Create a new feature branch:
git checkout -b feature/amazing-feature - Make your changes and test them thoroughly.
- Commit your changes:
git commit -m 'Add amazing feature' - Push to the branch:
git push origin feature/amazing-feature - Open a Pull Request.
- Use 2 spaces for indentation.
- Follow existing naming conventions.
- Add comments for complex logic.
- Update documentation for new features or changes.
This project is licensed under the ISC License - see the LICENSE file for details.
- Discord.js - The amazing Discord API wrapper that powers this bot.
- Node.js - The runtime environment.
- All the creators of the open-source packages used.
- The community for their contributions and support.
GitHub Issues | Website | Support Server
⭐ Star this repo | 🐛 Report a Bug | 💡 Request a Feature
Made with ❤️ by muneebwanee