mirror of
https://github.com/SpudGunMan/meshing-around.git
synced 2026-06-25 12:31:08 +02:00
bbslink
first attempt at giving BBS link over the air
This commit is contained in:
@@ -28,9 +28,11 @@ def auto_response(message, snr, rssi, hop, pkiStatus, message_from_id, channel_n
|
||||
"ack": lambda: handle_ping(message_from_id, deviceID, message, hop, snr, rssi, isDM),
|
||||
"ask:": lambda: handle_llm(message_from_id, channel_number, deviceID, message, publicChannel),
|
||||
"askai": lambda: handle_llm(message_from_id, channel_number, deviceID, message, publicChannel),
|
||||
"bbslink": lambda: bbs_sync_posts(message, message_from_id, deviceID),
|
||||
"bbsdelete": lambda: handle_bbsdelete(message, message_from_id),
|
||||
"bbshelp": bbs_help,
|
||||
"bbsinfo": lambda: get_bbs_stats(),
|
||||
"bbslink": lambda: bbs_sync_posts(message, message_from_id, deviceID),
|
||||
"bbslist": bbs_list_messages,
|
||||
"bbspost": lambda: handle_bbspost(message, message_from_id, deviceID),
|
||||
"bbsread": lambda: handle_bbsread(message),
|
||||
@@ -1083,6 +1085,9 @@ async def start_rx():
|
||||
|
||||
# Send the MOTD every day at 13:00 using send_message function to channel 2 on device 1
|
||||
#schedule.every().day.at("13:00").do(lambda: send_message(MOTD, 2, 0, 1))
|
||||
|
||||
# Send bbslink looking for peers every other day at 10:00 using send_message function to channel 0 on device 1
|
||||
#schedule.every(2).days.at("10:00").do(lambda: send_message("bbslink MeshBot looking for peers", 0, 0, 1))
|
||||
|
||||
#
|
||||
logger.debug("System: Starting the broadcast scheduler")
|
||||
|
||||
+18
-1
@@ -4,7 +4,7 @@
|
||||
import pickle # pip install pickle
|
||||
from modules.log import *
|
||||
|
||||
trap_list_bbs = ("bbslist", "bbspost", "bbsread", "bbsdelete", "bbshelp", "bbsinfo")
|
||||
trap_list_bbs = ("bbslist", "bbspost", "bbsread", "bbsdelete", "bbshelp", "bbsinfo", "bbslink", "bbsack")
|
||||
|
||||
# global message list, later we will use a pickle on disk
|
||||
bbs_messages = []
|
||||
@@ -156,6 +156,23 @@ def bbs_delete_dm(toNode, message):
|
||||
return "System: cleared mail for" + str(toNode)
|
||||
return "System: No DM found for node " + str(toNode)
|
||||
|
||||
def bbs_sync_posts(input, peerNode, RxNode):
|
||||
# respond when another bot asks for the bbs posts to sync
|
||||
|
||||
# Respond wth the first message
|
||||
message = bbs_messages[0]
|
||||
|
||||
if "bbslink" in input:
|
||||
# split to get the messageID
|
||||
lastAck = int(input.split(" ")[1])
|
||||
# send the next highest messageID
|
||||
return "bbspost " + str(bbs_messages[lastAck + 1][0])
|
||||
|
||||
return message
|
||||
|
||||
|
||||
|
||||
|
||||
#initialize the bbsdb's
|
||||
load_bbsdb()
|
||||
load_bbsdm()
|
||||
|
||||
Reference in New Issue
Block a user