1
votes

I've been working on this irc bot, just seeing if I could recreate some basic features that ChanServ or any other bot could give, I tried making this little thing but it's only limited to one nick:

if '@wikia/Example JOIN #channel' in line:
    print 'Giving op status to @wikia/Example'
    self.s.send('MODE #channel Example +o\n')

It only works if @wikia/Example joins #channel with the nick Example at start, but say @wikia/Example joins #channel with the nick Example_rules, then it wouldn't work since I get the error, the nick "Example" doesn't exist. How would it be possible for @wikia/Example to be +o, no matter what the nick is?

Here is what a line looks like
:Nickname!~login@wikia/Example PRIVMSG #channel :This is a message.

1
Have you looked at Twisted? - it has a very good framework for producing bots - plus you should be able to parse the line, not just look for things like that... so, a bit puzzled? - Jon Clements
And IIRC (I wrote channel services bots) - in that case it needs to be a pseudo-server, otherwise, what's wrong with just eggdrop/stormbot etc... and you need to check the AUP of the provider... - Jon Clements
I'm aware of other types of bots, but I'd rather create it on this. - Hairr

1 Answers

0
votes

You should give +o to the nick that joined and not to hardcoded nick. Change:

self.s.send('MODE #channel +o Example\r\n')

Change "Example" with the variable that holds the joined nick and the problem will be solved. also IRC is an old protocol, and it demands \r\n.