This project provides a bridge between MeshCore and Discord, allowing messages to flow between RF mesh networks and Discord channels.
This fork significantly extends the original project with multi-channel routing, multi-server support, flood protection, message chunking, and operator controls, making it suitable for real-world mesh deployments where bandwidth is limited and message loss is possible.
- Node.js: v18.0.0 or higher (Required for top-level await).
- Hardware: A MeshCore node flashed with the latest client firmware.
- Process Manager: PM2 is recommended for 24/7 background operation.
- Flash your MeshCore node and connect it via USB.
- Identify your serial port:
- Linux: /dev/ttyUSB0 or /dev/ttyACM0
- macOS: /dev/tty.usbserial-XXXX
- Windows: COM3, COM4, etc.
- Install dependencies:
npm install
- Open the Discord Developer Portal and create a new application.
- In the Bot tab, enable:
- Presence Intent
- Server Members Intent
- Message Content Intent
- Copy your Bot Token into config.json.
- Go to OAuth2 -> URL Generator, select 'bot' and 'applications.commands', then use the generated link to invite the bot to your server.
Create a config.json in the root directory. Note: JSON does not support comments (//), so ensure the file only contains valid JSON data.
{ "identifier": "!", "CLIENT_ID": "YOUR_APPLICATION_ID", "DISCORD_TOKEN": "YOUR_BOT_TOKEN", "SERIAL_PORT": "/dev/ttyUSB0", "GUILD_ID": "YOUR_SERVER_ID", "DISCORD_CHANNEL_ID": "YOUR_PRIMARY_CHANNEL_ID" }
To keep the bridge running in the background and auto-restart on boot:
- Start the bridge:
sudo npm install pm2@latest -gpm2 start main.js --name mesh-bridge - Monitor logs:
pm2 logs mesh-bridge - Setup boot persistence:
pm2 startup(and run the command it generates)pm2 save
- Mesh messages are routed based on mesh channel index.
- PocketMesh emoji “reaction” messages are automatically ignored.
- Profanity triggers a warning back to the originating mesh channel.
- Forwarding can be paused globally via command.
- Messages can be sent via Slash commands (/send) or Prefix commands (!send).
- Long messages are safely chunked and paced (e.g., 1/2, 2/2).
- Flood protection prevents accidental mesh overload.
- /send — Send text to the mesh.
- /advert — Sends a flood advert from the connected node.
(Requires Administrator or Manage Guild roles)
- /bridge status — Show current forwarding state.
- /bridge pause — Pause all mesh-Discord forwarding.
- /bridge resume — Resume normal operation.
- Per-Discord-channel rate limiting is enforced to protect mesh bandwidth.
- Automatic message chunking for long Discord messages.
- n/N counters added only when chunking is required.
- Serialized send queue to prevent message interleaving.