summaryrefslogtreecommitdiff
path: root/chat.lua
diff options
context:
space:
mode:
authorubq323 <ubq323@ubq323.website>2022-08-04 01:07:39 +0100
committerubq323 <ubq323@ubq323.website>2022-08-04 01:07:39 +0100
commitb7be0d0902b092ff1b7e57e7fc819150e85cfd16 (patch)
tree9a870cf3ea4fdc7ec613f59968b67b4830b45811 /chat.lua
parent04c3da59620c9cf3d826f209bcb4b55b255517b5 (diff)
chat
Diffstat (limited to 'chat.lua')
-rw-r--r--chat.lua14
1 files changed, 10 insertions, 4 deletions
diff --git a/chat.lua b/chat.lua
index e21da68..b757185 100644
--- a/chat.lua
+++ b/chat.lua
@@ -1,5 +1,3 @@
-local md5 = require("md5").hash
-
local p = peripheral.find"manipulator"
assert(p and p.hasModule"plethora:chat")
local m = peripheral.wrap"monitor"
@@ -11,9 +9,17 @@ local function p(...)
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 h = md5(msg)
+ local s = score(msg)
+ p(string.format("(%d) <%s> %s",s,user,msg))
+end
- p("<"..user.."> ["..h.."] "..msg)
+
end