I'm brand new to python, so i need a bit help parsing. Why i need parsing? so my irc bot can reconignise me.
here is my code:
####
# Made by Fellixombc
# pythonbots.no-ip.org:8080 (coming soon)
# Contact: Fellixombc@hotmail.com (add me on msn, I don't check my email's)
# Copyright (C) 2009 Fellixombc
####
import socket #self explainitory
import parser
import sys
bot = 'FellixBot' #your bots name
owner = 'Fellixombc' #owner of the bot
server = 'asriel.moparisthebest.com' #irc server, yours most likely will be different
port = 6667 #defualt irc port, yours may be different
chan = '#bots' #channel you wish your bot to join, mine is #bots for example
password = 'yourpassword' #leave blank if your bot nick isn't registered
identify = True # true, if you have a password, false, if you don't
irc = socket.socket ( socket.AF_INET, socket.SOCK_STREAM ) #create a socket to connect to the irc server / port
irc.connect ( (server, port) ) #connect to the server
print irc.recv ( 4096 ) #print lines...
irc.send ('NICK Fellix_bot\r\n')
irc.send ( 'User Fellix_bot FellixBot Fellixumbc :Python IRC\r\n' ) #your username for the bot
irc.send ( 'PRIVMSG NickServ :IDENTIFY ' + password + '\r\n' )
irc.send ( 'JOIN ' + chan +'\r\n' )
irc.send ( 'PRIVMSG '+ chan +' :Hi im fellixombcs noob bot.\r\n' )
if identify == True:
irc.send ( 'PRIVMSG :MSG NickServ Identify' + password + '\r\n' ) #identify's itself
elif identify == False:
print ('user did not register the bots nick') #just telling you that your bot's nick isn't registered, so you say
irc.send ( 'JOIN ' + chan + '\r\n' ) #join channel given
while True:
data = irc.recv (4096) #recieve lines
print data
data.find ('PING') != -1
irc.send ('PONG ' + data.split()[ 1 ] +'\r\n') # stay with connection with server
if someone could lead me into the right direction, that would be great, thank you.