function is_pr0_url(msg) local url = split_by_space(msg.text)[1] print(url) if string.starts(url, "http://pr0gramm.com/") or string.starts(url, "http://www.pr0gramm.com/") then return true else return false end end if string.starts(msg.text, 'http://') or string.starts(msg.text, 'https://') then if is_pr0_url(msg) then local url = split_by_space(msg.text)[1] local splited = split(url, "[\\/]+") for a,x in pairs(splited) do pr0_id = x end r, c, h = http.request("http://pr0gramm.com/api/items/get.json?id="..pr0_id) local jsondata = json.decode(r) local items = jsondata["items"] for a, x in pairs(items) do if tonumber(x["id"]) == tonumber(pr0_id) then item = x end end thumburl = item["thumb"] local thumburlsplit = split(thumburl, "[\\/]+") for a, x in pairs(thumburlsplit) do thumbname = x end local file = "/tmp/"..thumbname sh = "curl --insecure -o '"..file.."' ".."http://img.pr0gramm.com/"..thumburl run_bash(sh) send_photo(get_receiver(msg), file, ok_cb, false) end end return { description = "", usage = {""}, patterns = {"https?://pr0gramm.com/"}, run = run }