Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- import socket
- import string
- HOST="irc.gtanet.com"
- PORT="6667"
- NICK="Juan"
- IDENT="Juan"
- REALNAME="Juan"
- CHAN="#xMovie"
- readbuffer=""
- s=socket.socket( )
- s.connect((HOST, PORT))
- s.send("NICK %srn" % NICK)
- s.send("USER %s %s bla :%srn" % (IDENT, HOST, REALNAME))
- s.send("JOIN :%srn" % CHAN)
- # python doesn't use braces {} for code blocks, it uses whitespace
- # a statement followed by a : means you need to indent the code following it, like so
- while 1:
- readbuffer=readbuffer+s.recv(1024)
- temp=string.split(readbuffer, "n")
- readbuffer=temp.pop( )
- for line in temp:
- line=string.rstrip(line)
- line=line.split(CHAN + ' :')
- if line[0].find("PING") != -1:
- pingid = line[0].split()[1]
- s.send("PONG %srn" % pingid)
- if len(line) > 1:
- if line[1] == '!Juan':
- s.send("PRIVMSG %s Hi" % CHAN)
Add Comment
Please, Sign In to add comment