Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # TODO: Add +B mode to this bot, read foonetic botmotd
- import sys
- import socket
- import string
- HOST="irc.foonetic.net"
- PORT=6667
- NICK="DaedBot"
- IDENT="daedbot"
- REALNAME="Daedalus Bot"
- CHANNEL="#xkcd"
- readbuffer=""
- bugfile=open('debug.txt', 'w')
- 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))
- #s.send("JOIN %s\r\n" % (CHANNEL))
- while 1:
- recv=s.recv(4096)
- readbuffer=readbuffer+recv
- bugfile.write("BEEP")
- bugfile.write(recv)
- temp=string.split(readbuffer, "\n")
- readbuffer=temp.pop( )
- for line in temp:
- line=string.rstrip(line)
- line=string.split(line)
- if(line[0][0]==":"):
- user=line[0][1:line[0].find('!')]
- line=line[1:]
- else: user="Daedalus"
- if(line[0]=="PING"):
- s.send("PONG %s\r\n" % line[1])
- if(line[0]=="PRIVMSG"):
- message=line[2][1:]+' '+' '.join(line[3:])
- reply="Yo, I'm totally replying to your PM."
- s.send("PRIVMSG %s %s\r\n" % (user, reply))
Add Comment
Please, Sign In to add comment