do local function get_kc(tag) local url = 'http://konachan.net/post.json?tags='..tag..' -rating:explicit' 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_kc(tag) send_photo_from_url(receiver, url, send_title, {receiver, title}) return "Source: "..url end return { description = "Sendet ein Bild von Konachan.net [SFW]", usage = {"/konachan [Tags]","/kc"}, patterns = {"^/konachan (.*)$","^/kc (.*)$"}, run = run } end