mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-08-07 01:13:14 +02:00
Update mesh_bot.py
This commit is contained in:
+10
-8
@@ -271,14 +271,16 @@ def handle_ping(message_from_id, deviceID, message, hop, snr, rssi, isDM, chann
|
||||
|
||||
# check for ping to @nodeID and allow BBS DM
|
||||
toNode = message.split("@")[1].strip().split(" ")[0]
|
||||
toNode = get_num_from_short_name(toNode, deviceID)
|
||||
if toNode and isinstance(toNode, int) and toNode != 0:
|
||||
if bbs_enabled:
|
||||
msg_result = None
|
||||
logger.debug(f"System: Sending ping as BBS DM to @{toNode} from {get_name_from_number(message_from_id, 'short', deviceID)}")
|
||||
msg_result = bbs_post_dm(toNode, f"Joke for you! {tell_joke()}", message_from_id)
|
||||
# exit the function
|
||||
return msg_result if msg_result else logger.warning(f"System: ping @nodeID detected but no BBS to send with, enable BBS in settings.ini")
|
||||
# validate toNode is shortname
|
||||
if len(toNode) <= 4:
|
||||
toNode = get_num_from_short_name(toNode, deviceID)
|
||||
if toNode and isinstance(toNode, int) and toNode != 0:
|
||||
if bbs_enabled:
|
||||
msg_result = None
|
||||
logger.debug(f"System: Sending ping as BBS DM to @{toNode} from {get_name_from_number(message_from_id, 'short', deviceID)}")
|
||||
msg_result = bbs_post_dm(toNode, f"Joke for you! {tell_joke()}", message_from_id)
|
||||
# exit the function
|
||||
return msg_result if msg_result else logger.warning(f"System: ping @nodeID detected but no BBS to send with, enable BBS in settings.ini")
|
||||
|
||||
elif "#" in message:
|
||||
msg = msg + " #" + message.split("#")[1]
|
||||
|
||||
Reference in New Issue
Block a user