This repository has been archived on 2021-04-24. You can view files and clone it, but cannot push or open issues or pull requests.
Mikubot/plugins/get_txt.lua

18 lines
403 B
Lua
Raw Normal View History

2015-11-12 17:42:03 +01:00
local function run(msg, matches)
if string.starts(msg.text, "https") then
res,code = https.request('https://'..matches[1]..'.txt')
else
res,code = http.request('http://'..matches[1]..'.txt')
end
if code ~= 200 then return 'Fehler beim Laden der TXT' end
2015-11-12 17:42:03 +01:00
return res
end
return {
description = "",
usage = "",
patterns = {"^https://(.*).txt$",
"^http://(.*).txt$"},
2015-11-12 17:42:03 +01:00
run = run
}