All pastes #382631 Raw Edit

CJLucas

public python v1 · immutable
·published 2007-03-05 20:10 UTC
rendered paste body
#!/usr/bin/env pythonimport sysimport socketimport stringimport timeHOST="irc.blackened.com"PORT=6667NICK="CJL|Pre1"IDENT="asdf"REALNAME="asdf"CHAN="#CJL|BotRoom"readbuffer=""path = 'log.txt'balls = open(path,'r+',0)old = 0s=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))s.send("JOIN %s :%s\r\n" % (CHAN,''))s.send("PRIVMSG %s :%s\r\n" % (CHAN, "Hello There!"))s.send("PRIVMSG %s :%s\r\n" % (CHAN, "I am a bot"))while 1:		time.sleep(.2)		length = len(text.readline())		text.seek(-length,1)		if len(text.readline()) == 0:			continue		else:			text.seek(-length,1)			s.send("PRIVMSG %s :%s\r\n" % (CHAN, text.readline()))				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])