Advertisement
GameNationRDF

Python IRC Bot version 0.0.1

Sep 14th, 2013
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.73 KB | None | 0 0
  1. import sys
  2. import socket
  3. import string
  4. import os
  5.  
  6. HOST = "irc.freenode.net"
  7. PORT = 6667
  8. NICK = "wrytsbot"
  9. IDENT = "wrytsbot"
  10. REALNAME = "wrytsbot"
  11. OWNER = "WrytXander"
  12. CHANNEL = "#OreServerChat"
  13. readbuffer = ""
  14.  
  15. s = socket.socket()
  16. s.connect((HOST, PORT))
  17. s.send(bytes("NICK %s\r\n"%NICK,"UTF-8"))
  18. s.send(bytes("USER %s %s bla :%s\r\n"%(IDENT,HOST,REALNAME),"UTF-8"))
  19. s.send(bytes("JOIN "+CHANNEL+"\r\n","UTF-8"))
  20.  
  21. while True:
  22.     readbuffer=readbuffer+s.recv(1024).decode("UTF-8")
  23.     fornw=str.split(readbuffer,"\n")
  24.     readbuffer=fornw.pop()
  25.     for line in fornw:
  26.         line=str.rstrip(line)
  27.         line=str.split(line)
  28.     if(line[0]==("PING")):
  29.             s.send(bytes("PONG %s\r\n"%line[1],"UTF-8"))
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement