summaryrefslogtreecommitdiffstats
path: root/webchat/serverCommands.js
blob: dd755a97c8a86fabed8679b331934625329d950e (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
var serverCommands = {};
serverCommands.say = function (serverstate, settings, params) {
  var nick = settings.nick
  var message = params.msg
  params.nick = nick
  serverstate.irc_client.say("#krebs", nick + ' → ' + message);
  return serverstate.clients.notifyAll('message', params)
}

serverCommands.nick = function (serverstate, settings, params) {
  var oldnick = settings.nick
  var newnick = params.nick
  settings.nick = newnick
  return serverstate.clients.notifyAll('nickchange', { nick: oldnick, newnick: newnick });
}

serverCommands.badcommand = function (serversate, settings, params) {
  settings.conn.write(JSON.stringify({ method: 'usererror', params: { message: 'bad command' }}))
}

module.exports = serverCommands