Update linkedGet.lua

This commit is contained in:
erius0 2021-01-08 04:24:12 +03:00 committed by GitHub
parent 99494f5744
commit 2e797f5f75
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23

View file

@ -20,21 +20,31 @@ function os.dateRL(format)
end
function handleMessage(msg)
if message == "help" then
if msg == "help" then
return success
elseif message == "rain" then
elseif msg == "rain" then
return success
else
return fail
end
end
function getUser(from)
if from == "b7585fb7-1ae4-4f94-b1a2-05e1cef76a1f" then
return "erius"
elseif from == "0952a2dd-23fa-4dd2-aefe-92e7cd6c77ce" then
return "DummyWalrus"
else
return "???"
end
end
while true do
local _, _, from, _, _, message = event.pull("modem_message")
local log = "["..os.dateRL("%x %X").."]".." "..from..": "..message.."/n"..handleMessage(message)
local log = "["..os.dateRL("%x %X").."]".." "..getUser(from)..": "..message.."\n"..handleMessage(message)
print(log)
local f = io.open("logs.txt", "a")
f:write(log.."/n")
f:write(log.."\n")
f:close()
tunnel.send("succes!")
end