mirror of
https://github.com/onyx-and-iris/q3rcon-cli.git
synced 2026-03-23 18:29:18 +00:00
print success messages instead boxed output on cvar change
This commit is contained in:
parent
a9aff25c4e
commit
fce5858a93
@ -1,5 +1,5 @@
|
|||||||
from aioq3rcon import Client
|
from aioq3rcon import Client
|
||||||
from clypi import Command, Positional, Spinner, arg
|
from clypi import Command, Positional, Spinner, arg, cprint
|
||||||
from typing_extensions import override
|
from typing_extensions import override
|
||||||
|
|
||||||
from q3rcon_cli import console
|
from q3rcon_cli import console
|
||||||
@ -23,21 +23,17 @@ class Gametype(Command):
|
|||||||
|
|
||||||
@override
|
@override
|
||||||
async def run(self):
|
async def run(self):
|
||||||
if not Gametype.new_gametype:
|
if not self.new_gametype:
|
||||||
async with Client(self.host, self.port, self.password) as client:
|
async with Client(self.host, self.port, self.password) as client:
|
||||||
if response := await client.send_command('g_gametype'):
|
if response := await client.send_command('g_gametype'):
|
||||||
console.out.print_cvar(response)
|
console.out.print_cvar(response)
|
||||||
return
|
return
|
||||||
|
|
||||||
async with Client(self.host, self.port, self.password) as client:
|
async with Client(self.host, self.port, self.password) as client:
|
||||||
DEFAULT_FRAGMENT_READ_TIMEOUT = client.fragment_read_timeout
|
|
||||||
|
|
||||||
await client.send_command(f'g_gametype {self.new_gametype}')
|
await client.send_command(f'g_gametype {self.new_gametype}')
|
||||||
if self.force:
|
if self.force:
|
||||||
async with Spinner('Forcing gametype change', suffix='...'):
|
async with Spinner('Forcing gametype change', suffix='...'):
|
||||||
client.fragment_read_timeout = 1
|
client.fragment_read_timeout = 1
|
||||||
await client.send_command('map_restart')
|
await client.send_command('map_restart')
|
||||||
|
|
||||||
client.fragment_read_timeout = DEFAULT_FRAGMENT_READ_TIMEOUT
|
cprint(f'Gametype changed successfully to {self.new_gametype}.', fg='green')
|
||||||
if response := await client.send_command('g_gametype'):
|
|
||||||
console.out.print_cvar(response)
|
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
from aioq3rcon import Client
|
from aioq3rcon import Client
|
||||||
from clypi import Command, Positional, arg
|
from clypi import Command, Positional, arg, cprint
|
||||||
from typing_extensions import override
|
from typing_extensions import override
|
||||||
|
|
||||||
from q3rcon_cli import console
|
from q3rcon_cli import console
|
||||||
@ -26,5 +26,5 @@ class Hostname(Command):
|
|||||||
|
|
||||||
async with Client(self.host, self.port, self.password) as client:
|
async with Client(self.host, self.port, self.password) as client:
|
||||||
await client.send_command(f'sv_hostname {self.new_hostname}')
|
await client.send_command(f'sv_hostname {self.new_hostname}')
|
||||||
if response := await client.send_command('sv_hostname'):
|
|
||||||
console.out.print_cvar(response)
|
cprint(f'Hostname changed to: {self.new_hostname}', fg='green')
|
||||||
|
|||||||
@ -1,5 +1,5 @@
|
|||||||
from aioq3rcon import Client
|
from aioq3rcon import Client
|
||||||
from clypi import Command, Positional, Spinner, arg
|
from clypi import Command, Positional, Spinner, arg, cprint
|
||||||
from typing_extensions import override
|
from typing_extensions import override
|
||||||
|
|
||||||
from q3rcon_cli import console
|
from q3rcon_cli import console
|
||||||
@ -29,5 +29,5 @@ class Map(Command):
|
|||||||
self.host, self.port, self.password, fragment_read_timeout=1
|
self.host, self.port, self.password, fragment_read_timeout=1
|
||||||
) as client:
|
) as client:
|
||||||
await client.send_command(f'map mp_{self.new_map.removeprefix("mp_")}')
|
await client.send_command(f'map mp_{self.new_map.removeprefix("mp_")}')
|
||||||
if response := await client.send_command('mapname'):
|
|
||||||
console.out.print_cvar(response)
|
cprint(f'Map changed to {self.new_map.removeprefix("mp_")}', fg='green')
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user