From 7e5c5ec06c46fa469ff0f94bc728263824ce5668 Mon Sep 17 00:00:00 2001 From: Akamaru Date: Tue, 2 Feb 2016 22:44:09 +0100 Subject: [PATCH] get_txt funktioniert nun mit http und https --- plugins/get_txt.lua | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) 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