allhailthegeek
By: a guest | Feb 9th, 2010 | Syntax:
None | Size: 0.65 KB | Hits: 33 | Expires: Never
#! /usr/bin/python
import sys
import socket
import string
HOST="irc.nocebo.ca"
PORT=6667
NICK="EntitysBot"
IDENT="Bot"
REALNAME="Bot"
CHANNEL="#sporks"
readbuffer=""
s=socket.socket( )
s.connect((HOST, PORT))
s.send("NICK %s\r\n" % NICK)
s.send("USER %s %s bla :%s\r\n" % (IDENT, HOST, REALNAME))
while 1:
readbuffer=readbuffer+s.recv(1024)
temp=string.split(readbuffer, "\n")
readbuffer=temp.pop( )
for line in temp:
line=string.rstrip(line)
line=string.split(line)
print line
if(line[0]=="PING"):
s.send("PONG %s\r\n" % line[1])
if(line[1]=="376"):
s.send("JOIN %s\r\n" % CHANNEL)