diff options
| author | Joe Robinson <joe@lc8n.com> | 2016-10-16 21:22:31 +0100 | 
|---|---|---|
| committer | Joe Robinson <joe@lc8n.com> | 2016-10-16 21:22:31 +0100 | 
| commit | bf695e6ad13b0fd0fb2706d6bf9960a66e656696 (patch) | |
| tree | 5a56e414bf92923a8c1adb458bdd0cd70bb39169 | |
| parent | f13842bc63f002e456727d1a48239d4e044d0c75 (diff) | |
Add mode handler
| -rw-r--r-- | handlers.js | 37 | 
1 files changed, 37 insertions, 0 deletions
diff --git a/handlers.js b/handlers.js index e68a14d..c6d86de 100644 --- a/handlers.js +++ b/handlers.js @@ -136,6 +136,43 @@ module.exports.handleCommands = function(myClient) {          });      }) +    client.on('mode', function(event) { +        var chatTab = $("[data-tab='"+ channel +"'].chat"); +        var by = event.nick +        var channel = event.target +        event.modes.forEach(function (modeObj) { + +            var mode = modeObj.mode +            var argument = modeObj.param +            if (mode == "+o") { +                modeLine = " gives channel operator status to " + argument; +            } else if (mode == "+v") { +                modeLine = " gives voice to " + argument; +            } else if (mode == "+h") { +                modeLine = " gives channel half-operator status to " + argument; +            } else if (mode == "+q") { +                modeLine = " gives channel owner status to " + argument; +            } else if (mode == "-o") { +                modeLine = " removes channel operator status from " + argument; +            } else if (mode == "-v") { +                modeLine = " removes voice from "; +            } else if (mode == "-h") { +                modeLine = " removes channel half-operator status from " + argument; +            } else if (mode == "-q") { +                modeLine = " removes channel owner status from " + argument; +            } else if (argument == myNick) { +                modeLine = " sets mode " + mode + " on " + argument; +            } else if (argument != null) { +                modeLine = " sets mode " + mode + " " + argument + " on " +channel; +            } else { +                modeLine = " sets mode "+mode+" on " +channel +            } +            var chatTab = $("[data-tab='"+ channel +"'].chat"); +            chatTab.append("<p class='chat-line'>"+by+modeLine+"</p>"); +        }) +        chatTab.scrollTop(chatTab.prop("scrollHeight")); +    }) +  }  function receiveMsg(target, from, message) {  | 
