Installation & Setup
This guide covers everything you need to install and configure PFP Checker, from development environments to production deployments.System Requirements
Docker Installation (Recommended)
- Docker: Version 20.10 or higher
- Docker Compose: Version 2.0 or higher
- Storage: Minimum 500MB for images and database
- Memory: 256MB RAM minimum (512MB recommended)
Manual Installation
- Rust: Version 1.86 or newer
- SQLite: Version 3.35 or higher
- Operating System: Linux, macOS, or Windows
- Storage: Minimum 500MB for images and database
- Memory: 256MB RAM minimum (512MB recommended)
Required API Keys
Before installation, obtain these credentials:Discord Bot Token
- Go to the Discord Developer Portal
- Create a new application or select an existing one
- Navigate to the Bot section
- Click Reset Token and copy the token
ImgBB API Key
- Visit ImgBB API
- Sign up or log in to your account
- Copy your API key from the dashboard
ImgBB offers a free tier with 150 uploads per hour, which is sufficient for most use cases.
Installation Methods
- Docker (Recommended)
- Manual Installation
Docker provides the easiest and most reliable installation method.Edit the You should see output indicating the bot has connected:If you receive a response showing latency, your installation is successful!
Step 1: Install Docker
If you don’t have Docker installed:Step 2: Clone the Repository
Step 3: Configure Environment Variables
Create your.env file from the example:.env file with your credentials:.env
The
DATABASE_URL should remain as sqlite:database.sqlite unless you have a specific reason to change it.Step 4: Start the Bot
Step 5: Verify Installation
In Discord, invite your bot to a server and run:Managing the Docker Container
Environment Variables
PFP Checker uses three environment variables for configuration:| Variable | Required | Description | Example |
|---|---|---|---|
DISCORD_TOKEN | Yes | Your Discord bot token from the Developer Portal | MTIzNDU2Nzg5MDEyMzQ1Njc4OTAuGxY... |
IMGBB_KEY | Yes | Your ImgBB API key for image hosting | a1b2c3d4e5f6g7h8i9j0 |
DATABASE_URL | Yes | SQLite database file path | sqlite:database.sqlite |
Database Setup
PFP Checker uses SQLite with automatic schema migrations managed by SQLx.Automatic Migrations
On startup, the bot automatically:- Creates the database file if it doesn’t exist (specified in
DATABASE_URL) - Runs all pending migrations from the
migrations/directory - Creates the necessary tables:
User- Stores monitored users and tracking start datesProfilePicture- Archives profile pictures with checksums and ImgBB linksUsernameChange- Records username changes with timestampsServer- Stores monitored serversServerPicture- Archives server icon changes
Database Location
By default, the database is stored asdatabase.sqlite in the project root. To change this:
.env
Ensure the directory exists and the bot has write permissions to the database file location.
Database Backups
Regularly backup your database to prevent data loss:Discord Bot Configuration
Required Bot Permissions
When inviting the bot to your server, it only needs:- View Channels: To receive commands
- Use Application Commands: To register and respond to slash commands
- Message Content Intent
- Server Members Intent
- Presence Intent
Generating Invite URL
- Go to Discord Developer Portal
- Select your application
- Navigate to OAuth2 → URL Generator
- Select scopes:
botandapplications.commands - Select bot permissions:
View Channels - Copy the generated URL
The bot automatically registers all slash commands globally when it starts. There’s no need to manually register commands.
Verification Steps
After installation, verify everything works correctly:Test Monitoring
Run
/monitor @user on yourself or another user.You should receive a confirmation message.Verify Database Creation
Check that
database.sqlite exists in your project directory (or the path specified in DATABASE_URL).Troubleshooting
Bot doesn’t start
Check environment variables:- Missing
DISCORD_TOKENorIMGBB_KEY - Invalid Discord token (reset it in Developer Portal)
- Database file location not writable
Commands not appearing
Wait 1-5 minutes after starting the bot for Discord to register global commands. If commands still don’t appear:- Remove and re-invite the bot with the correct OAuth2 URL
- Ensure you selected both
botandapplications.commandsscopes - Restart the bot
Database migration errors
Image upload failures
Verify ImgBB API key:- Check that
IMGBB_KEYin.envis correct - Verify you haven’t exceeded ImgBB rate limits (150 uploads/hour)
- Test your API key:
curl "https://api.imgbb.com/1/upload?key=YOUR_KEY"
High memory usage
PFP Checker is designed to be lightweight, but if you experience high memory usage:- Check how many users/servers you’re monitoring
- Review log files for errors or excessive logging
- Restart the bot to clear any memory leaks
Production Deployment
For production environments, consider:Docker Compose with Auto-Updates
The project includes a production Docker Compose configuration with Watchtower for automatic updates:Security Best Practices
- Store
.envoutside the project directory with restricted permissions: - Use environment-specific
.envfiles (development, production) - Regularly update dependencies:
cargo update - Monitor logs for suspicious activity
- Implement database backup automation
Monitoring
Set up monitoring to ensure your bot stays healthy:Next Steps
User Tracking Guide
Learn how to use user monitoring commands
Server Tracking Guide
Track server icon changes