bbsConfig

This commit is contained in:
SpudGunMan
2024-07-10 21:52:56 -07:00
parent fc777cf6f0
commit 8f8c4d95e2
2 changed files with 12 additions and 1 deletions
+3
View File
@@ -9,3 +9,6 @@ type = serial
# port = /dev/ttyUSB0
# hostname = 192.168.0.1
# mac = 00:11:22:33:44:55
[bbs]
enabled = true
+9 -1
View File
@@ -23,7 +23,6 @@ trap_list = ("ping", "pinging", "ack", "testing", "test", "pong", "motd", "cmd",
# 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
trap_list = trap_list + trap_list_bbs # items bbslist, bbspost, bbsread, bbsdelete, bbshelp
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"
@@ -38,6 +37,7 @@ config_file = "config.ini"
if not os.path.exists(config_file):
config['interface'] = {'type': 'serial', 'port': "/dev/ttyACM0", 'hostname': '', 'mac': ''}
config['bbs'] = {'enabled': 'True', 'bbsdb': 'bbsdb.pkl'}
config.write(open(config_file, 'w'))
print (f"System: Config file created, please edit {config_file} or review the config.template")
elif os.path.exists(config_file):
@@ -60,6 +60,14 @@ else:
#print(f"System: Interface Type: {interface_type} Port: {port} Hostname: {hostname} MAC: {mac}")
# 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
print(f"System: BBS Enabled, using {bbsdb}")
#Get the node number of the device, check if the device is connected
try:
myinfo = interface.getMyNodeInfo()