mirror of
https://github.com/onyx-and-iris/vban-cli.git
synced 2026-03-02 21:19:11 +00:00
add sendtext command, attach it to the root command.
disable the rt listeners if sendtext command is invoked.
This commit is contained in:
parent
dd0d150202
commit
28ec67839a
@ -2,7 +2,7 @@ from dataclasses import dataclass
|
|||||||
from typing import Annotated
|
from typing import Annotated
|
||||||
|
|
||||||
import vban_cmd
|
import vban_cmd
|
||||||
from cyclopts import App, Parameter, config
|
from cyclopts import App, Argument, Parameter, config
|
||||||
|
|
||||||
from . import __version__ as version
|
from . import __version__ as version
|
||||||
from . import bus, console, strip
|
from . import bus, console, strip
|
||||||
@ -37,15 +37,32 @@ def launcher(
|
|||||||
if tokens[0] == '--install-completion':
|
if tokens[0] == '--install-completion':
|
||||||
return command(*bound.args, **bound.kwargs)
|
return command(*bound.args, **bound.kwargs)
|
||||||
|
|
||||||
|
disable_rt_listeners = False
|
||||||
|
if command.__name__ == 'sendtext':
|
||||||
|
disable_rt_listeners = True
|
||||||
|
|
||||||
with vban_cmd.api(
|
with vban_cmd.api(
|
||||||
vban_config.kind,
|
vban_config.kind,
|
||||||
ip=vban_config.host,
|
ip=vban_config.host,
|
||||||
port=vban_config.port,
|
port=vban_config.port,
|
||||||
streamname=vban_config.streamname,
|
streamname=vban_config.streamname,
|
||||||
|
disable_rt_listeners=disable_rt_listeners,
|
||||||
) as client:
|
) as client:
|
||||||
return command(*bound.args, **bound.kwargs, ctx=Context(client=client))
|
return command(*bound.args, **bound.kwargs, ctx=Context(client=client))
|
||||||
|
|
||||||
|
|
||||||
|
@app.command(name='sendtext')
|
||||||
|
def sendtext(
|
||||||
|
text: Annotated[str, Argument()],
|
||||||
|
/,
|
||||||
|
*,
|
||||||
|
ctx: Annotated[Context, Parameter(show=False)] = None,
|
||||||
|
):
|
||||||
|
"""Send a text command to the current Voicemeeter/Matrix instance."""
|
||||||
|
if resp := ctx.client.sendtext(text):
|
||||||
|
console.out.print(resp)
|
||||||
|
|
||||||
|
|
||||||
def run():
|
def run():
|
||||||
try:
|
try:
|
||||||
app.meta()
|
app.meta()
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user