Fix !lastgame
It simply didn't work before now for a while (as in, you could still join/start). Also make it function during join phase, because having weird restrictions on which it does/doesn't disable the commands is weird. The admin can still !fjoin/!fstart as needed if they do want to run one more game after executing this command during join phase.
This commit is contained in:
parent
426a86e909
commit
54de373242
@ -6709,12 +6709,19 @@ def aftergame(var, wrapper, message):
|
|||||||
def _command_disabled(var, wrapper, message):
|
def _command_disabled(var, wrapper, message):
|
||||||
wrapper.send(messages["command_disabled_admin"])
|
wrapper.send(messages["command_disabled_admin"])
|
||||||
|
|
||||||
|
def _command_disabled_oldapi(cli, nick, chan, rest):
|
||||||
|
# FIXME: kill this off when the old @cmd API is completely killed off
|
||||||
|
reply(cli, nick, chan, messages["command_disabled_admin"])
|
||||||
|
|
||||||
@command("lastgame", "flastgame", flag="D", pm=True)
|
@command("lastgame", "flastgame", flag="D", pm=True)
|
||||||
def flastgame(var, wrapper, message):
|
def flastgame(var, wrapper, message):
|
||||||
"""Disables starting or joining a game, and optionally schedules a command to run after the current game ends."""
|
"""Disables starting or joining a game, and optionally schedules a command to run after the current game ends."""
|
||||||
if var.PHASE != "join":
|
for cmdcls in (COMMANDS["join"] + COMMANDS["start"]):
|
||||||
for decor in (COMMANDS["join"] + COMMANDS["start"]):
|
if isinstance(cmdcls, command):
|
||||||
decor(_command_disabled)
|
cmdcls.func = _command_disabled
|
||||||
|
else:
|
||||||
|
# FIXME: kill this off when the old @cmd API is completely killed off
|
||||||
|
cmdcls.func = _command_disabled_oldapi
|
||||||
|
|
||||||
channels.Main.send(messages["disable_new_games"].format(wrapper.source))
|
channels.Main.send(messages["disable_new_games"].format(wrapper.source))
|
||||||
var.ADMIN_TO_PING = wrapper.source
|
var.ADMIN_TO_PING = wrapper.source
|
||||||
|
Loading…
x
Reference in New Issue
Block a user