diff options
author | lassulus <lassulus@googlemail.com> | 2013-11-08 13:15:52 +0100 |
---|---|---|
committer | lassulus <lassulus@googlemail.com> | 2013-11-08 13:15:52 +0100 |
commit | 2d823c8f8557f0a49e4307717e99a90b24052e9c (patch) | |
tree | e4f8bb03435b5385189ee6a9552c5afe616e7835 /webchat/public/commands.js | |
parent | 9210cdcdd8f9b7cf1bc48dcc01914b1d2530820d (diff) |
webchat: refactored code
Diffstat (limited to 'webchat/public/commands.js')
-rw-r--r-- | webchat/public/commands.js | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/webchat/public/commands.js b/webchat/public/commands.js new file mode 100644 index 00000000..8cd3bba1 --- /dev/null +++ b/webchat/public/commands.js @@ -0,0 +1,25 @@ +var commands = {} + +commands.say = function (settings, params) { + var sendObj = { + method: 'say', + params: { message: params }, + }; + sock.send(JSON.stringify(sendObj)) +} + +commands.nick = function (settings, params) { + settings.nick = params + var sendObj = { + method: 'nick', + params: { nick: params }, + } + sock.send(JSON.stringify(sendObj)) +} + +commands.badcommand = function (settings, params) { + console.log("error"); + chatboxAppend( '<span class="from_system">error</span>', 'command not found' ) + + +} |