diff --git a/plugins/get_txt.lua b/plugins/get_txt.lua index 862ca52..2a74662 100644 --- a/plugins/get_txt.lua +++ b/plugins/get_txt.lua @@ -1,5 +1,9 @@ local function run(msg, matches) - local res,code = http.request(matches[1]..'.txt') + 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 nil end return res end @@ -8,6 +12,7 @@ end return { description = "", usage = "", - patterns = {"^https?://(.*).txt$"}, + patterns = {"^https://(.*).txt$", + "^http://(.*).txt$"}, run = run } \ No newline at end of file