blob: 05c9ea0eedb202ba0d6d2eab91629868dd6578ac (
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 || 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
|