Guest User

Untitled

a guest
Jan 25th, 2018
102
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.96 KB | None | 0 0
  1. #!/usr/bin/env python
  2.  
  3. import sys
  4. import socket
  5. import string
  6. import re
  7.  
  8. HOST="irc.freenode.net"
  9. PORT=6667
  10. NICK="xxx"
  11. PASSWORD="xxx"
  12. IDENT="xxx"
  13. REALNAME="django logger"
  14. CHANNELS=("#django", "#django-dev",)
  15. DEBUG=True
  16. readbuffer=""
  17.  
  18. s=socket.socket( )
  19. s.connect((HOST, PORT))
  20. s.send("NICK %s\r\n" % NICK)
  21. s.send("USER %s %s bla :%s\r\n" % (IDENT, HOST, REALNAME))
  22. s.send("NickServ identify %s\r\n" % PASSWORD)
  23.  
  24. while 1:
  25. readbuffer=readbuffer+s.recv(1024)
  26. temp=string.split(readbuffer, "\n")
  27. readbuffer=temp.pop( )
  28.  
  29. for line in temp:
  30. line=string.rstrip(line)
  31.  
  32. if "You are now identified" in line:
  33. for channel in CHANNELS:
  34. s.send("JOIN %s\r\n" % (channel))
  35.  
  36. line=string.split(line)
  37.  
  38. if(line[0]=="PING"):
  39. s.send("PONG %s\r\n" % line[1])
  40.  
  41. if("PRIVMSG" in line):
  42. channel = line[2]
  43. msg = " ".join(line[3:])[1:]
  44. user = re.findall("^:([^!]+)!", line[0])[0]
Add Comment
Please, Sign In to add comment