Advertisement
injectJon

Untitled

Dec 23rd, 2017
158
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. const tmi = require('tmi.js')
  2.  
  3. const username = 'TWITCH_USERNAME'
  4. const password = 'TWITCH_OAUTH'
  5.  
  6. const options = {
  7.     connection: {
  8.         reconnect: true,
  9.     },
  10.     identity: {
  11.         username,
  12.         password,
  13.     },
  14.     channels: ['#zizaran']
  15. }
  16.  
  17. const bot = new tmi.client(options)
  18.  
  19. bot.on('subscription', (channel, username, method, message, userstate) => {
  20.     switch (channel) {
  21.         case '#zizaran':
  22.             zizSub(channel, username, null, method, message, userstate)
  23.         default:
  24.             return
  25.     }
  26. })
  27.  
  28. bot.on('resub', (channel, username, months, message, userstate, methods) => {
  29.     switch (channel) {
  30.         case '#zizaran':
  31.             zizSub(channel, username, months, methods, message, userstate)
  32.     }
  33. })
  34.  
  35. function zizSub(channel, username, months, methods, message, userstate) {
  36.  
  37.     const resubMessage = `${months} months?!! Welcome back to the team ${username}!!! zizTeam zizTeam zizTeam zizTeam zizTeam zizTeam zizTeam zizTeam `
  38.     const subMessage = `Welcome to the team ${username}!! zizTeam zizTeam zizTeam zizTeam zizTeam zizTeam zizTeam zizTeam `
  39.  
  40.     if (!months) {
  41.         console.log(`<info> [#zizaran] ${subMessage}`)
  42.         bot.say(channel, subMessage)
  43.     } else {
  44.         console.log(`<info> [#zizaran] ${resubMessage}`)
  45.         bot.say(channel, resubMessage)
  46.     }
  47. }
  48.  
  49. bot.connect()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement