A Discord bot that automatically uploads photos and videos from Discord channels to Google Drive folders. Deploy with one click to Netlify!
- 📸 Automatic photo and video uploads from Discord to Google Drive
- 📁 Per-channel folder configuration
- 🎨 Bot avatar updates to last uploaded image
- 💬 Smart file naming with message content
- 🚀 One-click Netlify deployment
- 🔐 Secure OAuth2 authentication
Use this if you want to deploy quickly and update the Google redirect URI afterward.
If you want to set up the correct redirect URI from the start:
- Fork this repository first
- Deploy from your fork to Netlify (without clicking the deploy button)
- Note your Netlify URL
- Set up Google OAuth with the correct redirect URI
- Then configure environment variables in Netlify
- Go to Google Cloud Console
- Create a new project or select an existing one
- Enable the Google Drive API:
- Go to "APIs & Services" → "Library"
- Search for "Google Drive API"
- Click on it and press "Enable"
- Create OAuth2 credentials:
- Go to "APIs & Services" → "Credentials"
- Click "Create Credentials" → "OAuth client ID"
- Choose "Web application"
- For now, add a temporary redirect URI:
https://localhost:8888/auth/google/callback - You'll update this after deployment
- Save the credentials
- Copy these values:
GOOGLE_CLIENT_ID: The Client ID from your OAuth2 credentialsGOOGLE_CLIENT_SECRET: The Client Secret from your OAuth2 credentials
- Go to Discord Developer Portal
- Click "New Application" and give it a name
- Go to the "General Information" tab
- Copy these values:
DISCORD_APPLICATION_ID: The Application IDDISCORD_PUBLIC_KEY: The Public Key
- Go to the "Bot" section in the left sidebar
- Click "Reset Token" (or "View Token" if available)
- Copy this value:
DISCORD_BOT_TOKEN: The bot token (keep this secret!)
- Under "Privileged Gateway Intents", enable:
- Message Content Intent (required to read message content)
| Variable | Where to Find | Description |
|---|---|---|
GOOGLE_CLIENT_ID |
Google Cloud Console → APIs & Services → Credentials → OAuth 2.0 Client IDs | Your Google OAuth client ID |
GOOGLE_CLIENT_SECRET |
Google Cloud Console → APIs & Services → Credentials → OAuth 2.0 Client IDs | Your Google OAuth client secret |
GOOGLE_REDIRECT_URI |
Your Netlify URL + /auth/google/callback |
Must match Google's authorized redirect URIs |
DISCORD_APPLICATION_ID |
Discord Developer Portal → Your App → General Information | Discord application/client ID |
DISCORD_PUBLIC_KEY |
Discord Developer Portal → Your App → General Information | Discord public key for verification |
DISCORD_BOT_TOKEN |
Discord Developer Portal → Your App → Bot → Token | Secret bot token (don't share!) |
- Click "Deploy to Netlify" button above
- Fill in the environment variables:
- Use temporary values for
GOOGLE_REDIRECT_URIduring initial deployment - Example:
https://temp.netlify.app/auth/google/callback
- Use temporary values for
- Complete the deployment
- After deployment, get your actual Netlify URL (e.g.,
https://amazing-site-123.netlify.app) - Update environment variables in Netlify:
- Go to Site configuration → Environment variables
- Update
GOOGLE_REDIRECT_URIto:https://your-actual-site.netlify.app/auth/google/callback - Redeploy for changes to take effect
- Update Google OAuth redirect URI:
- Go back to Google Cloud Console → APIs & Services → Credentials
- Click on your OAuth 2.0 Client ID to edit it
- Remove the temporary
localhost:8888redirect URI - Add your actual Netlify URL:
https://your-actual-site.netlify.app/auth/google/callback - Save the changes
- Visit your deployed site and follow the setup wizard
- Authorize Google Drive access
- Select default upload folder
- Add bot to your Discord server using the generated invite link
Note: The Google OAuth flow won't work until both the Netlify environment variable and Google's authorized redirect URI are updated with your actual Netlify URL!
/setup-folder- Configure upload folder for current channel/upload-info- Show current upload configuration/test-upload- Test the upload functionality
- Users post images/videos in Discord channels
- Bot detects media attachments
- Files are uploaded to configured Google Drive folder
- Bot responds with upload confirmation
- Bot avatar updates to latest uploaded image
Files are named using the pattern:
YYYY-MM-DD-HH-mm-ss-{message_content}
Example: 2025-05-23-14-30-45-check_out_this_photo.jpg
# Install dependencies
npm install
# Create .env file
cp .env.example .env
# Run locally with Netlify Dev
npm run dev
# Run tests
npm test- Netlify Functions: Serverless backend
- Discord.js: Discord bot interactions
- Google APIs: Drive integration
- Netlify Blobs: Configuration storage
- Fork the repository
- Create your feature branch (
git checkout -b feature/amazing-feature) - Commit your changes (
git commit -m 'Add amazing feature') - Push to the branch (
git push origin feature/amazing-feature) - Open a Pull Request
MIT License - see LICENSE file for details
-
"Invalid redirect URI" error during Google OAuth
- Make sure your redirect URI in Google Cloud Console exactly matches your Netlify URL
- Format should be:
https://your-site-name.netlify.app/auth/google/callback - Common mistake: Using the temporary localhost URL instead of your actual Netlify URL
- The redirect URI must be updated after deployment!
-
Bot doesn't respond to commands
- Ensure the bot has proper permissions in your Discord server
- Check that Message Content Intent is enabled in Discord Developer Portal
- Verify the bot token is correct in Netlify environment variables
-
"Not authenticated with Google" error
- Complete the Google OAuth flow in the setup wizard
- Check that Google Drive API is enabled in your Google Cloud project
-
Files not uploading
- Use
/upload-infoto check if the channel is configured - Ensure the bot has access to the Discord channel
- Check that the Google Drive folder still exists
- Use
When inviting the bot, ensure it has these permissions:
- Read Messages
- Send Messages
- Read Message History
- Attach Files
- Use Slash Commands
For issues and feature requests, please use the GitHub issues page.