summaryrefslogtreecommitdiffstats
path: root/webchat/public/commands.js
diff options
context:
space:
mode:
authorlassulus <lassulus@googlemail.com>2013-11-08 13:15:52 +0100
committerlassulus <lassulus@googlemail.com>2013-11-08 13:15:52 +0100
commit2d823c8f8557f0a49e4307717e99a90b24052e9c (patch)
treee4f8bb03435b5385189ee6a9552c5afe616e7835 /webchat/public/commands.js
parent9210cdcdd8f9b7cf1bc48dcc01914b1d2530820d (diff)
webchat: refactored code
Diffstat (limited to 'webchat/public/commands.js')
-rw-r--r--webchat/public/commands.js25
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' )
+
+
+}