A sophisticated IRC quiz bot powered by Mistral AI that delivers engaging trivia games with dynamic question generation and rich features.
Join us on MansionNET IRC to chat with us, test the bot, and play some trivia!
- Server: irc.inthemansion.com
- Port: 6697 (SSL)
- Channel: #opers, #general, #welcome, #devs (and many others)
- AI-Powered Questions: Uses Mistral AI to generate unique, engaging questions across multiple categories
- Dynamic Game System: Run multiple concurrent quiz games in different IRC channels
- Smart Scoring: Points system based on answer speed and winning streaks
- Rich Categories: Questions from various domains including geography, history, science, arts, entertainment, sports, and more
- Player Statistics: Track player performance, streaks, and maintain leaderboards
- Fallback System: Built-in backup questions ensure continuous operation even if AI service is unavailable
- Python 3.10 or higher
- SQLite3
- Mistral AI API key
- IRC server access
- Clone the repository:
git clone https://github.com/mansionNET/QuizBot.git
cd quizbot_mansionnet
- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # On Windows use: venv\Scripts\activate
- Install dependencies:
pip install -r requirements.txt
- Copy the example environment file:
cp .env.example .env
- Edit
.env
with your configuration:
MISTRAL_API_KEY=your_api_key_here
IRC_SERVER=irc.inthemansion.com
IRC_PORT=6697
IRC_NICKNAME=QuizBot
IRC_CHANNELS=#yourchannel
ADMIN_USERS=admin1,admin2
QUESTIONS_PER_GAME=10
QUESTION_TIMEOUT=30
MIN_QUESTIONS=20
Start the bot:
python src/main.py
!quiz
- Start a new quiz game!help
- Show available commands!stats
- Display your game statistics!leaderboard
- Show top players!stop
- Stop the current game (admin only)
- Each game consists of a configurable number of questions (default: 10)
- Players have a limited time to answer each question (default: 30 seconds)
- Points are awarded based on:
- Speed of answer (faster = more points)
- Answer streak (consecutive correct answers multiply points)
- Only the first correct answer for each question counts
- Multiple answer formats are accepted for flexibility
Key configuration options in .env
:
QUESTIONS_PER_GAME
: Number of questions per game sessionQUESTION_TIMEOUT
: Seconds allowed for answering each questionMIN_QUESTIONS
: Minimum questions to keep in databaseBASE_POINTS
: Base points for correct answersSPEED_MULTIPLIER_MAX
: Maximum multiplier for quick answers
- Geography
- History
- Science
- Arts
- Entertainment
- Sports
- Food & Drink
- Nature
- IRC Service: Handles IRC connection and message routing
- Game Manager: Manages game states and player interactions
- Question Service: Generates and manages questions using Mistral AI
- Database: SQLite storage for questions and player statistics
- Utilities: Answer validation, scoring, and text processing
quizbot_mansionnet/
โโโ src/
โ โโโ models/ # Data models
โ โ โโโ __init__.py
โ โ โโโ database.py # Database connection and queries
โ โ โโโ question.py # Question management
โ โ โโโ quiz_state.py # Quiz game state handling
โ โโโ services/ # Core services
โ โ โโโ __init__.py
โ โ โโโ irc_service.py # IRC connection handling
โ โ โโโ mistral_service.py # AI question generation
โ โ โโโ question_service.py # Question management service
โ โโโ utils/ # Utility functions
โ โ โโโ __init__.py
โ โ โโโ answer_normalizer.py # Answer validation
โ โ โโโ scoring.py # Points calculation
โ โ โโโ text_processing.py # Text manipulation utilities
โ โ โโโ validators.py # Input validation
โ โโโ __init__.py
โ โโโ bot.py # Main bot class
โ โโโ config.py # Configuration handling
โ โโโ game_manager.py # Game state management
โ โโโ main.py # Entry point
โโโ .env # Environment configuration
โโโ requirements.txt # Python dependencies
โโโ setup.py # Package setup
- Fork the repository
- Create a feature branch
- Add your changes
- Write/update tests
- Submit a pull request
This project is licensed under the MIT License - see the LICENSE file for details.
Contributions are welcome! Please feel free to submit a Pull Request.
- Mistral AI for the question generation capabilities
- IRC community for testing and feedback
- All contributors and users
For support, please:
- Check existing issues
- Create a new issue with detailed description
- Join our IRC channel for direct help