Nestpebble Ideas

@Nestpebble here is the changes I did to bring this in thank you for the ideas and enhancements!! 🥔

* whoami new command
* enhancing MOTD
* new and better icons
This commit is contained in:
SpudGunMan
2024-09-20 21:30:18 -07:00
parent b5354a2431
commit 113bde4bab
5 changed files with 46 additions and 18 deletions
+2 -1
View File
@@ -36,6 +36,7 @@ Any messages that are over 160 characters are chunked into 160 message bytes to
- `bbsdelete` delete a message example use: `bbsdelete #4` - `bbsdelete` delete a message example use: `bbsdelete #4`
- Other functions - Other functions
- `whereami` returns the address of location of sender if known - `whereami` returns the address of location of sender if known
- `whoami` returns some details of the node asking
- `tide` returns the local tides, NOAA data source - `tide` returns the local tides, NOAA data source
- `wx` and `wxc` returns local weather forecast, (wxc is metric value), NOAA or Open Meteo for weather forecasting. - `wx` and `wxc` returns local weather forecast, (wxc is metric value), NOAA or Open Meteo for weather forecasting.
- `wxa` and `wxalert` return NOAA alerts. Short title or expanded details - `wxa` and `wxalert` return NOAA alerts. Short title or expanded details
@@ -256,6 +257,6 @@ Games Ported from..
- https://github.com/Himan10/BlackJack - https://github.com/Himan10/BlackJack
- https://github.com/devtronvarma/Video-Poker-Terminal-Game - https://github.com/devtronvarma/Video-Poker-Terminal-Game
GitHub user mrpatrick1991 For Docker configs, PiDiBi looking at test functions and other suggestions like wxc, CPU use, and alerting ideas GitHub user Nestpebble, for new ideas and enhancments, mrpatrick1991 For Docker configs, PiDiBi looking at test functions and other suggestions like wxc, CPU use, and alerting ideas
Discord and Mesh user Cisien, and github Hailo1999, for testing and ideas! Lots of individuals on the Meshtastic discord who have tossed out ideas and tested code! Discord and Mesh user Cisien, and github Hailo1999, for testing and ideas! Lots of individuals on the Meshtastic discord who have tossed out ideas and tested code!
+2
View File
@@ -30,6 +30,8 @@ defaultChannel = 0
# motd is reset to this value on boot # motd is reset to this value on boot
motd = Thanks for using MeshBOT! Have a good day! motd = Thanks for using MeshBOT! Have a good day!
welcome_message = MeshBot, here for you like a friend who is not. Try sending: ping @foo or, cmd welcome_message = MeshBot, here for you like a friend who is not. Try sending: ping @foo or, cmd
# whoami
whoami = True
# enable or disable the Joke module # enable or disable the Joke module
DadJokes = True DadJokes = True
# enable or disable the Solar module # enable or disable the Solar module
+33 -16
View File
@@ -88,22 +88,29 @@ def handle_ping(message, hop, snr, rssi):
def handle_motd(message, message_from_id): def handle_motd(message, message_from_id):
global MOTD global MOTD
if "?" in message and not "$": #basic help message - borked isAdmin = False
return "Message of the day, set with 'motd $ motd'" msg = ""
elif "$" in message and str(message_from_id) in str(bbs_admin_list): #access control via bbs admin list - works # check if the message_from_id is in the bbs_admin_list
motd = message.split("$")[1] if bbs_admin_list != ['']:
MOTD = motd.rstrip() for admin in bbs_admin_list:
logger.debug(f"System: node changed MOTD: ", {message_from_id}) if str(message_from_id) == admin:
return "MOTD Set to: " + MOTD isAdmin = True
elif "$" in message and not str(bbs_admin_list).strip(): #no names in bbs admin list - borked break
motd = message.split("$")[1]
MOTD = motd.rstrip()
return "MOTD Set to: " + MOTD
elif "$" in message and str(bbs_admin_list).strip(''):
logger.debug(f"System: node tried to change MOTD: ", str({message_from_id}))
return "I can't do that for you "
else: else:
return MOTD isAdmin = True
if "$" in message and isAdmin:
motd = message.split("$")[1]
MOTD = motd.rstrip()
logger.debug(f"System: {message_from_id} changed MOTD: {MOTD}")
msg = "MOTD changed to: " + MOTD
elif "?" in message:
msg = "Message of the day, set with 'motd $ HelloWorld!'"
else:
logger.debug(f"System: {message_from_id} requested MOTD: {MOTD} isAdmin: {isAdmin}")
msg = "MOTD: " + MOTD
return msg
def handle_wxalert(message_from_id, deviceID, message): def handle_wxalert(message_from_id, deviceID, message):
if use_meteo_wxApi: if use_meteo_wxApi:
@@ -482,7 +489,17 @@ def handle_testing(message, hop, snr, rssi):
return "🎙Testing 1,2,3 " + hop return "🎙Testing 1,2,3 " + hop
def handle_whoami(message_from_id, deviceID): def handle_whoami(message_from_id, deviceID):
return "You are " + str(message_from_id) + " AKA " + str(get_name_from_number(message_from_id, 'long', deviceID)) loc = []
msg = "You are " + str(message_from_id) + " AKA " +\
str(get_name_from_number(message_from_id, 'long', deviceID) + " AKA " +\
str(get_name_from_number(message_from_id, 'short', deviceID)) + " AKA " +\
str(decimal_to_hex(message_from_id)) + " AKA " +\
str(message_from_id) + f"\n")
loc = get_node_location(message_from_id, deviceID)
if loc != [latitudeValue,longitudeValue]:
msg += f"You are at: lat:{loc[0]} lon:{loc[1]}\n"
return msg
def onDisconnect(interface): def onDisconnect(interface):
global retry_int1, retry_int2 global retry_int1, retry_int2
+2
View File
@@ -96,6 +96,7 @@ try:
welcome_message = (f"{welcome_message}").replace('\\n', '\n') # allow for newlines in the welcome message welcome_message = (f"{welcome_message}").replace('\\n', '\n') # allow for newlines in the welcome message
motd_enabled = config['general'].getboolean('motdEnabled', True) motd_enabled = config['general'].getboolean('motdEnabled', True)
MOTD = config['general'].get('motd', MOTD) MOTD = config['general'].get('motd', MOTD)
whoami_enabled = config['general'].getboolean('whoami', True)
dad_jokes_enabled = config['general'].getboolean('DadJokes', False) dad_jokes_enabled = config['general'].getboolean('DadJokes', False)
solar_conditions_enabled = config['general'].getboolean('spaceWeather', True) solar_conditions_enabled = config['general'].getboolean('spaceWeather', True)
wikipedia_enabled = config['general'].getboolean('wikipedia', False) wikipedia_enabled = config['general'].getboolean('wikipedia', False)
@@ -144,6 +145,7 @@ try:
blackjack_enabled = config['games'].getboolean('blackjack', True) blackjack_enabled = config['games'].getboolean('blackjack', True)
videoPoker_enabled = config['games'].getboolean('videoPoker', True) videoPoker_enabled = config['games'].getboolean('videoPoker', True)
# messaging settings
responseDelay = config['messagingSettings'].getfloat('responseDelay', 0.7) # default 0.7 responseDelay = config['messagingSettings'].getfloat('responseDelay', 0.7) # default 0.7
splitDelay = config['messagingSettings'].getfloat('splitDelay', 0) # default 0 splitDelay = config['messagingSettings'].getfloat('splitDelay', 0) # default 0
MESSAGE_CHUNK_SIZE = config['messagingSettings'].getint('MESSAGE_CHUNK_SIZE', 160) # default 160 MESSAGE_CHUNK_SIZE = config['messagingSettings'].getint('MESSAGE_CHUNK_SIZE', 160) # default 160
+7 -1
View File
@@ -10,7 +10,7 @@ import contextlib # for suppressing output on watchdog
from modules.log import * from modules.log import *
# Global Variables # Global Variables
trap_list = ("cmd","cmd?","whoami") # default trap list trap_list = ("cmd","cmd?",) # default trap list
help_message = "CMD?:" help_message = "CMD?:"
asyncLoop = asyncio.new_event_loop() asyncLoop = asyncio.new_event_loop()
games_enabled = False games_enabled = False
@@ -34,6 +34,12 @@ if motd_enabled:
trap_list = trap_list + trap_list_motd trap_list = trap_list + trap_list_motd
help_message = help_message + ", motd" help_message = help_message + ", motd"
# whoami Configuration
if whoami_enabled:
trap_list_whoami = ("whoami",)
trap_list = trap_list + trap_list_whoami
help_message = help_message + ", whoami"
# Solar Conditions Configuration # Solar Conditions Configuration
if solar_conditions_enabled: if solar_conditions_enabled:
from modules.solarconditions import * # from the spudgunman/meshing-around repo from modules.solarconditions import * # from the spudgunman/meshing-around repo