From 0214c9120e8d1a6be83874015a393d50ab9e3518 Mon Sep 17 00:00:00 2001 From: ArowShot Date: Sun, 2 Jul 2017 23:41:10 -0400 Subject: [PATCH] Added support for snitch log in/out messages --- app.js | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/app.js b/app.js index 36a5248..932b754 100644 --- a/app.js +++ b/app.js @@ -52,8 +52,8 @@ function truncate(str, len) { return str.toString().substring(0, len) } -async function sendSnitchMessage(user, snitchName, worldName, x, y, z) { - await discordClient.channels.get(config.botchannel).send(`\`${user} entered ${snitchName} at ${x}, ${y}, ${z}\``) +async function sendSnitchMessage(user, action, snitchName, worldName, x, y, z) { + await discordClient.channels.get(config.botchannel).send(`\`${user} ${action} ${snitchName} at ${x}, ${y}, ${z}\``) } async function sendChatMessage(channel, username, message) { @@ -66,10 +66,10 @@ async function sendChatMessage(channel, username, message) { await webhook.send(message) } -var snitch = /^ \* (\w+) entered snitch at (\w+) \[(\w+) (\d+) (\d+) (\d+)\]/ +var snitch = /^ \* (\w+) (entered|logged out in|logged in to) snitch at (\w+) \[(\w+) (\d+) (\d+) (\d+)\]/ function handleSnitchMessage(msg) { var matches = snitch.exec(msg) - sendSnitchMessage(matches[1], matches[2], matches[3], matches[4], matches[5], matches[6]) + sendSnitchMessage(matches[1], matches[2], matches[3], matches[4], matches[5], matches[6], matches[7]) } var nl_msg = /^\[(\w+)\] (\w+): (.+)/