A Discord bot that monitors specified channels and forwards messages to a designated channel. Perfect for creating logs or maintaining chat archives.
- Monitor multiple source channels simultaneously
- Forward messages to a designated channel
- Admin-only setup command
- Persistent configuration
- Real-time message monitoring
- Node.js v16.9.0 or higher
- Discord Bot Token
- Administrator permissions in your Discord server
- Clone this repository or download the files
- Install dependencies:
npm install- Create a
.envfile in the root directory and add your Discord bot token:
DISCORD_TOKEN=your_bot_token_here-
Invite the bot to your server with the following permissions:
- Read Messages/View Channels
- Send Messages
- Read Message History
-
Run the bot:
npm start- In Discord, use the following command to configure the bot:
!setup
- Edit the service file path in
discord-crawler.service:
WorkingDirectory=/path/to/Discord Crawler
User=YOUR_USERNAME- Copy the service file to systemd:
sudo cp discord-crawler.service /etc/systemd/system/
sudo systemctl daemon-reload- Start the service:
sudo systemctl start discord-crawler- Enable auto-start on boot:
sudo systemctl enable discord-crawler- Check status:
sudo systemctl status discord-crawler- Install PM2 globally:
npm install -g pm2- Start the bot:
npm run pm2:start- Other PM2 commands:
- Stop:
npm run pm2:stop - Restart:
npm run pm2:restart - View logs:
npm run pm2:logs
- Enable PM2 startup:
pm2 startup
pm2 saveThe !setup command will guide you through:
- Selecting channels to monitor (mention them in a single message)
- Choosing a destination channel for forwarded messages
Only server administrators can use the setup command.
Forwarded messages will appear in this format:
**Channel:** #source-channel
**User:** username
**Message:** message content
index.js: Main bot codeconfig.json: Stores channel configurations.env: Environment variablespackage.json: Project dependencies
- The bot will maintain the previous configuration if setup is cancelled
- Invalid channel mentions will be ignored
- Only text channels can be monitored
- Only administrators can configure the bot
- Bot token is stored securely in
.envfile - Configuration is saved locally in
config.json
Feel free to submit issues and enhancement requests!
This project is open source and available under the MIT License.