From 3f84bcd9ec51279085ce1f996869fecadd2b60c6 Mon Sep 17 00:00:00 2001 From: secret_online Date: Mon, 18 Jan 2016 20:53:07 +1300 Subject: Add var keyword to variable declarations Also added strict mode declaration. Linter should now pick up on strict mode invalidations. --- index.js | 15 ++++++++------- 1 file changed, 8 insertions(+), 7 deletions(-) diff --git a/index.js b/index.js index 24e6464..f3bebbc 100644 --- a/index.js +++ b/index.js @@ -1,4 +1,5 @@ /*jslint bitwise: true, node: true */ +'use strict'; var Discord = require("discord.js"); var Rcon = require("rcon"); @@ -39,17 +40,17 @@ app.use(function(request, response, next) { shulker.on("ready", function() { var channel = shulker.channels.get("name", c.DISCORD_CHANNEL).id; app.post(c.WEBHOOK, function(request, response){ - body = request.rawBody; - console.log("[INFO] Recieved "+body); - re = new RegExp(c.REGEX_MATCH_CHAT_MC); - ignored = new RegExp(c.REGEX_IGNORED_CHAT); + var body = request.rawBody; + console.log("[INFO] Recieved "+body); + var re = new RegExp(c.REGEX_MATCH_CHAT_MC); + var ignored = new RegExp(c.REGEX_IGNORED_CHAT); if(!ignored.test(body)) { - bodymatch = body.match(re); + var bodymatch = body.match(re); if(debug) { console.log("[DEBUG] Username: "+bodymatch[1]); console.log("[DEBUG] Text: "+bodymatch[2]); } - message = "**"+bodymatch[1]+"**: "+bodymatch[2]; + var message = "**"+bodymatch[1]+"**: "+bodymatch[2]; shulker.channels.get("id", channel).sendMessage(message); } response.send(""); @@ -58,7 +59,7 @@ shulker.on("ready", function() { shulker.on("message", function (message) { if(message.author.id !== shulker.user.id) { - data = { text: "<"+message.author.username+"> "+message.content }; + var data = { text: "<"+message.author.username+"> "+message.content }; client.send('tellraw @a ["",'+JSON.stringify(data)+']'); } }); -- cgit 1.4.1