Skip to content

Bot tries to join channel before ident finishes  #1

@remihacker5

Description

@remihacker5

Today I was getting this error:
:.freenode.net NOTICE * :** Looking up your ident...
:.freenode.net NOTICE * :** Looking up your hostname...
:capelle.freenode.net 451 Iamapythonbot JOIN :You have not registered.
:.freenode.net NOTICE Iamapythonbot :** Could not resolve your hostname: Nameserver failure; using your IP address (199.167.89.140) instead.
Then the bot would just sit and do nothing.
After some research (and numerous stack overflow articles), I concluded that something goes wrong with the name server and it extends the time that it takes before you can log in to a channel. The problem is that the bot does not run any checks before it tries to join a channel, and hence the inability to join a channel. I have made a crude workaround that looks like this:

def main():
  while 1:
    ircmsg = ircsock.recv(2048).decode("UTF-8")
    ircmsg = ircmsg.strip('\n\r')
    print(ircmsg)
    if ircmsg.find("Welcome to the freenode IRC Network") != -1: # I chose "welcome to freenode" because that is the first thing the server sends after the login process is finished.  
        joinchan(channel)
    if ircmsg.find("PRIVMSG") != -1:
#The rest of the code here.

I am certain that there is a better way to implement this, but I lack both the willpower and programming skills to do such a thing.
I hope I am writing this issue the correct way, I'm like 15 and have never written a issue report before.

Good day to you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions