Advertisement
Guest User

Untitled

a guest
Jan 22nd, 2016
117
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.77 KB | None | 0 0
  1. import socket #imports module allowing connection to IRC
  2. import threading #imports module allowing timing functions
  3. import time
  4. import random
  5.  
  6. phrases = [
  7. "MrDestructoid BEEP BOOP ATOMICUS MrDestructoid",
  8. "MrDestructoid THIS MrDestructoid TRACK MrDestructoid IS MrDestructoid ILL MrDestructoid NASTY MrDestructoid",
  9. "MrDestructoid HEY MrDestructoid ATOMICUS MrDestructoid HOW MrDestructoid ABOUT MrDestructoid SOME MrDestructoid BROTHERMAN MrDestructoid VIEWBOT MrDestructoid",
  10. "MrDestructoid VIEWBOT #254743 REPORTING IN MrDestructoid"
  11. ]
  12.  
  13. def message(msg):
  14. irc.send("PRIVMSG " + channel + " :" + msg + "\n")
  15.  
  16. #sets variables for connection to twitch chat
  17. bot_owner = 'Gasolinebased'
  18. nick = 'fwnaeuifbweoyi'
  19. channel = '#atomicus'
  20. server = 'irc.twitch.tv'
  21. password = 'oauth:891j6yyz3nqg38afw1alxrn58eba07'
  22.  
  23. queue = 13 #sets variable for anti-spam queue functionality
  24.  
  25. irc = socket.socket()
  26. irc.connect((server, 6667)) #connects to the server
  27.  
  28. #sends variables for connection to twitch chat
  29. irc.send('PASS ' + password + '\r\n')
  30. irc.send('USER ' + nick + ' 0 * :' + bot_owner + '\r\n')
  31. irc.send('NICK ' + nick + '\r\n')
  32. irc.send('JOIN ' + channel + '\r\n')
  33.  
  34. startTime = int(round(time.time() * 1000))
  35. oldTime = 0
  36.  
  37. while True:
  38. babadata = irc.recv(1204) #gets output from IRC server
  39. babauser = babadata.split(':')[1]
  40. babauser = babauser.split('!')[0] #determines the sender of the messages
  41. print babadata
  42. currentTime = int(round(time.time() * 1000))
  43.  
  44. if babadata.find('MrDestructoid') != -1:
  45. message("MrDestructoid BEEP BOOP MrDestructoid")
  46.  
  47. print currentTime - oldTime
  48. if currentTime - oldTime > 31000: #to prevet removal from double messaging within 30 sec
  49. oldTime = currentTime
  50. message(random.choice(phrases))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement