Share Pastebin
Guest
Public paste!

allhailthegeek

By: a guest | Feb 9th, 2010 | Syntax: None | Size: 0.65 KB | Hits: 33 | Expires: Never
Copy text to clipboard
  1. #! /usr/bin/python
  2. import sys
  3. import socket
  4. import string
  5.  
  6. HOST="irc.nocebo.ca"
  7. PORT=6667
  8. NICK="EntitysBot"
  9. IDENT="Bot"
  10. REALNAME="Bot"
  11. CHANNEL="#sporks"
  12. readbuffer=""
  13.  
  14. s=socket.socket( )
  15. s.connect((HOST, PORT))
  16. s.send("NICK %s\r\n" % NICK)
  17. s.send("USER %s %s bla :%s\r\n" % (IDENT, HOST, REALNAME))
  18.  
  19. while 1:
  20.     readbuffer=readbuffer+s.recv(1024)
  21.     temp=string.split(readbuffer, "\n")
  22.     readbuffer=temp.pop( )
  23.     for line in temp:
  24.         line=string.rstrip(line)
  25.         line=string.split(line)
  26.         print line
  27.         if(line[0]=="PING"):
  28.             s.send("PONG %s\r\n" % line[1])
  29.         if(line[1]=="376"):
  30.             s.send("JOIN %s\r\n" % CHANNEL)