Merge branch 'promise' of https://github.com/M2Ys4U/KiwiIRC into M2Ys4U-promise
[KiwiIRC.git] / server_modules / example.js
1 var kiwiModules = require('../server/modules');
2
3 var module = new kiwiModules.Module('Example Module');
4
5
6 // A web client is connected
7 module.on('client created', function(event, data) {
8 console.log('[client connection]', data);
9 event.callback();
10 });
11
12
13 // The Client recieves a IRC PRIVMSG command
14 module.on('irc message', function(event, data) {
15 console.log('[MESSAGE]', data.irc_event);
16 event.callback();
17 });
18
19 // The Client recieves a IRC USER NOTICE command
20 module.on('irc user notice', function(event, data) {
21 console.log('[NOTICE]', data.irc_event);
22 event.callback();
23 });
24
25 // The client recieves an IRC JOIN command
26 module.on('irc channel join', function(event, data) {
27 console.log('[JOIN]', data.irc_event);
28 event.callback();
29 });
30
31
32 // A command has been sent from the client
33 module.on('client command', function(event, data) {
34 var client_method = data.command.method;
35 var client_args = data.command.args;
36
37 console.log('[CLIENT COMMAND]', client_method);
38 console.log(' ', client_args);
39 event.callback();
40 });