Advertisement
Excitium

jBot Version 0.90

Jul 11th, 2012
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.68 KB | None | 0 0
  1. import sys
  2. import socket
  3. import string
  4.  
  5. print 'jBot - Version 0.01'
  6.  
  7. HOST       = "irc.esper.net"       # Server jBot will connect to.
  8. PORT       = 6667                  # Port of the server.
  9. NICK       = "LLStats"             # The bot's nickname.
  10. IDENT      = "jBot"                # The bot's username.
  11. REALNAME   = "jBot [version 0.01]" # The bot's real name.
  12. READBUFFER = ""                    # Don't worry about this.
  13. CHANNELS   = "#LemmysLand"         # Channels to join upon connecting.
  14.  
  15. s = socket.socket()
  16. s.connect((HOST, PORT))
  17. s.send("NICK %s\r\n" % NICK)
  18. s.send("USER %s %s bla :%s\r\n" % (IDENT, HOST, REALNAME))
  19.  
  20. for CHANNEL in CHANNELS:
  21.     s.send("JOIN "+CHANNEL+"\r\n")
  22.  
  23. print ''
  24. print 'Channels joined successfully.'
  25.  
  26. while 1:
  27.     READBUFFER = READBUFFER + s.recv(1024)
  28.     temp = string.split(READBUFFER, "\n")
  29.     READBUFFER = temp.pop()
  30.  
  31.     for line in temp:
  32.         line=string.rstrip(line)
  33.         line=string.split(line)
  34.  
  35.         if(line[0]=="PING"):
  36.             s.send("PONG %s\r\n" % line[1])
  37.  
  38.     text = s.recv(4096)
  39.  
  40.     results = open('ll.log', 'w')
  41.     print >>results, text
  42.     results.close()
  43.  
  44.  
  45. #---------------------------------------------------#
  46. #                jBot Version 1.00                  #
  47. #---------------------------------------------------#
  48. # This is pretty straight-forward. This bot will    #
  49. # log everything it finds in a given channel to a   #
  50. # specified file, great for use with stat programs  #
  51. # such as PISG.                                     #
  52. #                                                   #
  53. # Special thanks goes to oreilly.com and bytes.com. #
  54. #---------------------------------------------------#
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement