update rss.lua

other text
msg when sync
removed some patterns
This commit is contained in:
Akamaru 2015-06-16 21:47:48 +02:00
parent d27a686e09
commit 2436348e90

View File

@ -136,7 +136,7 @@ local function cron()
for k2, v2 in pairs(newentr) do for k2, v2 in pairs(newentr) do
local title = v2.title or 'No title' local title = v2.title or 'No title'
local link = v2.link or v2.id or 'No Link' local link = v2.link or v2.id or 'No Link'
text = text .. "[rss](" .. link .. ") - " .. title .. '\n' text = text .. '[RSS] '.. title .. '\n(' .. link .. ')\n'
end end
if text ~= '' then if text ~= '' then
local newlast = newentr[1].id local newlast = newentr[1].id
@ -161,14 +161,16 @@ local function run(msg, matches)
if matches[1] == "sync" then if matches[1] == "sync" then
if not is_sudo(msg) then if not is_sudo(msg) then
return 'Du kannst das nicht' return 'Du kannst das nicht'
else
return 'RSS aktualisiert'
end end
cron() cron()
end end
if matches[1] == "add" or matches[1] == "sub" then if matches[1] == "add" then
return subscribe(id, matches[2]) return subscribe(id, matches[2])
end end
if matches[1] == "remove" or matches[1] == "uns" then if matches[1] == "remove" then
return unsubscribe(id, matches[2]) return unsubscribe(id, matches[2])
end end
end end
@ -185,9 +187,7 @@ return {
patterns = { patterns = {
"^/rss$", "^/rss$",
"^/rss (add) (https?://[%w-_%.%?%.:/%+=&]+)$", "^/rss (add) (https?://[%w-_%.%?%.:/%+=&]+)$",
"^/rss (sub) (https?://[%w-_%.%?%.:/%+=&]+)$",
"^/rss (remove) (%d+)$", "^/rss (remove) (%d+)$",
"^/rss (uns) (%d+)$",
"^/rss (sync)$" "^/rss (sync)$"
}, },
run = run, run = run,