summaryrefslogtreecommitdiffstats
path: root/webchat/serverCommands.js
diff options
context:
space:
mode:
Diffstat (limited to 'webchat/serverCommands.js')
-rw-r--r--webchat/serverCommands.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/webchat/serverCommands.js b/webchat/serverCommands.js
new file mode 100644
index 00000000..05c9ea0e
--- /dev/null
+++ b/webchat/serverCommands.js
@@ -0,0 +1,26 @@
+
+
+var serverCommands = {};
+serverCommands.say = function (settings, params) {
+ var nick = settings.nick
+ var message = params.msg
+ params.nick = nick
+ irc_client.say("#krebs", nick + ' → ' + message);
+ return clients.notifyAll('message', params)
+// return clients.broadcast({ method: 'message', params: params })
+
+}
+
+serverCommands.nick = function (settings, params) {
+ var oldnick = settings.nick || settings.conn.remoteAddress
+ var newnick = params.nick
+ settings.nick = newnick
+ return clients.notifyAll('nickchange', { nick: oldnick, newnick: newnick });
+// return clients.broadcast({ method: 'nickchange', params: { nick: oldnick, newnick: newnick }})
+}
+
+serverCommands.badcommand = function (settings, params) {
+ settings.conn.write(JSON.stringify({ method: 'usererror', params: { message: 'bad command' }}))
+}
+
+module.exports = serverCommands