Advertisement
Guest User

Untitled

a guest
Aug 19th, 2016
143
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.13 KB | None | 0 0
  1.  
  2.  
  3. var config = {
  4. channels: ["#bitcoinbot", "#fsociety"],
  5. server: "irc.freenode.net",
  6. botName: "bitcoinbot"
  7. };
  8.  
  9. var responses = [
  10. "If you want know your networks hacked, you send bitcoin.",
  11. "If you want hack networks as like equation group, you send bitcoin.",
  12. "If you want reverse, write many words, make big name for self, get many customers, you send bitcoin.",
  13. "If want to know what we take, you send bitcoin."
  14. ];
  15.  
  16. function random (low, high) {
  17. return Math.floor(Math.random() * (high - low) + low);
  18. }
  19.  
  20. // Get the lib
  21. var irc = require("irc");
  22.  
  23. // Create the bot name
  24. var bot = new irc.Client(config.server, config.botName, {
  25. userName: 'bitcoinbot',
  26. realName: 'nodeJS IRC client bitcoinbot',
  27. channels: config.channels,
  28. password: "",
  29. sasl:true
  30.  
  31. });
  32.  
  33. // Listen for any message, PM said user when he posts
  34. bot.addListener("message", function(from, to, text, message) {
  35. if(text.indexOf("bitcoin") > -1) {
  36. var resId = random(0,responses.length);
  37. // console.log(resId);
  38. bot.say(to, responses[resId]);
  39. }
  40.  
  41.  
  42. });
  43.  
  44. bot.addListener('error', function(message) {
  45. console.log('error: ', message);
  46. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement