mirror of
https://github.com/craigerl/aprsd.git
synced 2024-09-28 16:16:51 -04:00
Hemna
3d0bb8ae8e
The regex search is now by default case insensitive. Also update each core plugin to better match the command. ping plugin can now match on p p foo ping pIng Weather plugins can now match on w wx wX Wx KM6LYW weather WeaTher
32 lines
763 B
Python
32 lines
763 B
Python
import logging
|
|
import time
|
|
|
|
from aprsd import plugin
|
|
from aprsd.utils import trace
|
|
|
|
|
|
LOG = logging.getLogger("APRSD")
|
|
|
|
|
|
class PingPlugin(plugin.APRSDRegexCommandPluginBase):
|
|
"""Ping."""
|
|
|
|
command_regex = r"^([p]|[p]\s|ping)"
|
|
command_name = "ping"
|
|
short_description = "reply with a Pong!"
|
|
|
|
@trace.trace
|
|
def process(self, packet):
|
|
LOG.info("PingPlugin")
|
|
# fromcall = packet.get("from")
|
|
# message = packet.get("message_text", None)
|
|
# ack = packet.get("msgNo", "0")
|
|
stm = time.localtime()
|
|
h = stm.tm_hour
|
|
m = stm.tm_min
|
|
s = stm.tm_sec
|
|
reply = (
|
|
"Pong! " + str(h).zfill(2) + ":" + str(m).zfill(2) + ":" + str(s).zfill(2)
|
|
)
|
|
return reply.rstrip()
|