Closed flexd closed 10 years ago
Err, the bot does not handle nick collisions at all?
DEBUG 2014-10-23 10:54:10,746 kitnirc.client:0307 - irc.freenode.org --> :sendak.freenode.net 433 * belt :Nickname is already in use.
DEBUG 2014-10-23 10:54:31,359 kitnirc.client:0307 - irc.freenode.org --> ERROR :Closing Link: 178.62.227.240 (Connection timed out)
Currently no, I've been meaning to write a module to do that.
On Thu, Oct 23, 2014, 01:54 Kristoffer Berdal notifications@github.com wrote:
Err, the bot does not handle nick collisions at all?
DEBUG 2014-10-23 10:54:10,746 kitnirc.client:0307 - irc.freenode.org --> :sendak.freenode.net 433 * belt :Nickname is already in use.DEBUG 2014-10-23 10:54:31,359 kitnirc.client:0307 - irc.freenode.org --> ERROR :Closing Link: 178.62.227.240 (Connection timed out)
— Reply to this email directly or view it on GitHub https://github.com/ayust/kitnirc/issues/22#issuecomment-60210224.
I have quickly written a module that just appends a random number between 0-9 to the nick if it's already in use. Using the NICKNAMEINUSE event.
This should be working fine, but the even does not seem to fire, what could be wrong?
I see the bot gets a 433 from the server, and 433 -> NICKNAMEINUSE in the events.py file, so it should be working?
import logging
from kitnirc.modular import Module
from random import randint
_log = logging.getLogger(__name__)
class NickInUseModule(Module):
"""A KitnIRC module which adds a random number between 0-9
if the configured nick is already in use"""
@Module.handle("NICKNAMEINUSE")
def nickname_in_use(self, client, *args):
_log.info("THIS HAPPENS YO")
oldnick = client.user.nick
newnick = "{}{}".format(oldnick, randint(0,9))
_log.info("{} is already in use, changing nick to {}".format(oldnick, newnick))
client.nick(newnick)
module = NickInUseModule
There might be better ways of solving this (such as alternative nicks in the config, and then ending up doing this if all else fails), but this should at least solve the problem of the bot not joining any channels and the INFO logs not telling you anything at all.
Oh, right. No Parse for that. Sec, let me see if I can write one!
This was fixed in #23.
I am having a weird issue where the bot just never joins the channel (autojoin contrib module never seems to do anything), and then after a while the bot is disconnected