Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- local ax, bx = -45, -43
- local ay, by = 66, 67
- local az, bz = -96, -96
- local function seturl(url)
- for x = ax, bx do
- for y = ay, by do
- for z = az, bz do
- commands.blockdata(x, y, z, textutils.serialiseJSON({ image_id = url }, true))
- end
- end
- end
- end
- local function memesearch(query)
- local res = http.post("https://mse.osmarks.net/backend", textutils.serialiseJSON({text={{query, 1}}}))
- return textutils.unserialiseJSON(res.readAll())
- end
- while true do
- local _, _, user, message = os.pullEvent "chat_message"
- local file
- for _, result in ipairs(memesearch(message)) do
- local f = result.file:lower()
- if f:match ".jpe?g$" or f:match ".png$" then
- file = result.file
- break
- end
- end
- seturl("https://i2.osmarks.net/thumbs/" .. ("memes-or-something/" .. file):gsub("[^-A-Za-z0-9]", "_") .. ".jpeg-256k.jpeg")
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement