DisTrack Discord Bot - Server Management
August 25, 2025 ยท View on GitHub
DisTrack Discord Bot - Server Management
A comprehensive Discord server management bot with admin-only moderation commands and a complete ticketing system.
| Name | Description | Version | Links |
|---|---|---|---|
| VSCode Extension | Discord VSCode Leaderboard Tracker Extension | GitHub, Marketplace | |
| Discord Bot | Discord Bot for tracking coding activity | GitHub, Invite | |
| Discord Manager | Discord bot which manages the Discord server | GitHub | |
| Website | Website for DisTrack | GitHub, Website | |
| Backend Endpoints | API Endpoints for business logic | GitHub | |
| Frontend Endpoints | Bot Crawler Rich Embed logic | GitHub |
๐ Features
๐ Admin-Only Security
- All moderation commands are restricted to users with Administrator permissions
- Slash commands are invisible to non-admin users
- Multiple layers of permission validation
๐ก๏ธ Moderation Commands
/kick- Kick members from the server/timeout- Timeout members with flexible duration (1s - 28d)/remove-timeout- Remove timeout from members/ban- Ban members with optional message deletion/unban- Unban users by ID
๐ซ Advanced Ticketing System
- Interactive ticket creation with category selection
- Multiple ticket categories (Support, Bug Report, Feature Request, Appeals)
- Staff-only ticket management commands
- Automatic channel permissions and organization
- Ticket status tracking (Open, Closed, Archived)
- Database persistence with MongoDB
๐ Management Features
/ticket-panel- Create interactive ticket creation panels/ticket-list- List and filter tickets/ticket-close- Close tickets with logging/ticket-delete- Archive and delete ticket channels/help- Comprehensive help system/ping- Bot status and latency checking
๐๏ธ Architecture
Modular Design
โโโ bot.js # Main bot entry point
โโโ config/
โ โโโ config.js # Centralized configuration
โโโ commands/
โ โโโ moderation/ # Moderation commands
โ โโโ tickets/ # Ticket system commands
โ โโโ general/ # General purpose commands
โโโ events/
โ โโโ EventHandler.js # Event management
โโโ handlers/
โ โโโ TicketHandler.js # Ticket interaction handling
โโโ models/
โ โโโ Ticket.js # Ticket database schema
โ โโโ GuildConfig.js # Guild configuration schema
โโโ utils/
โโโ Utils.js # Utility functions
โโโ CommandLoader.js # Dynamic command loading
โโโ CommandDeployer.js # Slash command deployment
Database Schema
- Tickets: Store ticket information, messages, and status
- Guild Config: Per-server configuration and settings
- MongoDB: Reliable data persistence with automatic reconnection
๐ ๏ธ Setup Instructions
Prerequisites
- Node.js 16.9.0 or higher
- MongoDB database (local or MongoDB Atlas)
- Discord Bot Token and Application ID
Installation
-
Install Dependencies
npm install -
Configure Environment Variables Update
.envfile with your credentials:TOKEN=your_bot_token DISCORD_CLIENT_ID=your_application_id MONGODB_URI=your_mongodb_connection_string OWNER_ID=your_discord_user_id PORT=7070 NODE_ENV=production -
Deploy Slash Commands
# Deploy globally (production) npm run deploy # Deploy to specific guild for testing npm run deploy-guild <guild_id> -
Start the Bot
# Production npm start # Development with auto-restart npm run dev
๐ฏ Usage Guide
For Server Administrators
-
Set Up Ticket System
- Use
/ticket-panelto create a ticket creation interface - Users can click the button to create tickets with category selection
- Use
-
Moderate Your Server
- Use moderation commands with proper reasons for logging
- All actions are logged and can include optional reasoning
-
Manage Tickets
- Use
/ticket-listto see all active tickets - Close tickets with
/ticket-closewhen resolved - Delete old tickets with
/ticket-delete
- Use
For Regular Users
-
Get Help
- Use
/helpto see available commands - Use
/pingto check bot status
- Use
-
Create Support Tickets
- Click "Create Ticket" on the ticket panel
- Select appropriate category and provide details
- Wait for staff response in your private ticket channel
๐ง Configuration
Bot Settings
Edit config/config.js to customize:
- Ticket categories and descriptions
- Timeout duration limits
- Embed colors and emojis
- Maximum tickets per user
Permission Setup
The bot requires these permissions:
- Manage Channels - Create/delete ticket channels
- Manage Messages - Clean up and manage content
- Kick Members - Use kick command
- Ban Members - Use ban/unban commands
- Moderate Members - Use timeout commands
- Send Messages - Basic functionality
- Use Slash Commands - Command system
๐ Command Reference
Moderation Commands (Admin Only)
| Command | Description | Usage |
|---|---|---|
/kick | Kick a member | /kick user:@user reason:optional |
/timeout | Timeout a member | /timeout user:@user duration:10m reason:optional |
/remove-timeout | Remove timeout | /remove-timeout user:@user reason:optional |
/ban | Ban a member | /ban user:@user reason:optional delete_days:0-7 |
/unban | Unban a user | /unban user_id:123456789 reason:optional |
Ticket Commands (Admin Only)
| Command | Description | Usage |
|---|---|---|
/ticket-panel | Create ticket panel | /ticket-panel channel:optional |
/ticket-close | Close current ticket | /ticket-close reason:optional |
/ticket-delete | Delete ticket channel | /ticket-delete reason:optional |
/ticket-list | List tickets | /ticket-list status:optional user:optional |
General Commands (Everyone)
| Command | Description | Usage |
|---|---|---|
/help | Show help information | /help category:optional |
/ping | Check bot status | /ping |
๐ Security Features
- Multi-layer Permission Validation: Commands check permissions at multiple levels
- Admin-Only Visibility: Slash commands only appear for administrators
- Safe Default Settings: Conservative timeout limits and validation
- Audit Logging: All moderation actions are logged with reasons
- Error Handling: Comprehensive error handling prevents crashes
- Input Validation: All user inputs are validated and sanitized
๐ Development
Adding New Commands
- Create command file in appropriate
/commands/subdirectory - Follow the existing command structure with
dataandexecuteproperties - Set
adminOnly: truefor admin-restricted commands - Commands are automatically loaded on bot restart
Database Models
- Extend existing models or create new ones in
/models/ - Use Mongoose schemas for data validation
- Include proper indexing for performance
Error Handling
- All errors are logged with timestamps
- User-friendly error messages are sent as ephemeral replies
- Bot continues running even after command failures
๐ Monitoring
- Console logging with timestamps and levels
- Database connection monitoring
- Memory usage tracking
- Automatic reconnection handling
๐ค Contributing
- Fork the repository
- Create a feature branch
- Follow existing code style and structure
- Test thoroughly with admin and non-admin accounts
- Submit a pull request
๐ License
This project is licensed under the CC0-1.0 License - see the LICENSE file for details.
๐ Support
For support or questions:
- Use the
/helpcommand in Discord - Check the console logs for error messages
- Verify your environment variables and permissions
- Ensure MongoDB connection is working
DisTrack Bot - Professional Discord server management made simple and secure.