services.js 726 B

12345678910111213141516171819202122232425262728293031
  1. var irc = require('./irc');
  2. var events = {
  3. 'netSynced': [],
  4. 'botMessage': [],
  5. 'channelMessage': [],
  6. 'channelNotice': [],
  7. 'botNotice': [],
  8. 'serverDelete': [],
  9. 'channelCreate': [],
  10. 'userCreate': [],
  11. 'serverCreate': [],
  12. 'uplinkLost': [],
  13. 'userDelete': [],
  14. 'doEvent': function(event, args){
  15. if(event in events){
  16. for(var i=0; i<events[event].length; i++){
  17. args = events[event][i](args);
  18. }
  19. } else {
  20. console.log('Called unknown event '+event);
  21. }
  22. return args;
  23. }
  24. };
  25. irc.setEvents(events);
  26. irc.setConnection('localhost', 6667, 'unrealircd');
  27. var myUser = irc.makeUser('TestServ', 'pirc', 'serwisy.pirc.pl', 'Użytkownik testowy');
  28. var myChannel = irc.getChannel('#test');
  29. myChannel.joinUser(myUser);