Core: make countdown a "admin" only command (#5463)

This commit is contained in:
Fabian Dill
2025-09-21 19:23:29 +02:00
committed by GitHub
parent 9e96cece56
commit 6c45c8d606

View File

@@ -1350,19 +1350,6 @@ class CommandProcessor(metaclass=CommandMeta):
class CommonCommandProcessor(CommandProcessor): class CommonCommandProcessor(CommandProcessor):
ctx: Context ctx: Context
def _cmd_countdown(self, seconds: str = "10") -> bool:
"""Start a countdown in seconds"""
try:
timer = int(seconds, 10)
except ValueError:
timer = 10
else:
if timer > 60 * 60:
raise ValueError(f"{timer} is invalid. Maximum is 1 hour.")
async_start(countdown(self.ctx, timer))
return True
def _cmd_options(self): def _cmd_options(self):
"""List all current options. Warning: lists password.""" """List all current options. Warning: lists password."""
self.output("Current options:") self.output("Current options:")
@@ -2259,6 +2246,19 @@ class ServerCommandProcessor(CommonCommandProcessor):
self.output(f"Could not find player {player_name} to collect") self.output(f"Could not find player {player_name} to collect")
return False return False
def _cmd_countdown(self, seconds: str = "10") -> bool:
"""Start a countdown in seconds"""
try:
timer = int(seconds, 10)
except ValueError:
timer = 10
else:
if timer > 60 * 60:
raise ValueError(f"{timer} is invalid. Maximum is 1 hour.")
async_start(countdown(self.ctx, timer))
return True
@mark_raw @mark_raw
def _cmd_release(self, player_name: str) -> bool: def _cmd_release(self, player_name: str) -> bool:
"""Send out the remaining items from a player to their intended recipients.""" """Send out the remaining items from a player to their intended recipients."""