mirror of
https://github.com/osmarks/random-stuff
synced 2025-01-25 00:16:59 +00:00
Merge branch 'master' of https://github.com/osmarks/random-stuff
This commit is contained in:
commit
1e062135b3
@ -1,5 +1,5 @@
|
||||
local function update()
|
||||
local h = http.get "https://pastebin.com/raw/L0ZKLBRG"
|
||||
local h = http.get "https://raw.githubusercontent.com/osmarks/misc/master/computercraft/lms.lua"
|
||||
local f = fs.open(shell.getRunningProgram(), "w")
|
||||
f.write(h.readAll())
|
||||
f.close()
|
||||
@ -109,7 +109,7 @@ local function send()
|
||||
if preproc(msg) == "" then
|
||||
print_message "Your message is considered spam."
|
||||
else
|
||||
add_message(msg, username)
|
||||
add_message(msg, username:sub(1, 16))
|
||||
m.transmit(chan, chan, { message = msg, username = username })
|
||||
end
|
||||
end
|
||||
@ -119,7 +119,7 @@ end
|
||||
local function recv()
|
||||
while true do
|
||||
local _, _, channel, _, message = os.pullEvent "modem_message"
|
||||
if channel == chan and type(message) == "table" and message.message and message.username then
|
||||
if channel == chan and type(message) == "table" and message.message and message.username and type(message.message) == "string" and type(message.username) == "string" then
|
||||
notification_sound()
|
||||
add_message(message.message, message.username)
|
||||
end
|
||||
@ -127,4 +127,4 @@ local function recv()
|
||||
end
|
||||
|
||||
m.transmit(chan, chan, { username = username, message = "Connected." })
|
||||
parallel.waitForAny(send, recv)
|
||||
parallel.waitForAny(send, recv)
|
||||
|
Loading…
Reference in New Issue
Block a user