Flags/command permissions overhaul
- revealroles is now enabled by default in normal mode - spectate has been changed to require +a instead of +A - fdie has been changed to require +F instead of +D; unlike the other +D commands (restart, update), die requires server access to get back up and is more dangerous. - remove 'send' alias for fsend - fgame is now enabled by default in normal mode and has been changed to require +g instead of +d - fnight has been changed to require +N instead of +d - fday has been changed to require +N instead of +d - fstart has been changed to require +S instead of +A - fstop has been changed to require +S instead of +A - fwait has been changed to require +w instead of +A - all remaining commands which require +d (force/rforce/frole) remain disabled by default in normal mode - eval and exec can no longer be enabled in normal mode; they function in debug mode only
This commit is contained in:
parent
370b2c6ed2
commit
0bfa262daf
@ -343,7 +343,7 @@ ROLE_COMMAND_EXCEPTIONS = set()
|
|||||||
GIF_CHANCE = 1/50
|
GIF_CHANCE = 1/50
|
||||||
FORTUNE_CHANCE = 1/25
|
FORTUNE_CHANCE = 1/25
|
||||||
|
|
||||||
ALL_FLAGS = frozenset("AaDdFjms")
|
ALL_FLAGS = frozenset("AaDdFgjmNSsw")
|
||||||
|
|
||||||
GRAVEYARD_LOCK = threading.RLock()
|
GRAVEYARD_LOCK = threading.RLock()
|
||||||
WARNING_LOCK = threading.RLock()
|
WARNING_LOCK = threading.RLock()
|
||||||
|
@ -363,7 +363,7 @@ def refreshdb(var, wrapper, message):
|
|||||||
expire_tempbans()
|
expire_tempbans()
|
||||||
wrapper.reply("Done.")
|
wrapper.reply("Done.")
|
||||||
|
|
||||||
@command("fdie", "fbye", flag="D", pm=True)
|
@command("fdie", "fbye", flag="F", pm=True)
|
||||||
def forced_exit(var, wrapper, message):
|
def forced_exit(var, wrapper, message):
|
||||||
"""Forces the bot to close."""
|
"""Forces the bot to close."""
|
||||||
|
|
||||||
@ -1114,7 +1114,7 @@ def fleave(var, wrapper, message):
|
|||||||
wrapper.send(messages["not_playing"].format(person))
|
wrapper.send(messages["not_playing"].format(person))
|
||||||
return
|
return
|
||||||
|
|
||||||
@cmd("fstart", flag="A", phases=("join",))
|
@cmd("fstart", flag="S", phases=("join",))
|
||||||
def fstart(cli, nick, chan, rest):
|
def fstart(cli, nick, chan, rest):
|
||||||
"""Forces the game to start immediately."""
|
"""Forces the game to start immediately."""
|
||||||
cli.msg(botconfig.CHANNEL, messages["fstart_success"].format(nick))
|
cli.msg(botconfig.CHANNEL, messages["fstart_success"].format(nick))
|
||||||
@ -1776,7 +1776,7 @@ def hurry_up(cli, gameid, change):
|
|||||||
cli.msg(chan, messages["sunset"])
|
cli.msg(chan, messages["sunset"])
|
||||||
event.data["transition_night"](cli)
|
event.data["transition_night"](cli)
|
||||||
|
|
||||||
@cmd("fnight", flag="d")
|
@cmd("fnight", flag="N")
|
||||||
def fnight(cli, nick, chan, rest):
|
def fnight(cli, nick, chan, rest):
|
||||||
"""Forces the day to end and night to begin."""
|
"""Forces the day to end and night to begin."""
|
||||||
if var.PHASE != "day":
|
if var.PHASE != "day":
|
||||||
@ -1785,7 +1785,7 @@ def fnight(cli, nick, chan, rest):
|
|||||||
hurry_up(cli, 0, True)
|
hurry_up(cli, 0, True)
|
||||||
|
|
||||||
|
|
||||||
@cmd("fday", flag="d")
|
@cmd("fday", flag="N")
|
||||||
def fday(cli, nick, chan, rest):
|
def fday(cli, nick, chan, rest):
|
||||||
"""Forces the night to end and the next day to begin."""
|
"""Forces the night to end and the next day to begin."""
|
||||||
if var.PHASE != "night":
|
if var.PHASE != "night":
|
||||||
@ -6057,7 +6057,7 @@ def wait(cli, nick, chan, rest):
|
|||||||
cli.msg(chan, messages["wait_time_increase"].format(nick, var.EXTRA_WAIT))
|
cli.msg(chan, messages["wait_time_increase"].format(nick, var.EXTRA_WAIT))
|
||||||
|
|
||||||
|
|
||||||
@cmd("fwait", flag="A", phases=("join",))
|
@cmd("fwait", flag="w", phases=("join",))
|
||||||
def fwait(cli, nick, chan, 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."""
|
||||||
|
|
||||||
@ -6084,7 +6084,7 @@ def fwait(cli, nick, chan, rest):
|
|||||||
cli.msg(chan, messages["forced_wait_time_decrease"].format(nick, abs(extra), "s" if extra != -1 else ""))
|
cli.msg(chan, messages["forced_wait_time_decrease"].format(nick, abs(extra), "s" if extra != -1 else ""))
|
||||||
|
|
||||||
|
|
||||||
@cmd("fstop", flag="A", phases=("join", "day", "night"))
|
@cmd("fstop", flag="S", phases=("join", "day", "night"))
|
||||||
def reset_game(cli, nick, chan, rest):
|
def reset_game(cli, nick, chan, rest):
|
||||||
"""Forces the game to stop."""
|
"""Forces the game to stop."""
|
||||||
if nick == "<stderr>":
|
if nick == "<stderr>":
|
||||||
@ -6845,7 +6845,7 @@ def update(cli, nick, chan, rest):
|
|||||||
if ret:
|
if ret:
|
||||||
restart_program.caller(cli, nick, chan, "Updating bot")
|
restart_program.caller(cli, nick, chan, "Updating bot")
|
||||||
|
|
||||||
@command("send", "fsend", flag="F", pm=True)
|
@command("fsend", flag="F", pm=True)
|
||||||
def fsend(var, wrapper, message):
|
def fsend(var, wrapper, message):
|
||||||
"""Forcibly send raw IRC commands to the server."""
|
"""Forcibly send raw IRC commands to the server."""
|
||||||
wrapper.source.client.send(message)
|
wrapper.source.client.send(message)
|
||||||
@ -6912,7 +6912,7 @@ def can_run_restricted_cmd(user):
|
|||||||
|
|
||||||
return True
|
return True
|
||||||
|
|
||||||
@command("spectate", "fspectate", flag="A", pm=True, phases=("day", "night"))
|
@command("spectate", "fspectate", flag="a", pm=True, phases=("day", "night"))
|
||||||
def fspectate(var, wrapper, message):
|
def fspectate(var, wrapper, message):
|
||||||
"""Spectate wolfchat or deadchat."""
|
"""Spectate wolfchat or deadchat."""
|
||||||
if not can_run_restricted_cmd(wrapper.source):
|
if not can_run_restricted_cmd(wrapper.source):
|
||||||
@ -6954,26 +6954,6 @@ def fspectate(var, wrapper, message):
|
|||||||
wrapper.pm(messages["fspectate_on"].format(what))
|
wrapper.pm(messages["fspectate_on"].format(what))
|
||||||
wrapper.pm("People in {0}: {1}".format(what, ", ".join(players)))
|
wrapper.pm("People in {0}: {1}".format(what, ", ".join(players)))
|
||||||
|
|
||||||
before_debug_mode_commands = list(COMMANDS.keys())
|
|
||||||
|
|
||||||
if botconfig.DEBUG_MODE or botconfig.ALLOWED_NORMAL_MODE_COMMANDS:
|
|
||||||
|
|
||||||
@command("eval", owner_only=True, pm=True)
|
|
||||||
def pyeval(var, wrapper, message):
|
|
||||||
"""Evaluate a Python expression."""
|
|
||||||
try:
|
|
||||||
wrapper.send(str(eval(message))[:500])
|
|
||||||
except Exception as e:
|
|
||||||
wrapper.send("{e.__class__.__name__}: {e}".format(e=e))
|
|
||||||
|
|
||||||
@command("exec", owner_only=True, pm=True)
|
|
||||||
def py(var, wrapper, message):
|
|
||||||
"""Execute arbitrary Python code."""
|
|
||||||
try:
|
|
||||||
exec(message)
|
|
||||||
except Exception as e:
|
|
||||||
wrapper.send("{e.__class__.__name__}: {e}".format(e=e))
|
|
||||||
|
|
||||||
@command("revealroles", flag="a", pm=True, phases=("day", "night"))
|
@command("revealroles", flag="a", pm=True, phases=("day", "night"))
|
||||||
def revealroles(var, wrapper, message):
|
def revealroles(var, wrapper, message):
|
||||||
"""Reveal role information."""
|
"""Reveal role information."""
|
||||||
@ -7052,7 +7032,7 @@ if botconfig.DEBUG_MODE or botconfig.ALLOWED_NORMAL_MODE_COMMANDS:
|
|||||||
wrapper.pm(*output, sep=" | ")
|
wrapper.pm(*output, sep=" | ")
|
||||||
|
|
||||||
|
|
||||||
@cmd("fgame", flag="d", raw_nick=True, phases=("join",))
|
@cmd("fgame", flag="g", raw_nick=True, phases=("join",))
|
||||||
def fgame(cli, nick, chan, rest):
|
def fgame(cli, nick, chan, rest):
|
||||||
"""Force a certain game mode to be picked. Disable voting for game modes upon use."""
|
"""Force a certain game mode to be picked. Disable voting for game modes upon use."""
|
||||||
nick = parse_nick(nick)[0]
|
nick = parse_nick(nick)[0]
|
||||||
@ -7099,6 +7079,29 @@ if botconfig.DEBUG_MODE or botconfig.ALLOWED_NORMAL_MODE_COMMANDS:
|
|||||||
fgame.__doc__ = fgame_help
|
fgame.__doc__ = fgame_help
|
||||||
|
|
||||||
|
|
||||||
|
before_debug_mode_commands = list(COMMANDS.keys())
|
||||||
|
|
||||||
|
if botconfig.DEBUG_MODE:
|
||||||
|
|
||||||
|
@command("eval", owner_only=True, pm=True)
|
||||||
|
def pyeval(var, wrapper, message):
|
||||||
|
"""Evaluate a Python expression."""
|
||||||
|
try:
|
||||||
|
wrapper.send(str(eval(message))[:500])
|
||||||
|
except Exception as e:
|
||||||
|
wrapper.send("{e.__class__.__name__}: {e}".format(e=e))
|
||||||
|
|
||||||
|
@command("exec", owner_only=True, pm=True)
|
||||||
|
def py(var, wrapper, message):
|
||||||
|
"""Execute arbitrary Python code."""
|
||||||
|
try:
|
||||||
|
exec(message)
|
||||||
|
except Exception as e:
|
||||||
|
wrapper.send("{e.__class__.__name__}: {e}".format(e=e))
|
||||||
|
|
||||||
|
|
||||||
|
if botconfig.DEBUG_MODE or botconfig.ALLOWED_NORMAL_MODE_COMMANDS:
|
||||||
|
|
||||||
# DO NOT MAKE THIS A PMCOMMAND ALSO
|
# DO NOT MAKE THIS A PMCOMMAND ALSO
|
||||||
@cmd("force", flag="d")
|
@cmd("force", flag="d")
|
||||||
def force(cli, nick, chan, rest):
|
def force(cli, nick, chan, rest):
|
||||||
|
Loading…
x
Reference in New Issue
Block a user