A powerful Discord ticket bot with modular architecture, AI-powered support, and comprehensive management features. DCTicket Pro provides professional customer support functionality for Discord servers with advanced AI integration, WHMCS support, and flexible configuration options.
- Interactive Panels: Beautiful ticket creation panels with department-specific buttons
- Multi-Department Support: Tech support, billing, and general inquiries
- Smart Permissions: Automatic permission management for users and staff
- Guest Invitation: Ticket creators and staff can invite additional users to collaborate
- Status Tracking: Open โ Waiting for Staff โ Closed workflow
- Transcript System: Automatic conversation archiving with export functionality
- Google Gemini Integration: Automated responses using cutting-edge AI
- Multimodal Capabilities: Analyze text, images, and documents
- Context-Aware Responses: Department-specific AI prompts
- Smart Handoff: Seamless transition from AI to human support
- Conversation Memory: Maintains context throughout the ticket
- Business Hours: Define operating hours with timezone support
- Holiday System: Configure one-time and recurring holidays
- Smart Notifications: Automated off-hours messages
- Flexible Scheduling: Cron-based schedule configuration
- Service Display: Show customer services directly in tickets
- Status Classification: Active/inactive service categorization
- Control Panel Links: Quick access to service management
- Discord Account Linking: Seamless integration with WHMCS users
- Role-Based Access: Configure staff roles per department
- Category Organization: Automatic channel categorization
- Message Archiving: Complete conversation history
- Staff Reminder System: Automatic notifications for unresponded tickets
- Modular Architecture: Enable/disable features as needed
- Node.js 16.x or higher
- Discord.js v14
- SQLite3
- Google Gemini API Key (for AI features)
- WHMCS instance with API access (optional)
git clone https://github.com/fanyueee/DCTicket-Pro.git
cd DCTicket-Pronpm installCreate a .env file in the root directory:
# Discord Configuration
DISCORD_TOKEN=your-bot-token
CLIENT_ID=your-client-id
GUILD_ID=your-guild-id
# AI Integration (Optional)
GEMINI_API_KEY=your-gemini-api-key
# WHMCS Integration (Optional)
WHMCS_ENABLED=true
WHMCS_API_URL=https://your-whmcs.com/includes/api.php
WHMCS_API_IDENTIFIER=your-api-identifier
WHMCS_API_SECRET=your-api-secret
WHMCS_PANEL_URL=https://your-panel.com
# Timezone
TIMEZONE=Asia/TaipeiEdit src/core/config.js to customize:
- Department names and roles
- AI prompts and behavior
- Service hours and holidays
- Feature toggles
npm run deploynpm startFor development with auto-restart:
npm run devDCTicket/
โโโ src/
โ โโโ core/ # Core functionality
โ โ โโโ bot.js # Main bot class
โ โ โโโ config.js # Configuration
โ โ โโโ database.js # Database management
โ โ โโโ logger.js # Logging system
โ โโโ modules/ # Feature modules
โ โ โโโ ai/ # AI integration
โ โ โโโ service-hours/ # Business hours
โ โ โโโ ticket/ # Ticket system
โ โ โโโ whmcs/ # WHMCS integration
โ โโโ utils/ # Utility functions
โ โโโ index.js # Entry point
โ โโโ deploy-commands.js # Command deployment
โโโ data/ # SQLite database
โโโ logs/ # Application logs
โโโ package.json
The main configuration file is src/core/config.js. Key settings include:
module.exports = {
// Bot settings
botName: 'DCTicket Pro',
timezone: 'Asia/Taipei',
// Ticket departments
departments: {
tech: { name: 'ๆ่กๆฏๆด', emoji: '๐ ๏ธ' },
billing: { name: 'ๅธณๅๅ้ก', emoji: '๐ฐ' },
general: { name: 'ไธ่ฌ่ซฎ่ฉข', emoji: '๐' }
},
// Staff roles (configure these IDs)
staffRoles: {
tech: 'TECH_ROLE_ID',
billing: 'BILLING_ROLE_ID',
general: 'GENERAL_ROLE_ID'
}
};Configure AI behavior in the ai section:
ai: {
enabled: true,
model: 'gemini-2.0-flash',
temperature: 0.7,
maxOutputTokens: 1024
}Set business hours and holidays:
serviceHours: {
enabled: true,
defaultSchedule: '0 9-18 * * 1-5', // Mon-Fri 9AM-6PM
timezone: 'Asia/Taipei'
}/setup- Create a ticket panel in the current channel/close- Close the current ticket/invite [user]- Invite a user to view and participate in current ticket/transfer [department]- Transfer ticket to another department/category create- Create department categories/role set- Configure staff roles
/reminder enable- Enable ticket reminder notifications/reminder disable- Disable ticket reminder notifications/reminder setrole [role]- Set the role to receive reminders/reminder settimeout [minutes]- Set reminder timeout (1-60 minutes)/reminder setmode [mode]- Set reminder mode (once/continuous/limited)/reminder setinterval [seconds]- Set repeat interval (30-600 seconds)/reminder setmaxcount [count]- Set maximum reminder count (1-10)/reminder preference [receive]- Set personal reminder preference/reminder setstaff [user] [receive]- Admin: Set staff reminder preference/reminder status- View current reminder settings/reminder debug- Admin: Debug reminder functionality
/aiprompt view [department]- View current AI prompt/aiprompt edit [department]- Edit department prompt/aiprompt savetofile [department]- Save prompt to file/aiprompt loadfromfile [department]- Load prompt from file/analyze- Analyze ticket conversationAI Analysis- Right-click message for AI analysis (supports text, images, files)
/services [user]- Display user's WHMCS services/hours view- View current service hours/hours set- Configure service hours/hours holiday- Manage holidays
DCTicket uses a modular architecture. Each module can be enabled/disabled independently:
In config.js, set module status:
ai: { enabled: true },
whmcs: { enabled: false },
serviceHours: { enabled: true }Modules follow a standard structure:
module-name/
โโโ index.js # Module entry point
โโโ service.js # Business logic
โโโ repository.js # Data access
โโโ commands/ # Slash commands
โโโ README.md # Documentation
Store complex prompts in files:
src/modules/ai/prompts/
โโโ default.txt
โโโ general/prompt.txt
โโโ billing/prompt.txt
โโโ tech/prompt.txt
- File system prompts
- Database prompts
- Config file defaults
- API keys stored in environment variables
- Permission checks on all commands
- Secure ticket access control
- No logging of sensitive data
- Automatic cleanup of temporary files
Logs are organized by module:
logs/
โโโ combined.log # All logs
โโโ error.log # Error logs only
โโโ ai/ # AI module logs
โโโ whmcs/ # WHMCS module logs
- Support for text message analysis
- Image content recognition and analysis
- Code file review
- Document content understanding
- Automatic conversation context saving
- History preservation during department transfers
- Seamless AI to human conversation handoff
- Duplicate response prevention mechanism
- Automatic Monitoring: Continuously checks for unresponded tickets
- Three Reminder Modes: Once, continuous, or limited count reminders
- Service Hours Integration: Only sends reminders during business hours and non-holiday periods
- Individual Preferences: Staff can choose whether to receive reminders
- Role Management: Automatically manages reminder role assignments
- Real-time Tracking: Starts timing from when tickets are transferred to human staff
- One-time holiday settings
- Recurring holidays (e.g., every Sunday)
- Custom holiday messages
- AI behavior adjustment during holidays
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
For issues and feature requests, please use the GitHub Issues page.
- Ensure all necessary role IDs are correctly configured
- Recommend testing on a test server first
- Carefully read the README files for each module
- Regularly backup database files (
data/directory) - Monitor log files to troubleshoot issues
- Adjust AI temperature parameters based on actual needs
- Set department-specific prompts for different departments
- Check
logs/error.logfor error messages - Confirm all environment variables are correctly set
- Verify the bot has sufficient permissions
- Use
/analyzecommand to diagnose AI behavior - Use
/reminder debugto check reminder system status - Ensure reminder roles are correctly set and exist
- Initial Setup: First use
/reminder setroleto set the reminder role - Enable Feature: Use
/reminder enableto activate the reminder system - Adjust Parameters: Set reminder time and mode as needed
- Staff Management: Have staff use
/reminder preferenceto set personal preferences - Monitor Operation: Use
/reminder statusto check configuration status
- once (Single): Remind only once per ticket, suitable for general use
- continuous (Continuous): Keep reminding until staff responds, suitable for high-priority support
- limited (Limited): Limit the number of reminders, balancing reminder effectiveness with message interference
Made with โค๏ธ for the Discord community