Advertisement
osmarks

ExU Screen Ctrl

Oct 26th, 2023 (edited)
824
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Lua 0.85 KB | None | 0 0
  1. local ax, bx = -45, -43
  2. local ay, by = 66, 67
  3. local az, bz = -96, -96
  4.  
  5. local function seturl(url)
  6.      for x = ax, bx do
  7.         for y = ay, by do
  8.             for z = az, bz do
  9.                 commands.blockdata(x, y, z, textutils.serialiseJSON({ image_id = url }, true))
  10.             end
  11.         end
  12.     end
  13. end
  14.  
  15. local function memesearch(query)
  16.     local res = http.post("https://mse.osmarks.net/backend", textutils.serialiseJSON({text={{query, 1}}}))
  17.     return textutils.unserialiseJSON(res.readAll())
  18. end
  19.  
  20. while true do
  21.     local _, _, user, message = os.pullEvent "chat_message"
  22.     local file
  23.     for _, result in ipairs(memesearch(message)) do
  24.         local f = result.file:lower()
  25.         if f:match ".jpe?g$" or f:match ".png$" then
  26.             file = result.file
  27.             break
  28.         end
  29.     end
  30.     seturl("https://i2.osmarks.net/thumbs/" .. ("memes-or-something/" .. file):gsub("[^-A-Za-z0-9]", "_") .. ".jpeg-256k.jpeg")
  31. end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement