cclink/cclink.lua
2023-10-20 02:00:19 -04:00

25 lines
481 B
Lua

BASE_URL="https://node.protogen.io/secret-endpoint"
WEBHOOKS={
-- wehbook when powered
[true] = BASE_URL .. "/ping",
-- wehbook when unpowered
[false] = BASE_URL .. "/",
}
-- example
-- PAYLOAD="meow! :3"
PAYLOAD=nil
HEADERS={
["Content-Type"] = "text/plain",
}
while true do
state=false
os.pullEvent("redstone")
for _, v in pairs(redstone.getSides()) do
if redstone.getInput(v) == true then
state=true
end
end
http.request(WEBHOOKS[state], PAYLOAD, HEADERS)
end