blob: 8f2875b95848aaea6b118c6ce3ec3359276c3e67 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
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
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
|