A powerful and reliable Discord bot for automatically forwarding PDF files from one channel to another, with embedded messages and error handling.
- π Automatic PDF file detection and forwarding
- π¨ Beautiful embedded messages with file information
- π Secure environment variable configuration
- π‘οΈ Robust error handling
- π Easy deployment process
- Node.js: v16.9.0 or higher
- Discord Bot Token: From Discord Developer Portal
- Channel IDs: Source and target channel IDs from your Discord server
-
Clone the repository
git clone https://github.com/your-username/pdf-file-forwarder-bot.git cd pdf-file-forwarder-bot
-
Install dependencies
npm install
-
Configure environment variables
cp .env.example .env
Edit the
.env
file with your configuration:DISCORD_BOT_TOKEN=your_bot_token_here SOURCE_CHANNEL_ID=your_source_channel_id TARGET_CHANNEL_ID=your_target_channel_id PREFIX=!
-
Start the bot
# Production npm start # Development with auto-reload npm run dev
- Go to Discord Developer Portal
- Create a new application
- Navigate to the "Bot" section
- Click "Reset Token" to get your bot token
- Enable necessary Privileged Gateway Intents
- Enable Developer Mode in Discord (User Settings > App Settings > Advanced)
- Right-click any channel and select "Copy ID"
- Go to Discord Developer Portal
- Select your bot application
- Click on "Bot" in the left sidebar
- Scroll down to "Privileged Gateway Intents"
- Enable these required intents:
- MESSAGE CONTENT INTENT
- SERVER MEMBERS INTENT
- PRESENCE INTENT
β οΈ Important: Your bot needs these intents to function properly. Without them, the bot will fail to connect.
- Never commit your
.env
file - Keep your bot token private
- Regularly rotate your bot token if compromised
- Use environment variables for sensitive data
-
Bot doesn't start
- Check if Node.js version is 16.9.0 or higher
- Verify environment variables are set correctly
- Ensure all dependencies are installed
-
Bot doesn't forward files
- Verify channel IDs are correct
- Check bot permissions in both channels
- Ensure bot has necessary intents enabled
- Fork the repository
- Create a feature branch
- Commit your changes
- Push to the branch
- Open a Pull Request
This project is licensed under the MIT License - see the LICENSE file for details.
If you need help or want to report issues:
- Open an issue