onyx-and-iris bfb45efb32 updates to the Console classes:
- 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
2026-03-22 04:10:53 +00:00

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)