Update linkedGet.lua
This commit is contained in:
parent
99494f5744
commit
2e797f5f75
1 changed files with 14 additions and 4 deletions
|
@ -20,21 +20,31 @@ function os.dateRL(format)
|
||||||
end
|
end
|
||||||
|
|
||||||
function handleMessage(msg)
|
function handleMessage(msg)
|
||||||
if message == "help" then
|
if msg == "help" then
|
||||||
return success
|
return success
|
||||||
elseif message == "rain" then
|
elseif msg == "rain" then
|
||||||
return success
|
return success
|
||||||
else
|
else
|
||||||
return fail
|
return fail
|
||||||
end
|
end
|
||||||
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
|
while true do
|
||||||
local _, _, from, _, _, message = event.pull("modem_message")
|
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)
|
print(log)
|
||||||
local f = io.open("logs.txt", "a")
|
local f = io.open("logs.txt", "a")
|
||||||
f:write(log.."/n")
|
f:write(log.."\n")
|
||||||
f:close()
|
f:close()
|
||||||
tunnel.send("succes!")
|
tunnel.send("succes!")
|
||||||
end
|
end
|
||||||
|
|
Loading…
Reference in a new issue