summaryrefslogtreecommitdiff
path: root/chat.lua
blob: b757185a9ff97680c7eeaa616008ce2780bf6c69 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
local p = peripheral.find"manipulator"
assert(p and p.hasModule"plethora:chat")
local m = peripheral.wrap"monitor"
assert(m)

local function p(...)
	term.redirect(m)
	print(...)
	term.redirect(term.native())
end

local score(msg)
	local s = 0
	for m in a:gmatch"%-?%d+" do s=s+m end
	return s
end

while true do
	local _,user,msg = os.pullEvent"chat_message"
	local s = score(msg)
	p(string.format("(%d) <%s> %s",s,user,msg))
end
	

end