do local function get_kc2(tag) local url = 'http://konachan.com/post.json?tags='..tag..'' local b,c = http.request(url) if c ~= 200 then return nil end local kc = json:decode(b) -- truly randomize math.randomseed(os.time()) -- random max json table size local i = math.random(#kc) local link_image = kc[i].file_url return link_image end local function run(msg, matches) local tag = matches[1] local tag = string.gsub(tag, " ", '_' ) local receiver = get_receiver(msg) local url = get_kc2(tag) send_photo_from_url(receiver, url, send_title, {receiver, title}) return "Source: "..url end return { description = "Sendet Bild von Konachan.com [NSFW]", usage = {"/konansfw [Tags]","/kcn [Tags]"}, patterns = {"^/konansfw (.*)$","^/kcn (.*)$"}, run = run } end