Fix bot's handling of WHO replies on connect:
Some IRCds always output the servername on a WHOX query even if it wasn't asked for. Let's ask for it now and just ignore the response. The order of parameters in WHOX is now in the order they are returned, to make life easier. Also tidy up the generator a tad; if we aren't using things we're computing then there's no need to compute it at all :)
This commit is contained in:
parent
18199b166c
commit
baa3831ce7
@ -114,7 +114,7 @@ def connect_callback(cli):
|
||||
cmodes.append(("-q", quieted))
|
||||
|
||||
@hook("whospcrpl", hookid=294)
|
||||
def on_whoreply(cli, server, nick, ident, cloak, user, status, acc):
|
||||
def on_whoreply(cli, server, nick, ident, cloak, _, user, status, acc):
|
||||
if user in var.USERS: return # Don't add someone who is already there
|
||||
if user == botconfig.NICK:
|
||||
cli.nickname = user
|
||||
@ -159,7 +159,7 @@ def connect_callback(cli):
|
||||
cli.msg("ChanServ", "op " + botconfig.CHANNEL)
|
||||
|
||||
|
||||
cli.who(botconfig.CHANNEL, "%nuhaf")
|
||||
cli.who(botconfig.CHANNEL, "%uhsnfa")
|
||||
|
||||
@hook("mode")
|
||||
def check_for_modes(cli, rnick, chan, modeaction, *target):
|
||||
|
@ -19,6 +19,8 @@ def generate(fdict, permissions=True, **kwargs):
|
||||
def dec(f):
|
||||
def innerf(*args):
|
||||
largs = list(args)
|
||||
if not permissions:
|
||||
return f(*largs)
|
||||
if len(largs) > 1 and largs[1]:
|
||||
nick, _, _, cloak = parse_nick(largs[1])
|
||||
|
||||
@ -33,8 +35,6 @@ def generate(fdict, permissions=True, **kwargs):
|
||||
chan = ""
|
||||
if not raw_nick and len(largs) > 1 and largs[1]:
|
||||
largs[1] = nick
|
||||
if not permissions:
|
||||
return f(*largs)
|
||||
if chan and not chan == botconfig.CHANNEL and not admin_only and not owner_only:
|
||||
if "" in s:
|
||||
return # Don't have empty commands triggering in other channels
|
||||
|
Loading…
Reference in New Issue
Block a user