Advertisement
Guest User

challenge bot 1.0

a guest
Jan 15th, 2019
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.91 KB | None | 0 0
  1. const tmi = require('tmi.js');
  2. var oauth = require('./oauth.json');
  3. var rand = require('random-js');
  4. var engine = rand.engines.nativeMath;
  5.  
  6. var channels = ['#themysteriouslizzy']; //Channel to join here
  7. var yourUsername = 'kd8lvt'; //Change this to your username
  8.  
  9. var options = {
  10. options: {
  11. debug: true
  12. },
  13. connection: {
  14. reconnect: true
  15. },
  16. identity: {
  17. username: oauth.username,
  18. password: oauth.oauth
  19. },
  20. channels: channels
  21. };
  22.  
  23. var bot = new tmi.client(options);
  24. bot.connect();
  25.  
  26. bot.on('chat', function (channel,userstate,msg,self) {
  27. if (self) return;
  28.  
  29. if (msg.toLowerCase().indexOf('has challenged '+yourUsername+' to a hug battle!') > -1) {
  30. var split = msg.split('!');
  31. var desired = split[2];
  32. var split2 = desired.split(' ');
  33. var challengerName = split2[1];
  34.  
  35. setTimeout(function() {bot.say(channel,'!challenge '+challengerName);},(rand.integer(10,15)(engine)*1000));
  36. }
  37. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement