From 1a41f5197c3ef60b6ab8dd1715d7621228e4bede Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Thu, 11 Jul 2024 00:42:32 -0700 Subject: [PATCH] Update pong_bot.py --- pong_bot.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/pong_bot.py b/pong_bot.py index 17260cc..d06df51 100755 --- a/pong_bot.py +++ b/pong_bot.py @@ -11,12 +11,9 @@ import meshtastic.ble_interface from datetime import datetime import configparser, os +# system variables trap_list = ("ping", "pinging", "ack", "testing", "test", "pong", "motd", "cmd", "lheard", "sitrep") #A list of strings to trap and respond to -welcome_message = "PongBot, here for you like a friend who is not. Try sending: ping @foo or, cmd" help_message = "Commands are: ping, ack, motd, Lheard. Use 'motd $foo' to set MOTD." -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() @@ -29,11 +26,19 @@ if not os.path.exists(config_file): elif os.path.exists(config_file): config.read(config_file) +# config.ini variables interface_type = config['interface'].get('type', 'serial') 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) + +MOTD = config['general'].get('motd', 'Thanks for using MeshBOT! Have a good day!') +welcome_message = config['general'].get('welcome_message', 'MeshBot, here for you like a friend who is not. Try sending: ping @foo or, cmd') + +# Interface Configuration if interface_type == 'serial': interface = meshtastic.serial_interface.SerialInterface(port) elif interface_type == 'tcp':