All pastes #141139 Raw Edit

Mine

public python v1 · immutable
#141139 ·published 2006-08-20 21:26 UTC
rendered paste body
import socket,re# --------------------------------------------# --- Terlik v0.1, Python IRC Bot ------------# --- Author: Yns_ || http://yns.zaxaz.com ---# --------------------------------------------# configuration filesnetwork  = 'irc.freenode.net'port     = 6667nick     = 'Terlik22'channel  = '#hekir'log_file = 'log.txt'owner    = 'Yns_'nick_regex    = re.compile(":(.*)!n")message_regex = re.compile(channel + " :(.*)")      irc = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )irc.connect ( ( network, port ) )print irc.recv ( 4096 )irc.send ( "NICK " + nick + "\r\n" )irc.send ( "USER " + nick + " " + nick + " " + nick + " :yns.zaxaz.com/terlik/ \r\n" )irc.send ( "JOIN " + channel +" \r\n" )irc.send ( "PRIVMSG " + channel + " :selam.\r\n" )pointer = Truewhile pointer == True:   data = irc.recv ( 4096 )   # -- Logging In progress -- #   filehandle = open(log_file, "a+")   filehandle.write(data)   filehandle.close()   print data   # -- pin(g) - pon(g) -- #   if data.find ( 'PING' ) != -1:       irc.send ( 'PONG ' + data.split() [ 1 ] + '\r\n' )   # explode the data   if data.find ( 'PRIVMSG ' + channel ) != -1:   # -- regex on the fly! --      nick    = re.search(nick_regex,data)      message = re.search(message_regex,data).group(1).replace('\r\n','').replace('\r','').replace('\n','')       filehandle2 = open('sonuclar.txt', "a+")      filehandle2.write("[bas]" + data + "[son]")      filehandle2.close()      # -- Close the bot! -- #      if(message and nick.group(1)):          if message == '!quit':             irc.send ( "PRIVMSG " + channel + " : Iyi gunler \r\n" )             irc.send ( 'QUIT\r\n' )             irc.close()             pointer = False