Advertisement
jurjendevries

Untitled

Feb 14th, 2021
832
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. // Create the configuration
  2. var config = {
  3.         channels: ["#logtoipfs"],
  4.         server: "irc.freenode.net",
  5.         botName: "logtoipfs"
  6. };
  7.  
  8. // Get the lib for IRC
  9. var irc = require("irc");
  10.  
  11. // Get the lib for filesystem writing
  12. fs = require('fs');
  13.  
  14. // Create the bot
  15. var bot = new irc.Client(config.server, config.botName, {
  16.         channels: config.channels
  17. });
  18.  
  19. // Listen for any message, write it to a file
  20.  bot.addListener("message", function(from, to, text, message) {
  21.     console.log(from + ' => ' + to + ': ' + text);
  22.  fs.writeFile('ipfs.log', text);
  23.  });
  24.  
  25. // Write errors to the console
  26. bot.addListener('error', function(message) {
  27.     console.log('error: ', message);
  28. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement