Truth and Truth is a fun and interactive Discord bot that engages users by randomly generating truth or dare questions. It scrapes popular websites for fresh questions and offers a comprehensive caching system for optimal performance. Whether you're looking for lighthearted conversation or trying to spice up a game night, this bot is the perfect companion for your Discord server.
- 🌐 Web Scraping: Automatically scrapes questions from multiple popular websites
- 🎯 Multiple Categories: Truth questions, dare challenges, and "Would You Rather" questions
- ⚡ Intelligent Caching: Caches questions for faster responses and reduced server load
- 🔄 Fallback System: Uses curated fallback questions if web scraping fails
- 🎨 Beautiful Embeds: Rich Discord embeds with colors and formatting
- 📊 Statistics: Track bot performance and cache status
- 🛡️ Error Handling: Robust error handling and user-friendly messages
| Command | Description |
|---|---|
!truth |
Get a random truth question |
!dare |
Get a random dare challenge |
!would_you_rather |
Get a random "Would You Rather" question |
!random |
Get a random question of any type |
!stats |
Show bot statistics and cache status |
!refresh |
Refresh the question cache |
!info |
Show help information |
- Python 3.8 or higher
- A Discord bot token
git clone <repository-url>
cd Truth-Truthpip install -r requirements.txt- Go to Discord Developer Portal
- Click "New Application" and give it a name
- Go to the "Bot" section
- Click "Add Bot"
- Copy the bot token
- Copy the example environment file:
cp .env.example .env
- Edit
.envand add your Discord bot token:DISCORD_TOKEN=your_discord_bot_token_here
- Go to the "OAuth2" section in your Discord application
- Select "bot" under scopes
- Select the following permissions:
- Send Messages
- Embed Links
- Read Message History
- Use Slash Commands
- Copy the generated URL and open it in your browser to invite the bot
python bot.pyThe bot can be customized by editing config.py:
- Question Sources: Add or modify websites to scrape from
- Cache Duration: Change how long questions are cached
- Embed Colors: Customize the appearance of Discord embeds
- Filter Words: Modify words to filter out during scraping
Truth-Truth/
├── bot.py # Main bot file
├── scraper.py # Web scraping functionality
├── config.py # Configuration settings
├── requirements.txt # Python dependencies
├── .env.example # Environment variables template
├── .env # Your environment variables (create this)
└── README.md # This file
- Web Scraping: The bot uses BeautifulSoup to scrape questions from multiple websites
- Question Validation: Scraped text is validated to ensure it's actually a question
- Caching: Questions are cached for 1 hour to improve performance
- Fallback System: If scraping fails, the bot uses curated fallback questions
- Random Selection: Questions are randomly selected from the available pool
The bot includes comprehensive error handling:
- Network timeouts and connection errors
- Invalid HTML responses
- Missing or malformed data
- Rate limiting protection
- Graceful fallback to cached or default questions
- Async/Await: Non-blocking operations for better performance
- Connection Pooling: Reuses HTTP connections
- Intelligent Caching: Reduces server load and improves response times
- Timeout Protection: Prevents hanging on slow websites
- Fork the repository
- Create a feature branch
- Make your changes
- Test thoroughly
- Submit a pull request
This project is open source and available under the MIT License.
If you encounter any issues:
- Check the console output for error messages
- Ensure your bot token is correct
- Verify the bot has the necessary permissions
- Check your internet connection for web scraping
The Truth and Truth bot is designed to bring fun and entertainment to your Discord server. Use it responsibly and enjoy your conversations!