Jordyk19 commented on a Page, Python IRC Bot (l33t)  -  Sep 11, 2011

Your !dns is not working...
When executing "!dns http://hi.com"
you will get:

Traceback (most recent call last):
File "bot.py", line 45, in
dnserv = socket.gethostbyaddr(dnsf)
socket.gaierror: [Errno -2] Name or service not known

Fixed version

   if text.find( '!dns' ) != -1:
      try:
         dns = text.split( '!dns' )
         dnsf = dns[1].strip()
         dnserv = socket.gethostbyaddr(dnsf)
         irc.send ( 'PRIVMSG '+ str(channel) +' :Address : '+ str(dnserv) +'\n' )
      except:
         irc.send ( 'PRIVMSG '+ str(channel) +' :[ERROR] Something is wrong here!!!\n' )
 Respond  
Are you sure you want to unfollow this person?
Are you sure you want to delete this?
Click "Unsubscribe" to stop receiving notices pertaining to this post.
Click "Subscribe" to resume notices pertaining to this post.