spacepaste

  1.  
  2. from socket import *
  3. s = socket(AF_INET,SOCK_STREAM)
  4. s.connect(("irc.freenode.net",6667))
  5. user = "BOTUSER"
  6. channel = "#mtmt"
  7. message = "Hello!"
  8. s.send("USER "+user+" "+user+" "+user+" "+user+"\n")
  9. s.send("NICK "+user+"\n")
  10. s.send("JOIN "+channel+"\n")
  11. while 1:
  12. success = True
  13. try:
  14. fi = open("message.txt", 'r')
  15. except:
  16. success = False # File could not be opened
  17. if success:
  18. s.write("PRIVMSG " + channel + " :" + fi.read() + "\n") # Read message from message.txt and msg it to the channel
  19. fi.close()
  20. msg = s.recv(1024)
  21. print (msg)
  22.