cmdclient

package
v0.0.0-...-9648343 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 7, 2021 License: BSD-3-Clause Imports: 7 Imported by: 0

Documentation

Overview

Package cmdclient implements execution of commands using a remote service.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddHostCommandSet

func AddHostCommandSet(tree *iradix.Tree, hcs *ipc.HostCommandSet, mutator Mutator) *iradix.Tree

AddHostCommandSet adds commands provided by a (remote) host to the command tree.

Types

type CommandContext

type CommandContext struct {
	Command      ipc.Command
	ArgValidator *regexp.Regexp
	Executor     Executor
	Tag          string
}

A CommandContext holds information on a command.

func (*CommandContext) ValidateArgs

func (cctx *CommandContext) ValidateArgs(s string) bool

type Executor

type Executor interface {
	Exec(ctx context.Context, tmc ipc.TwitchMessageContext) (ipc.Response, error)
}

type LocalCommand

type LocalCommand struct {
	Handler func(context.Context, ipc.TwitchMessageContext) (ipc.TwitchMessageResponse, error)
}

A LocalCommand is command that is executed locally.

func (*LocalCommand) Exec

type Mutator

type Mutator struct {
	Prefix  string
	Command func(string) string
}

A Mutator is used to mutate commands before inserting them into the command tree.

type RemoteCommand

type RemoteCommand struct {
	Host     ipc.Host
	Endpoint string
}

A RemoteCommand executes a command on a remote host.

func (*RemoteCommand) Exec

func (rcc *RemoteCommand) Exec(ctx context.Context, tmc ipc.TwitchMessageContext) (tmr ipc.Response, err error)

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL