A modular Discord bot built with Python and discord.py, featuring AI integrations and real-time Text-to-Speech (TTS) capabilities. This project showcases API integration, voice channel automation, modular architecture using Cogs, and scalable bot design.
- Integrated with OpenRouter API
- Supports free and experimental models
- Easy model switching
- Structured response handling
- Text-to-image generation powered by Stable Horde API
- Compatible with Stable Diffusion-based models
- Free tier available
- Automatically joins voice channels
- Spanish Text-to-Speech (configurable in
tts.py) - User control lock system (owner-based control)
- Automatic reading of assigned user's messages
- Manual disconnect command
- Audio playback powered by FFmpeg
- Modular Cog-based structure for organized code
- Dedicated
commands/folder - Global error handling
- Environment variable management via
.env - Designed for scalability and future expansion
This project is built for educational and experimental purposes. Keep in mind that free AI APIs may have usage limits or may not always generate expected results.
I hope to make future improvements, but for now, this is my bot. :)
If you want to invite it to your discord channel just to test how it works here is the link, is not running 24/7 yet due to I have it running on local but I have it running most of the time.
-
Create a Discord Application
- Go to the Discord Developer Portal
- Create a new application and add a bot
- Generate your bot token from the Bot section
- Invite the bot to your server using the OAuth2 URL Generator with admin permissions
- Save your token for the
.envfile
-
Install FFmpeg (required for voice/TTS)
- Windows: Download from ffmpeg.org
- macOS:
brew install ffmpeg - Linux:
sudo apt install ffmpeg
git clone https://github.com/yourusername/your-repo-name.git
cd your-repo-nameCreate a file named .env in the root directory with the following content:
DISCORD_TOKEN=your_discord_bot_token
OPENROUTER_API_KEY=your_openrouter_api_key
STABLE_HORDE_API_KEY=your_stable_horde_api_key # optionalpip install -r requirements.txtpython bot.pyOr if you're using VS Code, simply press the Run button in the top right corner.
Once the bot is running and invited to your server, you can use the following commands:
- AI Chat: Interact with AI models through chat commands
- Image Generation: Generate images from text prompts
- Voice Commands: Join voice channels and use TTS features
For a full list of commands, check the commands/ folder or use the help command in Discord.
Have ideas for improvements? Feel free to:
- Open an issue
- Submit a pull request
- Share your suggestions!
This project is open source and available for educational purposes.
- discord.py - Discord API wrapper
- OpenRouter - AI model access
- Stable Horde - Image generation API
Made with ❤️ for learning and experimentation