mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-03-28 17:32:36 +01:00
cleanup
This commit is contained in:
@@ -128,10 +128,10 @@ def auto_response(message, snr, rssi, hop, message_from_id, channel_number, devi
|
||||
if toNode.isalpha():
|
||||
toNode = get_num_from_short_name(toNode, deviceID)
|
||||
if toNode == 0:
|
||||
bot_response = "Node not found " + message.split("@")[1].split("#")[0] + ", case sensitive!"
|
||||
bot_response = "Node not found " + message.split("@")[1].split("#")[0]
|
||||
return bot_response
|
||||
else:
|
||||
logger.debug(f"Bot: bbspost, Node name lookup found: {toNode} for " + message.split("@")[1].split("#")[0])
|
||||
logger.debug(f"System: bbspost, name lookup found: {toNode}")
|
||||
if "#" in message:
|
||||
body = message.split("#")[1]
|
||||
bot_response = bbs_post_dm(toNode, body, message_from_id)
|
||||
|
||||
@@ -151,15 +151,15 @@ def get_name_from_number(number, type='long', nodeInt=1):
|
||||
return number
|
||||
|
||||
def get_num_from_short_name(short_name, nodeInt=1):
|
||||
# Get the node number from the short name
|
||||
# Get the node number from the short name, converting all to lowercase for comparison (good practice?)
|
||||
logger.debug(f"System: Getting Node Number from Short Name: {short_name} on Device: {nodeInt}")
|
||||
if nodeInt == 1:
|
||||
for node in interface1.nodes.values():
|
||||
if str(short_name) == node['user']['shortName']:
|
||||
if str(short_name.lower()) == node['user']['shortName'].lower():
|
||||
return node['num']
|
||||
if nodeInt == 2:
|
||||
for node in interface2.nodes.values():
|
||||
if str(short_name) == node['user']['shortName']:
|
||||
if str(short_name.lower()) == node['user']['shortName'].lower():
|
||||
return node['num']
|
||||
return 0
|
||||
|
||||
|
||||
Reference in New Issue
Block a user