do local user = cred_data.sankaku_username local password = cred_data.sankaku_pw --Your SHA1 hashed password. (echo "choujin-steiner--YOUR-PASSWORD--" | sha1sum) local function get_complex(tag) local BASE_URL = 'https://chan.sankakucomplex.com' local url = BASE_URL..'/post/index.json?login='..user..'&password_hash='..password..'&tags='..tag local b,c = https.request(url) if c ~= 200 then return nil end local complex = json:decode(b) -- truly randomize math.randomseed(os.time()) -- random max json table size local i = math.random(#complex) local link_image = 'https:'..complex[i].file_url return link_image end local function run(msg, matches) local tag = matches[1] local tag = string.gsub(tag, " ", '_' ) local tag = string.gsub(tag, ":", '%%3A' ) local receiver = get_receiver(msg) local url = get_complex(tag) if string.match(url, ".gif") or string.match(url, ".zip") or string.match(url, ".webm") or string.match(url, ".mp4") then send_document_from_url(receiver, url) else send_photo_from_url(receiver, url, send_title, {receiver, title}) end return "Source: "..url end return { description = "Sendet ein zufälliges Bild von Sankakucomplex.", usage = {"#sankaku [Tags]","#sc [Tags]"}, patterns = {"^#sankaku (.*)$","^#sc (.*)$"}, run = run } end