Gloorian

Untitled

Feb 20th, 2012
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. var irc = require('irc'),
  2.     fs = require('fs'),
  3.     date_object = '';
  4.  
  5. var client = new irc.Client('irc.opera.com', 'gloo_bot', {channels: ['#opera-fr']});
  6.  
  7. client.addListener('message', function(from, to, message) {
  8.     fs.open('irc.log', 'a', function(e, id) {
  9.         date_object = new Date();
  10.         fs.write(id, '< ' + date_object.toLocaleString() + ' >' + ' ' + from + ' : ' + message + '\n', null, 'utf-8', function(){
  11.             fs.close(id, function(){});
  12.         });
  13.     });
  14.     if(message.toLowerCase() == 'bonsoir')
  15.     {
  16.         client.say('#opera-fr', 'Bonsoir ' + from);
  17.     }
  18.     if(message.toLowerCase() == "!ping")
  19.     {
  20.         client.say('#opera-fr', "POOOOOOOOOOONG !!");
  21.     }
  22. });
Advertisement
Add Comment
Please, Sign In to add comment