mirror of
https://github.com/onyx-and-iris/q3rcon-cli.git
synced 2026-04-17 22:43:39 +00:00
add maprestart command
This commit is contained in:
@@ -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',
|
||||
]
|
||||
|
||||
22
src/q3rcon_cli/commands/maprestart.py
Normal file
22
src/q3rcon_cli/commands/maprestart.py
Normal 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)
|
||||
Reference in New Issue
Block a user