yazdmich

Untitled

Aug 16th, 2014
271
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.86 KB | None | 0 0
  1. import sys
  2. import socket
  3.  
  4. HOST="irc.rizon.net"
  5. PORT=6667
  6. NICK="pymich"
  7. IDENT="yazdmich"
  8. REALNAME="YazdmichBot"
  9. CHAN="#yaoi"
  10. readbuffer=""
  11.  
  12. s=socket.socket( )
  13. s.connect((HOST, PORT))
  14. line1 = "NICK %s\r\n" % NICK
  15. s.send(line1.encode())
  16. line1 = "USER %s %s bla :%s\r\n" % (IDENT, HOST, REALNAME)
  17. s.send(line1.encode())
  18. line1 = 'JOIN %s\r\n' % CHAN
  19. s.send(line1.encode())
  20. while 1:
  21.     readbuffer+=s.recv(1024).decode()
  22.     temp=readbuffer.split('\n')
  23.     readbuffer=temp.pop()
  24.     for line in temp:
  25.         #line=line.rstrip()
  26.         line=line.split('\n')
  27.         print(line[0])
  28.         if(line[0]=="PING"):
  29.             line = "PONG %s\r\n" % line[1]
  30.             s.send(line.encode())
  31.         elif 'test' in line[0] and ('PRIVMSG ' + CHAN) in line[0]:
  32.             line1 = 'PRIVMSG %s I\ never\ studied!\r\n' % CHAN
  33.             s.send(line1.encode())
Advertisement
Add Comment
Please, Sign In to add comment