Here is my trouble: The Bot loads the IRC information fine, but when its suppose to Identify itself, he doesn't.
The following is the relevant part of the code. I guess the problem is on line 9 but I can't figure out why.
import socket
server = #ServerName
channel = #ChannelName
botnick = #BotName
password = #Password (string)
def connect(channel, password): # This function is used on connect.
ircsock.send("PRIVMSG" + " :NICKSERV Identify " + password +"\n") #Problem Here
ircsock.send("JOIN "+ channel +"\n")
ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ircsock.connect((server, 6667)) # Here we connect to the server using the port 6667
ircsock.send("USER "+ botnick +" "+ botnick +" "+ botnick +":Just testing .\n") # user authentication
ircsock.send("NICK "+ botnick +"\n")
connect(channel, password) #Join the channel and identify the nick using the functions we previously defined
Thanks in advance.
Solution: By setting the connect function as posted, it is the first thing to be called Then the server was trying to connect before having USER / NICK.
def create_connection():
global ircsock
ircsock = socket.socket(socket.AF_INET, socket.SOCK_STREAM)
ircsock.connect((server, 6667)) # Here we connect to the server using the port 6667
ircsock.send("USER "+ botnick +" "+ botnick +" "+ botnick +":This bot is a result of GStones mastery .\n") # user authentication
ircsock.send("NICK "+ botnick +"\n") # here we actually assign the nick to the bot
time.sleep(5)
connect(channel, password) # Join the channel and identify the nick using the functions we previously defined
create_connection()
Thanks i\OFF