fixed a bug caused by !admins being used by two or more people simultaneously
This commit is contained in:
parent
732a6239a8
commit
44ce23957a
10
wolfgame.py
10
wolfgame.py
@ -77,6 +77,7 @@ def connect_callback(cli):
|
|||||||
|
|
||||||
var.LAST_PING = 0 # time of last ping
|
var.LAST_PING = 0 # time of last ping
|
||||||
var.PINGING = False
|
var.PINGING = False
|
||||||
|
var.ADMIN_PINGING = False
|
||||||
var.ROLES = {"person" : []}
|
var.ROLES = {"person" : []}
|
||||||
var.ORIGINAL_ROLES = {}
|
var.ORIGINAL_ROLES = {}
|
||||||
var.DEAD_USERS = {}
|
var.DEAD_USERS = {}
|
||||||
@ -2070,21 +2071,30 @@ def on_invite(cli, nick, something, chan):
|
|||||||
def show_admins(cli, nick, chan, rest):
|
def show_admins(cli, nick, chan, rest):
|
||||||
"""Pings the admins that are available."""
|
"""Pings the admins that are available."""
|
||||||
admins = []
|
admins = []
|
||||||
|
|
||||||
|
if var.ADMIN_PINGING:
|
||||||
|
return
|
||||||
|
var.ADMIN_PINGING = True
|
||||||
|
|
||||||
@hook("whoreply", id = 4)
|
@hook("whoreply", id = 4)
|
||||||
def on_whoreply(cli, server, dunno, chan, dunno1,
|
def on_whoreply(cli, server, dunno, chan, dunno1,
|
||||||
cloak, dunno3, user, status, dunno4):
|
cloak, dunno3, user, status, dunno4):
|
||||||
|
if not var.ADMIN_PINGING:
|
||||||
|
return
|
||||||
if ((cloak in botconfig.ADMINS or cloak in botconfig.OWNERS) and 'G' not in status and
|
if ((cloak in botconfig.ADMINS or cloak in botconfig.OWNERS) and 'G' not in status and
|
||||||
user != botconfig.NICK):
|
user != botconfig.NICK):
|
||||||
admins.append(user)
|
admins.append(user)
|
||||||
|
|
||||||
@hook("endofwho", id = 4)
|
@hook("endofwho", id = 4)
|
||||||
def show(*args):
|
def show(*args):
|
||||||
|
if not var.ADMIN_PINGING:
|
||||||
|
return
|
||||||
admins.sort(key=lambda x: x.lower())
|
admins.sort(key=lambda x: x.lower())
|
||||||
|
|
||||||
cli.msg(chan, "Available admins: "+" ".join(admins))
|
cli.msg(chan, "Available admins: "+" ".join(admins))
|
||||||
|
|
||||||
decorators.unhook(HOOKS, 4)
|
decorators.unhook(HOOKS, 4)
|
||||||
|
var.ADMIN_PINGING = False
|
||||||
|
|
||||||
cli.who(chan)
|
cli.who(chan)
|
||||||
|
|
||||||
|
Loading…
x
Reference in New Issue
Block a user