A comprehensive Discord bot implementing a full-featured RPG game system with automated progression, complex character systems, AI-generated events, and extensive player interactions.
- Dynamic AI Events: OpenAI-generated unique events every 15 minutes with custom narratives and themed items
- Living Game Manual: AI Oracle that answers questions about the game using real-time data
- Smart Fallbacks: Graceful degradation when AI services are unavailable
- Automated Progression: Players progress while online through adventures, battles, and events
- Complex Character System: 6-tier class evolution paths with 42+ unique classes
- 10 Unique Races: Each with distinct bonuses and playstyles
- Advanced Equipment: 16+ weapon types, 5 armor slots, complex stat system
- Epic & Legendary Adventures: High-tier parallel adventure system (4-24 hours)
- Religion System: 5 gods with unique bonuses and blessing systems
- Economy: Global marketplace, direct trading, daily shops
- Social Features: Guilds, marriages, PvP tournaments
- Gambling: Multiple casino games with luck-based mechanics
- Multiple Game Loops: Adventures (7-21min), Battles (2-8min), Raids (35min), AI Events (15min)
- Smart Player Selection: Automatic online player detection and participation
- Dynamic Rewards: Race, religion, and blessing multipliers
- Progression Tracking: Automatic level-ups, stat increases, and notifications
- Python 3.8+
- Discord Application with Bot Token
- SQLite3
- Optional: OpenAI API Key (for AI features)
-
Clone the repository
git clone https://github.com/yourusername/discordrpg.git cd discordrpg -
Install dependencies
pip install -r requirements.txt
-
Configure environment
cp .env.example .env # Edit .env with your Discord bot token and optionally OpenAI API key -
Initialize database
python3 update_database.py
-
Start the bot
python3 start.py
-
Create a Discord Application at https://discord.com/developers/applications
-
Create a Bot and copy the token to your
.envfile -
Enable the following Bot Permissions:
- Send Messages
- Use Slash Commands
- Embed Links
- Read Message History
- Add Reactions
- Manage Messages (for pagination)
-
Invite to your server with OAuth2 URL generator
For AI-powered events and the Oracle system:
- Get an OpenAI API key from https://platform.openai.com/
- Set
OPENAI_ENABLED=truein your.envfile - Add your API key as
OPENAI_API_KEY=your_key_here
Without OpenAI, the bot will use fallback templates for events.
- Join a Discord server with the bot
- Type
!create [name]to create your character - Stay online (green status) to automatically participate in adventures and battles
- Use
!helpto see all available commands
!profile- View your character stats and progress!inventory- Manage your equipment and items!classes- View class evolution paths!evolve- Evolve your class at levels 5, 10, 15, 20, 25, 30!market- Buy and sell items with other players!epicstatus- Check your epic adventure progress!ask [question]- Ask the AI Oracle about the game (if enabled)
- Automatic Adventures: Every 7-21 minutes while online
- Battles: Random PvP battles every 2-8 minutes
- Epic Adventures: High-tier adventures every 45 minutes (level 10+)
- AI Events: Unique events every 15 minutes (if OpenAI enabled)
- Raids: Group content every 35 minutes
discordrpg/
โโโ bot.py # Main bot class and startup
โโโ start.py # Entry point
โโโ schema.sql # Database schema
โโโ requirements.txt # Python dependencies
โโโ classes/
โ โโโ character.py # Character classes and races
โ โโโ items.py # Item generation and management
โโโ cogs/
โ โโโ ai_events.py # AI-powered dynamic events
โ โโโ oracle.py # AI game manual system
โ โโโ character.py # Character management
โ โโโ combat.py # PvP and battle systems
โ โโโ economy.py # Market and trading
โ โโโ epic_adventures.py # High-tier adventures
โ โโโ autoplay.py # Automatic gameplay loops
โ โโโ raids.py # Group raid system
โ โโโ religion.py # Gods and blessings
โ โโโ race.py # Character races
โ โโโ ... # Additional game systems
โโโ utils/
โโโ database.py # Database abstraction layer
- Uses OpenAI GPT-4o-mini to generate unique events
- Creates thematic item names and narratives
- Handles 4 event types: Treasure, Mini Boss, World Event, Mystery
- Graceful fallback to hand-crafted templates
- 6 tiers of progression (Novice โ Immortal)
- 7 distinct class paths with branching specializations
- All paths converge at Eternal (level 25) then Immortal (level 30)
- Dynamic stat bonuses based on class and tier
- SQLite with proper normalization
- Transaction safety for concurrent operations
- Automatic backups and migration system
- Optimized queries with proper indexing
See .env.example for all available configuration options.
- XP Formula:
level = 1 + int((xp / 100) ** 0.5) - Item Stats: 1-50 total stats based on tier and rarity
- Success Rates: Modified by equipment, level, and luck
- Rewards: Scaled by race bonuses and divine blessings
- Model: GPT-4o-mini (cost-effective for frequent events)
- Rate Limiting: Handled with fallbacks
- Content Moderation: Family-friendly prompts and validation
- Comprehensive logging with rotation
- Error tracking and performance monitoring
- Event and reward logging for balance analysis
!aieventsstatus- Check AI events system status- Database backup and restoration tools
- Performance monitoring and statistics
- Fork the repository
- Create a feature branch
- Make your changes
- Add tests if applicable
- Submit a pull request
- Follow existing patterns and conventions
- Add docstrings to new functions
- Keep AI prompts family-friendly
- Test with both AI enabled and disabled
- New game systems should follow the cog pattern
- Database changes require migration scripts
- AI features should have fallback implementations
- Document new commands in help system
This project is licensed under the MIT License - see the LICENSE file for details.
- OpenAI - For AI-powered event generation and Oracle system
- Discord.py - For the excellent Discord bot framework
- SQLite - For reliable local database storage
- Create an issue for bug reports or feature requests
- Check existing issues before creating new ones
- Provide detailed information about your setup and the problem
Enjoy your AI-powered Discord RPG adventure! ๐ฒโจ