!fwait: Code cleanup
This commit is contained in:
parent
0275c773e5
commit
59c589f3e1
@ -5175,38 +5175,41 @@ def wait(cli, nick, chann_, rest):
|
|||||||
"{1} seconds.").format(nick, var.EXTRA_WAIT))
|
"{1} seconds.").format(nick, var.EXTRA_WAIT))
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
@cmd("fwait", admin_only=True)
|
@cmd("fwait", admin_only=True)
|
||||||
def fwait(cli, nick, chann_, rest):
|
def fwait(cli, nick, chan, rest):
|
||||||
"""Forces an increase (or decrease) in wait time. Can be used with a number of seconds to wait."""
|
"""Forces an increase (or decrease) in wait time. Can be used with a number of seconds to wait."""
|
||||||
|
|
||||||
pl = var.list_players()
|
pl = var.list_players()
|
||||||
|
|
||||||
chan = botconfig.CHANNEL
|
|
||||||
|
|
||||||
|
|
||||||
if var.PHASE == "none":
|
if var.PHASE == "none":
|
||||||
cli.notice(nick, "No game is currently running.")
|
cli.notice(nick, "No game is currently running.")
|
||||||
return
|
return
|
||||||
|
|
||||||
if var.PHASE != "join":
|
if var.PHASE != "join":
|
||||||
cli.notice(nick, "Werewolf is already in play.")
|
cli.notice(nick, "Werewolf is already in play.")
|
||||||
return
|
return
|
||||||
|
|
||||||
rest = re.split(" +", rest.strip(), 1)[0]
|
rest = re.split(" +", rest.strip(), 1)[0]
|
||||||
if rest and (rest.isdigit() or (rest[0] == '-' and rest[1:].isdigit())):
|
|
||||||
|
if rest and (rest.isdigit() or (rest[0] == "-" and rest[1:].isdigit())):
|
||||||
extra = int(rest)
|
extra = int(rest)
|
||||||
else:
|
else:
|
||||||
extra = var.EXTRA_WAIT
|
extra = var.EXTRA_WAIT
|
||||||
|
|
||||||
now = datetime.now()
|
now = datetime.now()
|
||||||
|
|
||||||
if now > var.CAN_START_TIME:
|
if now > var.CAN_START_TIME:
|
||||||
var.CAN_START_TIME = now + timedelta(seconds=extra)
|
var.CAN_START_TIME = now + timedelta(seconds=extra)
|
||||||
else:
|
else:
|
||||||
var.CAN_START_TIME += timedelta(seconds=extra)
|
var.CAN_START_TIME += timedelta(seconds=extra)
|
||||||
|
|
||||||
var.WAITED += 1
|
var.WAITED += 1
|
||||||
cli.msg(chan, ("\u0002{0}\u0002 forcibly {2}creased the wait time by "+
|
|
||||||
"{1} second{3}.").format(nick, abs(extra),
|
cli.msg(chan, ("\u0002{0}\u0002 forcibly {2}creased the wait time by {1} "
|
||||||
("in" if extra >= 0 else "de"), ("s" if extra != 1 else "")))
|
"second{3}.").format(nick,
|
||||||
|
abs(extra),
|
||||||
|
"in" if extra >= 0 else "de",
|
||||||
|
"s" if extra != 1 else ""))
|
||||||
|
|
||||||
|
|
||||||
@cmd("fstop",admin_only=True)
|
@cmd("fstop",admin_only=True)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user