Advertisement
Guest User

Untitled

a guest
Aug 15th, 2016
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.82 KB | None | 0 0
  1. import socket, string
  2. import time
  3.  
  4. HOST = "irc.twitch.tv"
  5. NICK = "jewsless"
  6. PORT = 6667
  7. PASS = "oauth:3c7yntkpx4pujrw20j0ddijf5y0uzh"
  8. readbuffer = ""
  9. MODT = False
  10.  
  11. cooldown1 = time.time()
  12.  
  13.  
  14. s = socket.socket()
  15. s.connect((HOST, PORT))
  16. s.send("PASS " + PASS + "\r\n")
  17. s.send("NICK " + NICK + "\r\n")
  18. s.send("JOIN #ramhh96 \r\n")
  19.  
  20.  
  21. def Send_message(message):
  22. s.send("PRIVMSG #ramhh96 :" + message + "\r\n")
  23.  
  24.  
  25. while True:
  26. readbuffer = readbuffer + s.recv(1024)
  27. temp = string.split(readbuffer, "\n")
  28. readbuffer = temp.pop()
  29.  
  30. for line in temp:
  31.  
  32. if (line[0] == "PING"):
  33. s.send("PONG %s\r\n" % line[1])
  34. else:
  35.  
  36. parts = string.split(line, ":")
  37.  
  38. if "QUIT" not in parts[1] and "JOIN" not in parts[1] and "PART" not in parts[1]:
  39. try:
  40.  
  41. message = parts[2][:len(parts[2]) - 1]
  42. except:
  43. message = ""
  44.  
  45. usernamesplit = string.split(parts[1], "!")
  46. username = usernamesplit[0]
  47.  
  48.  
  49. if MODT:
  50. print username + ": " + message
  51.  
  52. if message == "!config" and cooldown1 < time.time():
  53. Send_message("Shroods config http://play.esea.net/users/248592. ")
  54. cooldown1 = time.time() + 15 #15 second cooldown
  55. if message == "!twitter":
  56. Send_message("https://twitter.com/Ramhh96, ")
  57. if message == "!settings":
  58. Send_message("CSGO Settings, ")
  59.  
  60. for l in parts:
  61. if "End of /NAMES list" in l:
  62. MODT = True
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement