Browse Source

!admins now respects !away, glob syntax

master
jcao219 13 years ago
parent
commit
38bd86476b
  1. 10
      wolfgame.py

10
wolfgame.py

@ -24,6 +24,7 @@ import sys
import os import os
import imp import imp
import math import math
import fnmatch
COMMANDS = {} COMMANDS = {}
PM_COMMANDS = {} PM_COMMANDS = {}
@ -2112,6 +2113,9 @@ def on_invite(cli, nick, something, chan):
if chan == botconfig.CHANNEL: if chan == botconfig.CHANNEL:
cli.join(chan) cli.join(chan)
def is_admin(cloak):
return bool([ptn for ptn in botconfig.OWNERS+botconfig.ADMINS if fnmatch.fnmatch(cloak, ptn)])
@cmd("admins") @cmd("admins")
@ -2121,7 +2125,7 @@ def show_admins(cli, nick, chan, rest):
if (var.LAST_ADMINS and if (var.LAST_ADMINS and
var.LAST_ADMINS + timedelta(seconds=var.ADMINS_RATE_LIMIT) > datetime.now()): var.LAST_ADMINS + timedelta(seconds=var.ADMINS_RATE_LIMIT) > datetime.now()):
cli.msg(chan, (nick+": This command is ratelimited. " + cli.notice(chan, (nick+": This command is ratelimited. " +
"Please wait a while before using it again.")) "Please wait a while before using it again."))
return return
@ -2136,8 +2140,8 @@ def show_admins(cli, nick, chan, rest):
cloak, dunno3, user, status, dunno4): cloak, dunno3, user, status, dunno4):
if not var.ADMIN_PINGING: if not var.ADMIN_PINGING:
return return
if ((cloak in botconfig.ADMINS or cloak in botconfig.OWNERS) and 'G' not in status and if (is_admin(cloak) and 'G' not in status and
user != botconfig.NICK): user != botconfig.NICK and cloak not in var.AWAY):
admins.append(user) admins.append(user)
@hook("endofwho", id = 4) @hook("endofwho", id = 4)

Loading…
Cancel
Save