Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- -- Stupidità artificiale
- -- (C) 2022 - FoxInvest Holding
- -- Tutti i diritti riservati (forse)
- maxw, maxh = term.getSize()
- local function drawPixelInternal(xPos, yPos)
- term.setCursorPos(xPos, yPos)
- term.write(" ")
- end
- local tColourLookup = {}
- for n = 1, 16 do
- tColourLookup[string.byte("0123456789abcdef", n, n)] = 2 ^ (n - 1)
- end
- function drawFilledBox(startX, startY, endX, endY, nColour)
- if type(startX) ~= "number" or type(startX) ~= "number" or type(endX) ~=
- "number" or type(endY) ~= "number" or
- (nColour ~= nil and type(nColour) ~= "number") then
- error("Expected startX, startY, endX, endY, colour", 2)
- end
- startX = math.floor(startX)
- startY = math.floor(startY)
- endX = math.floor(endX)
- endY = math.floor(endY)
- if nColour then term.setBackgroundColor(nColour) end
- if startX == endX and startY == endY then
- drawPixelInternal(startX, startY)
- return
- end
- local minX = math.min(startX, endX)
- if minX == startX then
- minY = startY
- maxX = endX
- maxY = endY
- else
- minY = endY
- maxX = startX
- maxY = startY
- end
- for x = minX, maxX do for y = minY, maxY do drawPixelInternal(x, y) end end
- end
- function clear()
- sfondo(colors.black)
- term.clear()
- term.setCursorPos(1, 1)
- end
- function clearRed()
- sfondo(colors.red)
- term.clear()
- term.setCursorPos(1, 1)
- end
- function titolo(testo)
- drawFilledBox(1, 1, maxw, 1, colors.orange)
- term.setCursorPos((maxw - #testo) / 2, 1)
- term.setTextColor(colors.white)
- term.write(testo)
- end
- function alarm(testo, colore, y)
- drawFilledBox(1, y, maxw, y, colors[colore])
- term.setCursorPos((maxw - #testo) / 2, y)
- term.setTextColor(colors.white)
- term.write(testo)
- no()
- end
- function bottone(color, text, x, y)
- term.setBackgroundColor(colors[color])
- term.setTextColor(colors.white)
- term.setCursorPos(x, y)
- print(text)
- end
- function no()
- term.setBackgroundColor(colors.white)
- term.setTextColor(colors.black)
- end
- term.setCursorPos(1, 1)
- term.setBackgroundColor(colors.black)
- term.setTextColor(colors.white)
- term.clear()
- x, y = term.getSize()
- while true do
- titolo("Chat hot con Hiro Akiba <3")
- term.setBackgroundColor(colors.black)
- term.setCursorPos(1, 18)
- print("<Tu> ")
- term.setCursorPos(6, 18)
- rold = read()
- if rold == "quit" or rold == "exit" then
- shell.run("desktop")
- end
- rq = string.gsub(rold, "%s", "%%20")
- if rq ~= nil and rq ~= "" then
- id = os.getComputerID()
- rsp = http.get("http://172.16.20.220/luanet/servlets/foxbot/?ask=" .. rq .. "&id=" .. id)
- response = rsp.readAll()
- rsp.close()
- if response == nil then
- response = "(La richiesta non e' arrivata al server!)"
- end
- -- Provvediamo a filtrare la risposta
- if string.find(response, "Sul serio? Sembra un bambino di 8 anni |:") ~= nil then
- response = "Sul serio? Sembra un bambino di 8 anni |:"
- elseif string.find(response, "https://syrma.fcosma.it/bot/nsfw_hiro_1_1.gif") ~= nil then
- response = "*Haaa... You taste so good...*"
- getImg = http.get("http://172.16.20.220/luanet/servlets/foxbot/r34.php?scene=hiro00").readAll()
- elseif string.find(response, "https://syrma.fcosma.it/bot/nsfw_hiro_1_0.png") ~= nil then
- response = "*Uhhh... lo vuoi vedere~... Eccoti accontentato :wink:*"
- getImg = http.get("http://172.16.20.220/luanet/servlets/foxbot/r34.php?scene=spogliati").readAll()
- elseif string.find(response, "https://syrma.fcosma.it/bot/nsfw_hiro_1_1.png") ~= nil then
- response = "*Uhhh... lo vuoi vedere~... Eccoti accontentato :wink:*"
- getImg = http.get("http://172.16.20.220/luanet/servlets/foxbot/r34.php?scene=spogliati").readAll()
- end
- else
- response = "<ErrorManager> Non hai scritto niente!"
- end
- -- Stampiamo la risposta del bot con sopra quella dell'utente
- if getImg ~= nil and getImg ~= "" and #getImg < 1 then
- print("<Hiro> " .. response)
- print(getImg)
- getImg = nil
- else
- print("<Hiro> " .. response)
- end
- print("")
- rsp = nil
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement