Merge pull request #10 from PiDiBi/trap-lists

Trap lists
This commit is contained in:
Kelly
2024-06-26 16:15:35 -07:00
committed by GitHub
5 changed files with 22 additions and 7 deletions
+6 -1
View File
@@ -5,9 +5,13 @@ from dadjokes import Dadjoke # pip install dadjokes
import pickle # pip install pickle
import os
# global message list
trap_list_bbs = ("bbslist", "bbspost", "bbsread", "bbsdelete", "bbshelp")
# global message list, later we will use a database on disk
bbs_messages = []
def tell_joke():
# tell a dad joke, does it need an explanationn :)
dadjoke = Dadjoke()
@@ -77,6 +81,7 @@ def bbs_read_message(messageID = 0):
else:
return "Please specify a message number to read."
#initialize the bbsdb
load_bbsdb()
+3
View File
@@ -13,6 +13,8 @@ DAYS_OF_WEATHER = 4 # weather forecast days, the first two rows are today and to
NO_DATA_NOGPS = "no location data: does your device have GPS?"
ERROR_FETCHING_DATA = "error fetching data"
trap_list_location = ("whereami", "tide", "moon", "wx", "wxc")
def where_am_i(lat=0, lon=0):
whereIam = ""
if float(lat) == 0 and float(lon) == 0:
@@ -157,3 +159,4 @@ def replace_weather(row):
line = line.replace(key, value)
return line
Executable → Regular
+10 -5
View File
@@ -12,19 +12,24 @@ from datetime import datetime
from solarconditions import * # from the spudgunman/meshing-around repo
from locationdata import * # from the spudgunman/meshing-around repo
from bbstools import * # from the spudgunman/meshing-around repo
from bbstools import *
from solarconditions import trap_list_conditions # from the spudgunman/meshing-around repo
# Uncomment the interface you want to use depending on your device connection
interface = meshtastic.serial_interface.SerialInterface() #serial interface
#interface=meshtastic.tcp_interface.TCPInterface(hostname="192.168.0.1") # IP of your device
#interface=meshtastic.ble_interface.BLEInterface("AA:BB:CC:DD:EE:FF") # BLE interface
#A list of strings to trap and respond to
trap_list = ("ping", "ack", "testing", "pong", "motd", "help", "sun", "solar", "hfcond", "lheard", "sitrep", \
"whereami", "tide", "moon", "wx", "wxc", "joke", "bbslist", "bbspost", "bbsread", "bbsdelete", "bbshelp")
# A basic list of strings to trap and respond to
trap_list = ("ping", "ack", "testing", "pong", "motd", "help", "lheard", "sitrep", "joke")
# join all lists, comment out unwanted funtionality, defined in corresponding files/modules
trap_list = trap_list + trap_list_location
trap_list = trap_list + trap_list_conditions
#trap_list = trap_list + trap_list_bbs
welcome_message = "MeshBot, here for you like a friend who is not. Try sending: ping @foo or, help"
help_message = "Commands are: ack, hfcond, joke, Lheard, moon, motd, ping, solar, sun, tide, whereami, wx, bbshelp"
help_message = "Commands are: " + ", ".join(trap_list)
MOTD = "Thanks for using PongBOT! Have a good day!" # Message of the Day
RESPOND_BY_DM_ONLY = True # Set to True to respond messages via DM only (keeps the channel clean)
Executable → Regular
View File
+3 -1
View File
@@ -14,6 +14,8 @@ LONGITUDE = -123.0
URL_TIMEOUT = 10 # wait time for URL requests
trap_list_conditions = ("sun", "solar", "hfcond")
def hf_band_conditions():
# ham radio HF band conditions
hf_cond = ""
@@ -123,4 +125,4 @@ def get_moon(lat=0, lon=0):
"\nPhase:" + moon_table['phase'] + " @:" + str('{0:.2f}'.format(moon_table['illumination'])) + "%" \
+ "\nFull Moon:" + moon_table['next_full_moon'] + "\nNew Moon:" + moon_table['next_new_moon']
return moon_data
return moon_data