From 8bf8bcd36986d45898ef472092d5abce53d42841 Mon Sep 17 00:00:00 2001 From: jcao219 Date: Tue, 19 Jul 2011 20:21:08 -0500 Subject: [PATCH] added !away (!back), also works in a PM --- var.py | 1 + wolfgame.py | 22 +++++++++++++++++----- 2 files changed, 18 insertions(+), 5 deletions(-) diff --git a/var.py b/var.py index 8b73fef..dc5fffc 100644 --- a/var.py +++ b/var.py @@ -11,6 +11,7 @@ START_WITH_DAY = False KILL_IDLE_TIME = 0 #300 WARN_IDLE_TIME = 0 #180 GAME_COMMAND_ADMIN_ONLY = True +AWAY = [] # cloaks of people who are away. # HIT MISS SUICIDE GUN_CHANCES = ( 5/7 , 1/7 , 1/7 ) diff --git a/wolfgame.py b/wolfgame.py index ed05078..503eb91 100644 --- a/wolfgame.py +++ b/wolfgame.py @@ -232,11 +232,12 @@ def pinger(cli, nick, chan, rest): @hook("whoreply") def on_whoreply(cli, server, dunno, chan, dunno1, - dunno2, dunno3, user, status, dunno4): + cloak, dunno3, user, status, dunno4): if not var.PINGING: return if user in (botconfig.NICK, nick): return # Don't ping self. - if var.PINGING and 'G' not in status and '+' not in status: + if (var.PINGING and 'G' not in status and + '+' not in status and cloak not in var.AWAY): # TODO: check if the user has AWAY'D himself TO_PING.append(user) @@ -253,10 +254,21 @@ def pinger(cli, nick, chan, rest): HOOKS.pop("endofwho") cli.who(chan) + - - -#def chk_bed +@cmd("away", raw_nick=True) +@pmcmd("away", raw_nick=True) +@cmd("back", raw_nick=True) +@pmcmd("back", raw_nick=True) +def away(cli, nick, *rest): + cloak = parse_nick(nick)[3] + nick = parse_nick(nick)[0] + if cloak in var.AWAY: + var.AWAY.remove(cloak) + cli.notice(nick, "You are now no longer marked as away.") + return + var.AWAY.append(cloak) + cli.notice(nick, "You are now marked as away.")