Browse Source

lowercase room names

isundil 6 years ago
parent
commit
d9c33fe413
1 changed files with 13 additions and 3 deletions
  1. 13 3
      index.js

+ 13 - 3
index.js

@@ -67,6 +67,7 @@ function KnackiBot() {
         });
     this.bot.addListener("error", console.error);
     this.bot.addListener("join", (chan, nick) => {
+        chan = chan.toLowerCase();
         if (_this.modules[chan]) {
             if (nick == _this.name)
                 _this.modules[chan].onSelfJoin();
@@ -75,22 +76,31 @@ function KnackiBot() {
         }
     });
     this.bot.addListener("names", (chan, nicks) => {
+        chan = chan.toLowerCase();
         _this.modules[chan] && _this.modules[chan].onNameList(nicks);
     });
-    this.bot.addListener("part", (chan, nick) => { _this.modules[chan] && _this.modules[chan].onNickPart(nick); });
-    this.bot.addListener("kick", (chan, nick) => { _this.modules[chan] && _this.modules[chan].onNickPart(nick); });
+    this.bot.addListener("part", (chan, nick) => {
+        chan = chan.toLowerCase();
+        _this.modules[chan] && _this.modules[chan].onNickPart(nick);
+    });
+    this.bot.addListener("kick", (chan, nick) => {
+        chan = chan.toLowerCase();
+        _this.modules[chan] && _this.modules[chan].onNickPart(nick);
+    });
     this.bot.addListener("nick", (oldNick, newNick) => {
         for (var i in _this.modules)
             _this.modules[i].onRename(oldNick, newNick);
     });
     this.bot.addListener("+mode", (chan, by, mode, user) => {
+        chan = chan.toLowerCase();
         user && _this.modules[chan] && _this.modules[chan].onAddMode(user, mode);
     });
     this.bot.addListener("-mode", (chan, by, mode, user) => {
+        chan = chan.toLowerCase();
         user && _this.modules[chan] && _this.modules[chan].onRemMode(user, mode);
     });
     this.bot.addListener("message", (user, room, text) => {
-	room = room.toLowerCase();
+        room = room.toLowerCase();
         _this.modules[room] && _this.modules[room].onMessage(user, text);
     });
 }