A smart Discord moderation bot powered by Google's Gemini AI that helps keep your server clean by catching toxicity, spam, and hate speech before it becomes a problem.
- ๐ค Smart Detection - Uses Google's Gemini AI to understand context and catch toxic behavior, not just keywords
- โก Instant Response - Catches and removes harmful messages in real-time
- โ๏ธ Fully Customizable - Set your own warning limits and rules that fit your community
- ๐ Transparent Logging - Every action gets logged so moderators can review what happened
- ๐ Fair Warning System - Users get warnings before facing serious consequences
- ๐ Auto-Timeout - Repeat offenders get automatically muted after too many strikes
- ๐ Easy to Track - Clean, organized logs make moderation review simple
The bot watches your server channels and runs messages through Gemini AI to detect problematic content. When something gets flagged, it immediately deletes the message, warns the user, and logs everything for your mod team. After a configurable number of warnings, users get auto-muted to give everyone a breather.
Real example: The bot caught a vulgar word, deleted it, and warned the userโall automatically
- Python 3.8 or newer
- A Discord Bot Token (get one here)
- A Google Gemini API Key (get one here)
- Download the code
git clone https://github.com/yourusername/server-guardian-plus.git
cd server-guardian-plus- Install what it needs
pip install -r requirements.txt-
Add your keys
Create a
.envfile and add:
DISCORD_TOKEN=your_discord_bot_token
GEMINI_API_KEY=your_gemini_api_key-
Tweak the settings (optional)
Open
config.jsonand adjust to your liking:
{
"warning_threshold": 3,
"mute_duration": 600,
"log_channel_id": "your_log_channel_id",
"moderation_enabled": true
}- Fire it up!
python bot.py| Setting | What It Does | Default |
|---|---|---|
warning_threshold |
Warnings before auto-mute kicks in | 3 |
mute_duration |
How long mutes last (in seconds) | 600 (10 min) |
log_channel_id |
Where to send mod logs | - |
moderation_enabled |
Turn auto-mod on/off | true |
toxicity_threshold |
How confident the AI needs to be (0-1) | 0.7 |
| Command | What It Does | Who Can Use It |
|---|---|---|
!warnings @user |
See how many warnings someone has | Moderators |
!clearwarnings @user |
Reset someone's warnings | Admins |
!config |
Check current settings | Admins |
!toggle |
Turn moderation on/off | Admins |
- Python 3.8+ - The backbone of the bot
- discord.py 2.0+ - For Discord integration
- Google Gemini API - The AI brain doing the heavy lifting
- python-dotenv - Keeps your secrets safe
- JSON - Simple data storage (can upgrade to a database later)
server-guardian-plus/
โ
โโโ bot.py # The main bot code
โโโ cogs/
โ โโโ moderation.py # Moderation commands and logic
โ โโโ logging.py # Handles all the logging
โโโ utils/
โ โโโ ai_moderator.py # Gemini API integration
โ โโโ database.py # Tracks warnings and user data
โโโ config.json # Your settings
โโโ requirements.txt # Everything the bot needs to run
โโโ .env.example # Template for your API keys
โโโ README.md # You're reading it!
I'd love your help making this better! Here's how:
- Fork this repo
- Create your feature branch (
git checkout -b feature/CoolNewFeature) - Commit your changes (
git commit -m 'Added something cool') - Push it up (
git push origin feature/CoolNewFeature) - Open a Pull Request and let's chat!
Here's what I'm thinking about adding:
- Support for multiple languages
- Proper database (PostgreSQL or MongoDB)
- Web dashboard with stats and analytics
- Custom word filters you can manage
- User appeal system for false positives
- Image and media moderation
This bot uses AI, which is pretty smart but not perfect. You should still have human moderators review flagged content regularly. Think of this as a helpful assistant, not a replacement for your mod team.
This project is licensed under the MIT License - basically, use it however you want! See the LICENSE file for the legal stuff.
- Discord.py - For making Discord bots actually doable
- Google Gemini - For the AI magic
- Everyone who tested this and gave feedback
Want to chat about the project or have questions?
LinkedIn: www.linkedin.com/in/roshan-kamath-9806b337b
โญ If this helped your server, drop a star! It means a lot and keeps me motivated to improve it.
