Browse Source

fixed a bug caused by !admins being used by two or more people simultaneously

master
jcao219 13 years ago
parent
commit
69b05bb3c9
  1. 10
      wolfgame.py

10
wolfgame.py

@ -77,6 +77,7 @@ def connect_callback(cli): @@ -77,6 +77,7 @@ def connect_callback(cli):
var.LAST_PING = 0 # time of last ping
var.PINGING = False
var.ADMIN_PINGING = False
var.ROLES = {"person" : []}
var.ORIGINAL_ROLES = {}
var.DEAD_USERS = {}
@ -2071,20 +2072,29 @@ def show_admins(cli, nick, chan, rest): @@ -2071,20 +2072,29 @@ def show_admins(cli, nick, chan, rest):
"""Pings the admins that are available."""
admins = []
if var.ADMIN_PINGING:
return
var.ADMIN_PINGING = True
@hook("whoreply", id = 4)
def on_whoreply(cli, server, dunno, chan, dunno1,
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
user != botconfig.NICK):
admins.append(user)
@hook("endofwho", id = 4)
def show(*args):
if not var.ADMIN_PINGING:
return
admins.sort(key=lambda x: x.lower())
cli.msg(chan, "Available admins: "+" ".join(admins))
decorators.unhook(HOOKS, 4)
var.ADMIN_PINGING = False
cli.who(chan)

Loading…
Cancel
Save