Advertisement
Guest User

Untitled

a guest
Feb 18th, 2016
73
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. import socket, string, random, time
  2. HOST = "irc.twitch.tv"
  3. NICK = "notnuulsbot"
  4. PORT = 6667
  5. PASS = "oauth:qp6s0f01jsj5hjfilt0amffezbss9m"
  6. readbuffer = ""
  7. MODT = False
  8. global t
  9. t = time.time()
  10. global tping
  11. tping = time.time()
  12. s = socket.socket()
  13. s.connect((HOST, PORT))
  14. s.send("PASS " + PASS + "\r\n")
  15. s.send("NICK " + NICK + "\r\n")
  16. s.send("JOIN #os_sloth \r\n")
  17. def Send_message(message):
  18. s.send("PRIVMSG #os_sloth :" + message + "\r\n")
  19.  
  20.  
  21.  
  22. while True:
  23. readbuffer = readbuffer + s.recv(1024)
  24. temp = string.split(readbuffer, "\n")
  25. readbuffer = temp.pop()
  26. for line in temp:
  27. if (line[0] == "PING"):
  28. s.send("PONG %s\r\n" % line[1])
  29. else:
  30.  
  31. parts = string.split(line, ":")
  32.  
  33.  
  34.  
  35. if "QUIT" not in parts[1] and "JOIN" not in parts[1] and "PART" not in parts[1]:
  36. try:
  37.  
  38. message = parts[2][:len(parts[2]) - 1]
  39. except:
  40. message = ""
  41.  
  42. usernamesplit = string.split(parts[1], "!")
  43. username = usernamesplit[0]
  44.  
  45. if t + 2 < time.time():
  46. if "!" in message:
  47. checkCom(user, message)
  48. t = time.time()
  49.  
  50. if MODT:
  51. print username + ": " + message
  52.  
  53.  
  54.  
  55.  
  56. if "sup" in message:
  57. Send_message("sup " + username + " nymnWink ")
  58. if "pun" in message:
  59. foo = ['Having sex in an elevator is wrong on so many levels.',
  60. 'When I get naked in the bathroom, the shower usually gets turned on.',
  61. 'I couldnt work out how to fasten my seatbelt. Then it clicked.',
  62. 'If Apple made a car, would it have Windows?',
  63. 'Thank god for nipples. Without it, boobs would be pointless.',
  64. 'Vagina jokes arent funny. Period.',
  65. 'There are plenty of fish in the sea but until I catch one Im just stuck here holding my rod...']
  66. Send_message((random.choice(foo)))
  67. if "zloty" in message :
  68. Send_message(" PogChamp ")
  69. if "notnuulsbot" in message:
  70. Send_message("YES SIR gachiGASM ")
  71.  
  72.  
  73.  
  74.  
  75.  
  76. for l in parts:
  77. if "End of /NAMES list" in l:
  78. MODT = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement