Update linkedGet.lua
This commit is contained in:
parent
ed999ffe4c
commit
ca9b74a530
1 changed files with 6 additions and 13 deletions
|
@ -1,23 +1,14 @@
|
|||
local event = require("event")
|
||||
local keyboard = require("keyboard")
|
||||
local component = require("component")
|
||||
local fs = require("filesystem")
|
||||
local internet = require("internet")
|
||||
local tunnel = component.tunnel
|
||||
|
||||
local success = "console: команда выполнена успешно"
|
||||
local fail = "console: неизвестная команда - пиши help"
|
||||
|
||||
function os.dateRL(format)
|
||||
if not fs.get("/").isReadOnly() then
|
||||
local time = io.open("/tmp/.time", "w")
|
||||
time:write()
|
||||
time:close()
|
||||
os.sleep(0.01)
|
||||
return os.date(format, fs.lastModified("/tmp/.time") / 1002.7)
|
||||
else
|
||||
return os.date(format)
|
||||
end
|
||||
function getTime()
|
||||
local _, _, _, _, _, time = event.pull("modem_message")
|
||||
return time
|
||||
end
|
||||
|
||||
function handleMessage(msg)
|
||||
|
@ -43,7 +34,9 @@ end
|
|||
while true do
|
||||
local _, _, from, _, _, message = event.pull("modem_message")
|
||||
local answer = handleMessage(tostring(message))
|
||||
local log = "["..os.dateRL("%x %X").."] "..getUser(tostring(from))..": "..message.."\n".."["..os.dateRL("%x %X").."] "..answer
|
||||
local time = getTime()
|
||||
local user = getUser(tostring(from))
|
||||
local log = "["..time.."] "..user..": "..message.."\n".."["..time.."] "..answer
|
||||
print(log)
|
||||
local f = io.open("logs.txt", "a")
|
||||
f:write(log.."\n")
|
||||
|
|
Loading…
Reference in a new issue