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

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
return res
end
return {
description = "",
usage = "",
patterns = {"^https://(.*).txt$",
"^http://(.*).txt$"},
run = run
}