computercraft-scripts/flow-gate-monitor/startup.lua

36 lines
751 B
Lua

local file = fs.open("config.json", "r")
local config = textutils.unserializeJSON(file.readAll())
file.close()
local PC_ID = config["PC_ID"]
local WH_URL = config["WH_URL"]
print("@============@")
print("| No touchy! |")
print("@============@")
print("")
print("ID: " .. PC_ID)
function alert()
local success = false
while not success do
local res = http.post(
WH_URL .. '?wait=true',
'{"embeds": [ { "title": "Program exited", "author": { "name": "' .. PC_ID .. '" }, "color": 16711680 } ] }',
{ ['Content-Type'] = 'application/json' },
false
)
if res ~= nil then
success = true
else
sleep(1)
end
end
end
while true do
shell.run("sus")
print("Restarting.")
alert()
sleep(5)
end