Created
February 8, 2010 17:57
-
-
Save jarsen/298399 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# from IRC hacks - http://oreilly.com/pub/ht/113 | |
import sys | |
import socket | |
import string | |
HOST="irc.freenode.net" | |
PORT=6667 | |
NICK="MauBot" | |
IDENT="maubot" | |
REALNAME="MauritsBot" | |
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) | |
if(line[0]=="PING"): | |
s.send("PONG %s\r\n" % line[1]) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment