You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
23 lines
540 B
Python
23 lines
540 B
Python
4 years ago
|
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])
|