Advertisement
hobbyboy

Broken python irc bot

Nov 19th, 2014
203
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.56 KB | None | 0 0
  1. import socket
  2. import sys
  3. import time
  4.  
  5. server = "irc.esper.net"
  6. port = 6667
  7. channel = "#cajs"
  8. botnick = "Hobbybot"
  9.  
  10. irc = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
  11. print "Connecting to: "+server
  12. irc.connect((server, port))
  13. irc.send("NICK "+ botnick +"\n")
  14. irc.send("USER "+ botnick +" "+ botnick +" "+ botnick +" :This is a bot\n")
  15.  
  16. time.sleep(5)
  17. irc.send("PRIVMSG nickserv :iNOOPE\r\n")
  18. irc.send("JOIN "+ channel +"\n")
  19.  
  20. while 1:
  21.     text=irc.recv(4096)
  22.     print text
  23.    
  24.     if text.find('PING') != -1:
  25.         irc.send('PONG ' + text.split()[1] + '\r\n')
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement