Basic cron version

This commit is contained in:
yago
2014-12-16 21:50:19 +01:00
parent 198f700f86
commit 8b04aefd45
2 changed files with 40 additions and 15 deletions

View File

@@ -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
}