summary refs log tree commit diff homepage
diff options
context:
space:
mode:
authorsecret_online <me+github@secretonline.co>2016-01-18 20:53:07 +1300
committersecret_online <me+github@secretonline.co>2016-01-18 20:53:07 +1300
commit3f84bcd9ec51279085ce1f996869fecadd2b60c6 (patch)
treeb5672f2d757a92f0f7dd09bc3751f5694b5ceea5
parentAdd Suggestions and fix one comment (diff)
downloadshulker-3f84bcd9ec51279085ce1f996869fecadd2b60c6.tar.gz
shulker-3f84bcd9ec51279085ce1f996869fecadd2b60c6.zip
Add var keyword to variable declarations
Also added strict mode declaration. Linter should now pick up on strict
mode invalidations.
-rw-r--r--index.js15
1 files 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)+']');
     }
 });