mirror of
https://github.com/onyx-and-iris/q3rcon-cli.git
synced 2026-03-24 02:39:18 +00:00
- added ErrConsole - import console as namespace throughout the package - swap out the static methods for instance methods. Wrap the entry point in try/except. Note, catching IncorrectPasswordError is currently not working. See https://github.com/Iapetus-11/aio-q3-rcon/issues/4
23 lines
669 B
Python
23 lines
669 B
Python
from aioq3rcon import Client
|
|
from clypi import Command, Spinner, arg
|
|
from typing_extensions import override
|
|
|
|
from q3rcon_cli import console
|
|
|
|
|
|
class Status(Command):
|
|
"""Prints the status of the server."""
|
|
|
|
host: str = arg(inherited=True)
|
|
port: int = arg(inherited=True)
|
|
password: str = arg(inherited=True)
|
|
|
|
@override
|
|
async def run(self):
|
|
async with Spinner('Fetching status...'):
|
|
async with Client(
|
|
self.host, self.port, self.password, fragment_read_timeout=0.5
|
|
) as client:
|
|
if response := await client.send_command('status'):
|
|
console.out.print_status(response)
|