add maprestart command

This commit is contained in:
2026-03-21 10:19:01 +00:00
parent 84702a5360
commit 36e54e89b7
4 changed files with 39 additions and 5 deletions

View File

@@ -3,6 +3,7 @@ from .gametype import Gametype
from .hostname import Hostname
from .map import Map
from .mapname import Mapname
from .maprestart import Maprestart
from .maprotate import Maprotate
from .plugins import Plugins
from .status import Status
@@ -16,4 +17,5 @@ __all__ = [
'Hostname',
'Map',
'Plugins',
'Maprestart',
]

View File

@@ -0,0 +1,22 @@
from aioq3rcon import Client
from clypi import Command, Spinner, arg
from typing_extensions import override
from q3rcon_cli.console import Console
class Maprestart(Command):
"""Restarts the current map."""
host: str = arg(inherited=True)
port: int = arg(inherited=True)
password: str = arg(inherited=True)
@override
async def run(self):
async with Spinner('Restarting map...'):
async with Client(
self.host, self.port, self.password, fragment_read_timeout=1
) as client:
if response := await client.send_command('map_restart'):
Console.print_response(response)