31 lines
673 B
Lua
31 lines
673 B
Lua
local notify = require('libs/notify')
|
|
local net = require('libs/net')
|
|
|
|
local VERSION = '1.0.0'
|
|
|
|
local chatBox = peripheral.find('chatBox') or error('no chatBox peripheral found', 0)
|
|
|
|
local function notifyChat(message, prefix)
|
|
if not message then
|
|
print('warning: no message provided')
|
|
return
|
|
end
|
|
|
|
chatBox.sendMessage(message, prefix)
|
|
end
|
|
|
|
local function main()
|
|
net.openRednet()
|
|
|
|
print('Notify Server v' .. VERSION .. ' started')
|
|
|
|
net.listenQuery(notify.SERVER, function(message)
|
|
if message.type == 'notify-chat' and message.payload then
|
|
notifyChat(message.payload.message, message.payload.prefix)
|
|
end
|
|
end)
|
|
|
|
net.closeRednet()
|
|
end
|
|
|
|
main() |