moresettings

This commit is contained in:
SpudGunMan
2024-07-10 22:10:35 -07:00
parent b9b12138a9
commit 71a126ea33
3 changed files with 41 additions and 22 deletions
+7 -13
View File
@@ -56,25 +56,19 @@ type = serial
```
The following pair of settings determine how to respond, default action is to not spam the default channel. Setting DM_ONLY will force all DM which may not be wanted. Setting the Default channel is the channel which wont be spammed by the bot.
```
RESPOND_BY_DM_ONLY = False # Set to True to respond messages via DM only, False uses smart response
DEFAULT_CHANNEL = 0 # Default channel on your node, also known as "public channel" 0 on new devices
[general]
respond_by_dm_only = True
defaultChannel = 0
```
the enhanced bot is all modules by default, to disable extra modules comment out
Modules can be disabled
```
# comment out unwanted functionality, defined in corresponding files/modules
trap_list = trap_list + trap_list_location # items tide, whereami, wxc, wx, wxa, wxalert
trap_list = trap_list + trap_list_solarconditions # items hfcond, solar, sun, moon
trap_list = trap_list + trap_list_bbs # items bbslist, bbspost, bbsread, bbsdelete
[bbs]
enabled = False
```
Solar Data needs the LAT LONG for your area on the [solarconditions.py](solarconditions.py) used for when node has no location in the db, the settings are not used in weather data yet
```
LATITUDE = 48.50
LONGITUDE = -123.0
```
# requirements
can also be installed with `pip install -r requirements.txt`
+14
View File
@@ -10,5 +10,19 @@ type = serial
# hostname = 192.168.0.1
# mac = 00:11:22:33:44:55
[general]
respond_by_dm_only = True
defaultChannel = 0
[bbs]
enabled = True
# location module
[location]
enabled = True
lat = 48.50
lon = -123.0
# solar module
[solar]
enabled = True
+20 -9
View File
@@ -20,16 +20,9 @@ from modules.bbstools import * # from the spudgunman/meshing-around repo
# A basic list of strings to trap and respond to
trap_list = ("ping", "pinging", "ack", "testing", "test", "pong", "motd", "cmd", "lheard", "sitrep", "joke")
# comment out unwanted funtionality, defined in corresponding files/modules
trap_list = trap_list + trap_list_location # items tide, whereami, wxc, wx
trap_list = trap_list + trap_list_solarconditions # items hfcond, solar, sun, moon
welcome_message = "MeshBot, here for you like a friend who is not. Try sending: ping @foo or, cmd"
help_message = "CMD?: ping, motd, sitrep, joke, sun, hfcond, solar, moon, tide, whereami, wx, wxc, wxa, bbslist, bbshelp"
MOTD = "Thanks for using PongBOT! Have a good day!" # Message of the Day
RESPOND_BY_DM_ONLY = False # Set to True to respond messages via DM only, False uses smart response
DEFAULT_CHANNEL = 0 # Default channel on your node, also known as "public channel" 0 on new devices
# Read the config file
config = configparser.ConfigParser()
@@ -37,9 +30,12 @@ config_file = "config.ini"
if not os.path.exists(config_file):
config['interface'] = {'type': 'serial', 'port': "/dev/ttyACM0", 'hostname': '', 'mac': ''}
config['general'] = {'respond_by_dm_only': 'True', 'defaultChannel': '0'}
config['bbs'] = {'enabled': 'True', 'bbsdb': 'bbsdb.pkl'}
config['location'] = {'enabled': 'True','lat': '0', 'lon': '0'}
config['solar'] = {'enabled': 'True'}
config.write(open(config_file, 'w'))
print (f"System: Config file created, please edit {config_file} or review the config.template")
print (f"System: Config file created, check {config_file} or review the config.template")
elif os.path.exists(config_file):
config.read(config_file)
@@ -48,6 +44,12 @@ port = config['interface'].get('port', '')
hostname = config['interface'].get('hostname', '')
mac = config['interface'].get('mac', '')
RESPOND_BY_DM_ONLY = config['general'].getboolean('respond_by_dm_only', True)
DEFAULT_CHANNEL = config['general'].getint('defaultChannel', 0)
LATITUDE = config['location'].getfloat('lat', 48.50)
LONGITUDE = config['location'].getfloat('lon', -123.0)
if interface_type == 'serial':
interface = meshtastic.serial_interface.SerialInterface(port)
elif interface_type == 'tcp':
@@ -63,10 +65,19 @@ else:
# BBS Configuration
bbs_enabled = config['bbs'].getboolean('enabled', True)
bbsdb = config['bbs'].get('bbsdb', 'bbsdb.pkl')
if bbs_enabled:
trap_list = trap_list + trap_list_bbs # items bbslist, bbspost, bbsread, bbsdelete, bbshelp
# Location Configuration
location_enabled = config['location'].getboolean('enabled', True)
if location_enabled:
trap_list = trap_list + trap_list_location # items tide, whereami, wxc, wx
# Solar Conditions Configuration
solar_conditions_enabled = config['solar_conditions'].getboolean('enabled', True)
if solar_conditions_enabled:
trap_list = trap_list + trap_list_solarconditions # items hfcond, solar, sun, moon
#Get the node number of the device, check if the device is connected
try:
myinfo = interface.getMyNodeInfo()