Guest User

Untitled

a guest
Dec 7th, 2018
120
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.63 KB | None | 0 0
  1. import socket as cow
  2. NICK = "@"
  3. USER = "@"
  4. PASS = "@"
  5. HOST       = "irc.freenode.net"
  6. PORT       = 6667
  7. IN_CHANNEL = False
  8. CHANNEL    = '##hairybot'
  9. s = cow.socket()
  10. s.connect( (HOST, PORT))
  11. s.sendall('USER %s %s server :%s' % (NICK,HOST,NICK))
  12. s.sendall('NICK %s\n' % NICK)
  13. s.sendall('msg NickServ :IDENTIFY @ %s\n' % PASS)
  14. while not IN_CHANNEL:
  15.     line = s.recv(500);
  16.     if "Welcome to the freenode Internet Relay Chat Network" in line:
  17.         s.sendall('JOIN %s\n' % CHANNEL);
  18.         IN_CHANNEL = True
  19. while True:
  20.     line = s.recv(500)
  21.     if 'PING' in line:
  22.         line = line.rstrip()
  23.         line = line.split()
  24.         s.send('PONG %s\n' % line[1])
Add Comment
Please, Sign In to add comment