Advertisement
Excitium

jBot Version 0.95

Jul 11th, 2012
85
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  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. results = open('ll.log', 'w')
  27.  
  28. while 1:
  29.     READBUFFER = READBUFFER + s.recv(1024)
  30.     temp = string.split(READBUFFER, "\n")
  31.     READBUFFER = temp.pop()
  32.  
  33.     for line in temp:
  34.         results.write(line+'\n')
  35.  
  36.         print line
  37.  
  38.         text=string.rstrip(line)
  39.         text=string.split(text)
  40.  
  41.         if(text[0]=="PING"):
  42.             s.send("PONG %s\r\n" % text[1])
  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