Basic cron version
This commit is contained in:
@@ -1,12 +1,21 @@
|
||||
function run(msg, matches)
|
||||
local receiver = get_receiver(msg)
|
||||
print('receiver: '..receiver)
|
||||
return "pong"
|
||||
socket = require("socket")
|
||||
|
||||
function cron()
|
||||
-- Checks a TCP connexion
|
||||
-- Use yours desired web and id
|
||||
local addr = "your.web.site"
|
||||
local dest = "user#id"..our_id
|
||||
if not socket.connect(addr, 80) then
|
||||
local text = "ALERT: "..addr.." is offline"
|
||||
print (text)
|
||||
send_msg(dest, text, ok_cb, false)
|
||||
end
|
||||
end
|
||||
|
||||
return {
|
||||
description = "bot sends pong",
|
||||
usage = "!ping",
|
||||
patterns = {"^!ping$"},
|
||||
run = run
|
||||
description = "If domain is offline, send msg to peer",
|
||||
usage = "",
|
||||
patterns = {},
|
||||
run = nil,
|
||||
cron = cron
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user