A modern, TypeScript-based Discord bot with optimized architecture and comprehensive features.
- Birthday Management: Automated birthday wishes with custom image generation
- Hacktoberfest Integration: Certificate generation and email distribution
- Role Management: Advanced role assignment and management
- Welcome System: Automated welcome messages for new members
- Health Monitoring: Built-in health check server
- Email Integration: Automated email sending with templates
- Image Generation: Dynamic certificate and birthday image creation
src/
├── core/ # Core bot functionality
├── commands/ # Bot commands
├── services/ # External service integrations
├── types/ # TypeScript type definitions
└── server.ts # Application entry point
- Main bot class with improved architecture
- Dynamic command loading
- Comprehensive error handling
- Permission management
- API Client: External API integration
- Health Server: Express-based health monitoring
- Birthday Command: Birthday message handling
- Hacktoberfest Command: Certificate processing
- Runtime: Node.js 18+
- Language: TypeScript 5.2+
- Framework: Discord.js 14.14+
- HTTP Server: Express 4.18+
- Image Generation: Canvas 2.11+
- Email: Nodemailer 6.9+
- Node.js 18.0.0 or higher
- npm or yarn package manager
-
Clone the repository
git clone <repository-url> cd chacko-mash
-
Install dependencies
npm install
-
Environment Configuration Create a
.envfile in the root directory:NODE_ENV=development PORT=3000 DISCORDJS_BOT_TOKEN=your_discord_bot_token TARGET_CHANNEL=your_target_channel_id LOBBY_CHANNEL=your_lobby_channel_id HF_CHANNEL=your_hacktoberfest_channel_id PRIORITY_ROLE_01=your_priority_role_01_id PRIORITY_ROLE_02=your_priority_role_02_id API_BASE_URL=your_api_base_url INOVUS_AUTH_TOKEN=your_auth_token EMAIL_HOST=your_email_host EMAIL_PORT=587 EMAIL_USER=your_email_user EMAIL_PASS=your_email_password
-
Build the project
npm run build
-
Start the application
npm start
npm run dev- Start development server with hot reloadnpm run build- Build TypeScript to JavaScriptnpm start- Start production servernpm run type-check- TypeScript type checking
-
Start development server
npm run dev
-
Check code quality
npm run type-check
GET /health- Application health statusGET /- Application information
The application uses Winston for structured logging:
- File Logs:
logs/error.logandlogs/combined.log - Console Logs: Development environment only
- Structured Format: JSON with timestamps
- Log Levels: error, warn, info, http, debug
- Environment-based: Debug level in development, warn level in production
| Variable | Description | Required |
|---|---|---|
NODE_ENV |
Application environment | No (default: development) |
PORT |
Health server port | No (default: 3000) |
DISCORDJS_BOT_TOKEN |
Discord bot token | Yes |
TARGET_CHANNEL |
Default target channel ID | Yes |
LOBBY_CHANNEL |
Lobby channel ID | Yes |
HF_CHANNEL |
Hacktoberfest channel ID | Yes |
PRIORITY_ROLE_01 |
Primary priority role ID | Yes |
PRIORITY_ROLE_02 |
Secondary priority role ID | Yes |
API_BASE_URL |
External API base URL | Yes |
INOVUS_AUTH_TOKEN |
API authentication token | Yes |
EMAIL_HOST |
SMTP host | Yes |
EMAIL_PORT |
SMTP port | Yes |
EMAIL_USER |
SMTP username | Yes |
EMAIL_PASS |
SMTP password | Yes |
# Build image
docker build -t chacko-mash .
# Run container
docker run -d \
--name chacko-mash \
-p 3000:3000 \
--env-file .env \
chacko-mash- TypeScript Migration: Full TypeScript support with strict typing
- Modern Dependencies: Updated to latest stable versions
- Improved Architecture: Better separation of concerns
- Enhanced Error Handling: Comprehensive error management
- Structured Logging: Winston-based logging system
- Health Monitoring: Express-based health server
- Code Quality: TypeScript type checking
- Backup existing data
- Update environment variables
- Install new dependencies
- Build and test
- Deploy with new architecture
- Fork the repository
- Create a feature branch
- Make your changes
- Run type checking
- Submit a pull request
This project is licensed under the ISC License.
For support and questions:
- Create an issue in the repository
- Contact the development team
- Check the documentation
Version: 2.0.0
Last Updated: 2024
Maintainer: Decoded_Cipher