From 28514adf007cfb4ad8d9a43cd45fbc95f720d62b Mon Sep 17 00:00:00 2001 From: SpudGunMan Date: Sun, 11 Aug 2024 23:02:19 -0700 Subject: [PATCH] enhance --- README.md | 14 +++++++++++--- config.template | 2 ++ modules/settings.py | 2 +- modules/system.py | 4 ++-- 4 files changed, 16 insertions(+), 6 deletions(-) diff --git a/README.md b/README.md index 3e51b3f..add0c92 100644 --- a/README.md +++ b/README.md @@ -99,9 +99,17 @@ enabled = False [general] DadJokes = False StoreForward = False - -# detect and report the closest to the bot -SentryEnabled = False +``` +Sentry Bot detects anyone comeing close to the bot-node +``` +# detect anyone close to the bot +SentryEnabled = True +# holdoff time multiplied by minutes(20) of the watchdog +SentryChannel = 9 +# channel to send a message to when the watchdog is triggered +SentryHoldoff = 2 +# list of ignored nodes numbers ex: 2813308004,4258675309 +sentryIgnoreList = ``` The BBS has admin and block lists; see the [config.template](config.template) diff --git a/config.template b/config.template index af28afc..a8476cd 100644 --- a/config.template +++ b/config.template @@ -43,6 +43,8 @@ URL_TIMEOUT = 10 LogMessagesToFile = False # detect anyone close to the bot SentryEnabled = True +# radius in meters to detect someone close to the bot +SentryRadius = 100 # holdoff time multiplied by minutes(20) of the watchdog SentryChannel = 9 # channel to send a message to when the watchdog is triggered diff --git a/modules/settings.py b/modules/settings.py index f8a3f92..a79ef43 100644 --- a/modules/settings.py +++ b/modules/settings.py @@ -22,7 +22,6 @@ max_retry_count1 = 4 # max retry count for interface 1 max_retry_count2 = 4 # max retry count for interface 2 retry_int1 = False retry_int2 = False -radius = 100 # radius for sentry alerts in meters # Read the config file, if it does not exist, create basic config file config = configparser.ConfigParser() @@ -80,6 +79,7 @@ try: secure_channel = config['general'].getint('SentryChannel', 2) # default 2 sentry_holdoff = config['general'].getint('SentryHoldoff', 9) # default 9 sentryIgnoreList = config['general'].get('sentryIgnoreList', '').split(',') + sentry_radius = config['general'].getint('SentryRadius', 100) # default 100 meters config['general'].get('motd', MOTD) urlTimeoutSeconds = config['general'].getint('URL_TIMEOUT', 10) # default 10 seconds forecastDuration = config['general'].getint('NOAAforecastDuration', 4) # NOAA forcast days diff --git a/modules/system.py b/modules/system.py index c610df8..402a341 100644 --- a/modules/system.py +++ b/modules/system.py @@ -307,7 +307,7 @@ def get_closest_nodes(nodeInt=1,returnCount=3): # set radius around BOT position distance = round(geopy.distance.geodesic((latitudeValue, longitudeValue), (latitude, longitude)).m, 2) - if (distance < radius): + if (distance < sentry_radius): if nodeID != myNodeNum1 and myNodeNum2 and str(nodeID) not in sentryIgnoreList: node_list.append({'id': nodeID, 'latitude': latitude, 'longitude': longitude, 'distance': distance}) # calculate distance to node and report @@ -342,7 +342,7 @@ def get_closest_nodes(nodeInt=1,returnCount=3): # set radius around BOT position distance = geopy.distance.geodesic((latitudeValue, longitudeValue), (latitude, longitude)).m - if (distance < radius): + if (distance < sentry_radius): if nodeID != myNodeNum1 and myNodeNum2 and str(nodeID) not in sentryIgnoreList: node_list.append({'id': nodeID, 'latitude': latitude, 'longitude': longitude, 'distance': distance}) # calculate distance to node and report