Protect your Discord community from phishing, crypto scams, and malicious links with intelligent real-time analysis
Features • Quick Start • Installation • Configuration • Usage • AI Providers • Contributing
|
|
# Clone the repository
git clone https://github.com/xtoor/discord-link-guardian.git
cd discord-link-guardian
# Run the interactive installer
sudo chmod +x installer.sh
sudo ./installer.sh
# Follow the prompts to configure your bot# Download and run the installer
wget https://raw.githubusercontent.com/xtoor/discord-link-guardian/main/installer.sh
sudo chmod +x installer.sh
sudo ./installer.shThe installer will:
- ✅ Check system compatibility
- ✅ Install Docker & Docker Compose
- ✅ Configure the bot interactively
- ✅ Build Docker images
- ✅ Test the installation
- ✅ Set up systemd service (optional)
Click to expand manual installation steps
# Update package index
sudo apt update
# Install prerequisites
sudo apt install -y ca-certificates curl gnupg lsb-release
# Add Docker's GPG key
sudo mkdir -p /etc/apt/keyrings
curl -fsSL https://download.docker.com/linux/ubuntu/gpg | sudo gpg --dearmor -o /etc/apt/keyrings/docker.gpg
# Set up repository
echo "deb [arch=$(dpkg --print-architecture) signed-by=/etc/apt/keyrings/docker.gpg] https://download.docker.com/linux/ubuntu $(lsb_release -cs) stable" | sudo tee /etc/apt/sources.list.d/docker.list > /dev/null
# Install Docker
sudo apt update
sudo apt install -y docker-ce docker-ce-cli containerd.io docker-buildx-plugin docker-compose-plugingit clone https://github.com/yourusername/discord-link-guardian.git
cd discord-link-guardian# Copy example environment file
cp .env.example .env
# Edit with your settings
nano .env# Build Docker image
docker build -t discord-link-guardian -f docker/Dockerfile .
# Start the bot
docker-compose -f docker/docker-compose.yml up -dCreate a .env file in the project root:
# Discord Configuration
DISCORD_TOKEN=your_bot_token_here
# AI Provider (choose one)
OPENAI_API_KEY=your_openai_key # For ChatGPT
ANTHROPIC_API_KEY=your_claude_key # For Claude
LOCAL_MODEL=llama2 # For Ollama
# Search API (optional but recommended)
SEARCH_API_KEY=your_serpapi_key # For web reputation checksEdit configs/config.yaml:
bot:
prefix: "!" # Command prefix
status: "Protecting your server" # Bot status message
moderation:
warnings_before_mute: 3 # Warnings before auto-mute
mute_duration_days: 15 # Mute duration in days
warnings_before_ban: 5 # Total warnings before ban
ai:
provider: "openai" # openai, anthropic, or local
model: "gpt-4" # Model to use
security:
threat_thresholds:
safe: 0.2 # Below = safe
suspicious: 0.5 # Below = caution
danger: 0.8 # Above = danger| Command | Description | Permission |
|---|---|---|
!warnings [@user] |
Check warnings for a user | Everyone |
!unmute @user |
Manually unmute a user | Admin |
!linkstats |
View link analysis statistics | Admin |
!config |
View current configuration | Admin |
!test <url> |
Test a URL without action | Admin |
graph LR
A[Link Posted] --> B{Analysis Engine}
B --> C[Domain Check]
B --> D[SSL Validation]
B --> E[AI Analysis]
B --> F[Web Reputation]
C --> G{Threat Level}
D --> G
E --> G
F --> G
G -->|Safe| H[✅ Allow]
G -->|Suspicious| I[⚠️ Warning]
G -->|Danger| J[🚫 Remove & Warn]
J --> K{Warning Count}
K -->|< 3| L[Log Warning]
K -->|= 3| M[🔇 Mute 15 Days]
K -->|> 5| N[🔨 Ban User]
| Level | Score | Action | Description |
|---|---|---|---|
| ✅ Safe | 0.0 - 0.2 | Allow | Link appears legitimate |
| ℹ️ Caution | 0.2 - 0.5 | Info Message | Limited information available |
| 0.5 - 0.8 | Public Warning | Potential threat detected | |
| 🚫 Danger | 0.8 - 1.0 | Remove & Warn | High confidence threat |
ai:
provider: "openai"
model: "gpt-4" # or gpt-3.5-turboai:
provider: "anthropic"
model: "claude-3-opus-20240229"ai:
provider: "local"
model: "llama2" # or mistral, codellama, etc.Setting up Ollama for Local AI
# Install Ollama
curl -fsSL https://ollama.ai/install.sh | sh
# Pull a model
ollama pull llama2
# The installer will handle the rest!discord-link-guardian/
│
├── 🐳 docker/
│ ├── Dockerfile # Container configuration
│ └── docker-compose.yml # Service orchestration
│
├── 🤖 src/
│ ├── bot.py # Main bot logic
│ ├── link_analyzer.py # URL analysis engine
│ ├── ai_analyzer.py # AI integration
│ ├── moderation.py # User moderation system
│ ├── database.py # SQLite database handler
│ └── config.py # Configuration manager
│
├── ⚙️ configs/
│ ├── config.yaml # Bot configuration
│ └── blacklists/ # Domain blacklists
│
├── 📊 data/
│ └── bot.db # SQLite database
│
├── 📝 logs/
│ └── bot.log # Application logs
│
├── 📚 docs/
│ ├── API.md # API documentation
│ └── CONTRIBUTING.md # Contribution guidelines
│
├── 🔧 scripts/
│ ├── installer.sh # Interactive installer
│ └── update.sh # Update script
│
├── 📋 requirements.txt # Python dependencies
├── 🔑 .env.example # Environment template
├── 📜 LICENSE # MIT License
└── 📖 README.md # This file
# Start the bot
docker-compose up -d
# View logs
docker logs -f discord-link-guardian
# Stop the bot
docker-compose down
# Restart the bot
docker-compose restart
# Update and rebuild
git pull
docker-compose build
docker-compose up -d
# View resource usage
docker stats discord-link-guardian# Enable auto-start on boot
sudo systemctl enable discord-link-guardian
# Service management
sudo systemctl start discord-link-guardian
sudo systemctl stop discord-link-guardian
sudo systemctl status discord-link-guardian
# View logs
journalctl -u discord-link-guardian -f
|
|
|
The bot tracks and logs:
- 📌 Total links analyzed
⚠️ Threats detected- 👥 Users warned/muted/banned
- 📈 Detection accuracy
- 🕐 Response times
# View real-time logs
tail -f logs/bot.log
# Search for specific events
grep "THREAT" logs/bot.log
grep "WARNING" logs/bot.log
# View Docker logs
docker logs discord-link-guardian --tail 100 -fWe welcome contributions! Please see our Contributing Guidelines for details.
- Check existing issues
- Create a new issue with:
- Clear description
- Steps to reproduce
- Expected behavior
- Logs/screenshots
Open an issue with the enhancement label!
- Fork the repository
- Create your feature branch (
git checkout -b feature/AmazingFeature) - Commit your changes (
git commit -m 'Add some AmazingFeature') - Push to the branch (
git push origin feature/AmazingFeature) - Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
MIT License
Copyright (c) 2024 Discord Link Guardian
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
SOFTWARE.
- Discord.py - Discord API wrapper
- OpenAI - AI analysis capabilities
- Docker - Containerization platform
- Contributors - Amazing community
Made with ❤️ by the Discord Link Guardian Team
Keeping Discord communities safe, one link at a time