This Discord bot is used to communicate directly with the Meshtastic network using a Meshtastic compatable device.
Having a Discord bot directly connected to the Meshtastic network allows users to test their devices and get instant feedback on whether another device has received their message. It also allows the user to communicate on their local network no matter where they are in the world.
The following must be established in order for the bot to operate successfully:
- A Meshtastic compatable device must be connected via a serial connection to the device operating the bot.
- A list of Meshtastic compatable devices can be found here.
- Users with multiple mesh devices connected to the host will need to define the port they want the bot to utilize.
This can be done by changing line 116:
- From:
self.iface = meshtastic.serial_interface.SerialInterface() - To:
self.iface = meshtastic.serial_interface.SerialInterface(devPath="/dev/YOUR_PORT")
- From:
- Update the variables outlined in the next section.
Update the following variables in the config.json file:
- Replace
YOUR_DISCORD_BOT_TOKENwith your Discord Bot Token.- Instructions on how to create a Discord bot can be found here.
- Replace
YOUR_DISCORD_CHANNEL_IDwith the channel ID from the server the bot will be communicating in.- Instructions on how to get the channel ID can be found here.
- Replace
YOUR_TIME_ZONEwith your zime zone.- A list of available timezones can be found here.
- Replace all channel names with the channel names you've setup on your radio.
- All channel names must be unique!
- If you do not use all seven channels, that's fine. Just leave the unused ones as they are or remove its entire entry from the
config.jsonfile.
Once the above variables have been updated, run the bot using the following commands:
Note that if you have changed the above channel name variables in the config.json file, the channel commands below will change.
/sendidfollowed by the node ID to send a direct message to that node. For example,/sendid !7c5acfa4./sendnumfollowed by the node number to send a direct message to that node. For example,/sendnum 2086326180./activeto show a list of active nodes seen in the last 15 minutes./YOUR_CHANNEL_0to send a message in channel 0./YOUR_CHANNEL_1to send a message in channel 1./YOUR_CHANNEL_2to send a message in channel 2./YOUR_CHANNEL_3to send a message in channel 3./YOUR_CHANNEL_4to send a message in channel 4./YOUR_CHANNEL_5to send a message in channel 5./YOUR_CHANNEL_6to send a message in channel 6./YOUR_CHANNEL_7to send a message in channel 7./helpto show a list of available bot commands.
I've noticed that after running the bot for months on end there are times where it would stop pulling messages unti I would reboot the bot and radio.
I'm not sure if this is specific to the radio itself or not.
- Currently my bot is running utilizing a Lilygo T-Beam Supreme.
To get around this issue I have set the bot up as a service on a timer to reboot every night. Since I have made this change I have not noticed any messages being hung.
The idea for this bot was inspired by the Meshtastic Discord Bridge created by raudette.





