My irc bot is hanging at :calvino.freenode.net "NOTICE * :* Looking up your hostname..." It was working before I added some functions to my code. I've since commented those functions out, but it's still not working! It stays at that message, doesn't progress. I have to force it to quit.
I'm a very novice coder, I only started to code two weeks or so ago. So it's totally possible that I have a very stupid error there somewhere. For reference, I used this post to write the framework of my bot. http://ubuntuforums.org/showpost.php?p=9363159&postcount=3 I didn't post the rest of my code but I've put it in this pastebin, in case it is needed! http://pastebin.com/kVF04UFr
import socket
import urllib2
import httplib
import mechanize
channel = '#testbot'
botnick = 'tastybot'
network = 'irc.freenode.net'
port = 6667
irc = socket.socket ( socket.AF_INET, socket.SOCK_STREAM )
irc.connect ( ( network, port ) )
print irc.recv ( 4096 )
irc.send ( 'NICK' + botnick + ':\r\n' )
irc.send ( 'USER tastybot tastybot tastybot :Python IRC\r\n' )
irc.send ( 'JOIN' + channel + ':\r\n' )
irc.send ( 'PRIVMSG' + channel + ':What\'s up?\r\n' )
running = True
[various functions]
while running:
[rest of code]
My guess is that the IRC server you are connecting to requires that an ident is given:
Ident is an old protocol that servers used to identify which user on a shared system was connecting to them. Nowadays, it is most often used to weed out clones and floodbots from compromised machines (which usually don't have identd [the ident daemon] installed).
Source: http://help.undernet.org/faq.php#19
The easiest fix to this is to try to connect to another IRC-server, you could try 'holmes.freenode.net' as your server. I have had no problems with using my IRC bot on that server.
Edit: If you want to take a look on the code I am using for connecting to the server: connection.py