Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- namespace = ""
- write_key = ""
- input_direction = "left"
- output_direction = "right"
- chest_a = peripheral.wrap("left")
- local char_to_hex = function(c)
- return string.format("%%%02X", string.byte(c))
- end
- function urlencode(url)
- if url == nil then
- return
- end
- url = url:gsub("\n", "\r\n")
- url = url:gsub("([^%w ])", char_to_hex)
- url = url:gsub(" ", "+")
- return url
- end
- while 1 do
- for slot, item in pairs(chest_a.list()) do
- print(("%d x %s in slot %d"):format(item.count, item.name, slot))
- chest_a.pushItems(output_direction, slot)
- log = urlencode("Found " .. item.count .. " blocks of " .. item.name)
- http.request("https://api.constellations.tech/v2/" .. namespace .. "?key=" .. write_key .. "&tag=" .. item.name .. "&value=" .. item.count .. "&log=" .. log)
- end
- os.sleep(10)
- end
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement