Many thanks to and inspiration from:
https://github.com/arankwende/meshtastic-mqtt-client & https://github.com/joshpirihi/meshtastic-mqtt & https://github.com/pdxlocations/connect
Powered by Meshtastic.org
Create a virtual environment and install Mesh Fortune:
python3 -m venv mesh-fortune
cd mesh-fortune && source bin/activate
pip3 install meshtastic paho-mqtt cryptography
git clone https://github.com/Arkwin/Mesh-Fortune.git
cd Mesh-Fortunepython mqtt-connect.pyEdit config.ini to customize:
- Node Settings: Your node number, long/short name
- MQTT Settings: Broker, credentials, topics
- Regional Topics: Add multiple root topics for cross-region support
- Debug Options: Enable detailed logging
Example config.ini:
[DEFAULT]
node_number = 2882380807
long_name = FortuneBot
short_name = FB
mqtt_broker = mqtt.meshtastic.org
root_topic = msh/US/2/e/,msh/US/DMV/2/e/,msh/US/VA/2/e/
channel = LongFast
key = AQ==
debug = trueThis system provides a fun fortune cookie bot for Meshtastic users across multiple regions. When someone sends a direct message to your fortune bot node, it automatically replies with a random fortune from the fortunes.txt file.
Getting a Fortune: Simply send any direct message to the fortune bot node and you'll receive a random fortune in response!
The bot reads from fortunes.txt which contains:
- Inspirational quotes
- Funny sayings
- Motivational messages
- Random wisdom
- Silly observations
You can customize the fortunes by editing the fortunes.txt file - just put one fortune per line.
The fortune bot automatically works across different Meshtastic regions:
- Supported Regions: Configurable via
config.ini - Cross-Region Delivery: Fortunes sent across different mesh regions
- Smart Routing: System remembers where users were last seen for efficient delivery
- Node information is cached for faster lookups
- Message history is maintained for debugging
- Automatic database setup on first run
- Lightweight SQLite database (
fortune.db)
- 🔮 Random Fortunes - Picks from 90+ different fortunes
- 🌐 Cross-Region Delivery - Works across multiple Meshtastic regions
- ⚡ Instant Response - Replies immediately to any direct message
- 🎯 Smart Routing - Automatic routing to correct regional topics
- 📝 Customizable - Edit fortunes.txt to add your own messages
- 🔧 Multi-Topic Support - Configurable for different mesh regions
- 📊 Database Tracking - Logs interactions and node information
- 🧹 Clean Code - Simplified codebase focused only on fortune functionality
Here are some examples of what the bot might send:
- "Nothing is impossible. Except Monday mornings."
- "A comfort zone is a magical place where nothing ever grows."
- "Go confidently in the direction of your dreams."
- "Curiosity kills boredom. Nothing can kill curiosity."
- "Better ask twice than lose yourself once."
To add custom fortunes:
- Open
fortunes.txtin a text editor - Add one fortune per line
- Save the file
- The bot will automatically include new fortunes in random selection
The bot will randomly select from all available fortunes each time someone messages it!
fortune-bot.py- Main clean fortune bot applicationmqtt-connect.py- Original full-featured version (mail system included)fortunes.txt- Fortune database (one fortune per line)config.ini- Configuration filemodels.py- Database modelsfortune.db- SQLite database (auto-created)