mirror of
https://github.com/onyx-and-iris/q3rcon-cli.git
synced 2026-04-13 04:23:38 +00:00
add maprestart command
This commit is contained in:
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