out

package
v1.0.0 Latest Latest
Warning

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

Go to latest
Published: Dec 7, 2022 License: LGPL-3.0 Imports: 9 Imported by: 0

Documentation

Overview

Package out implements custom or higher level outputs than that which are implemented by Disdup directly. These are designed for use by a user through shell scripting or the disdup program directly, rather than being imported by another package.

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrEmptyCommand = errors.New("output executor: empty command")
)

Possible executor init errors.

Functions

This section is empty.

Types

type Executor

type Executor struct {
	// Command is the path to or name of the program to execute on message
	// send.
	Command string
	// Args are command line arguments to provide to the program. Simple
	// format substitution is supported for each, replacing the following:
	//   - {id}: unique message ID
	//   - {author}: name#tag of the author of the message
	//   - {guild}: the name of the guild in which the message was sent
	//   - {channel}: the name of the channel in which the message was sent
	//   - {content}: the formatted content of the message
	//   - {time}: approximate timestamp of the message's send, formatted according to RFC822
	//
	// Arguments are guaranteed to be formatted as correct command line
	// arguments, with the same restrictions as per usual via exec.Command.
	Args []string
	// contains filtered or unexported fields
}

Executor reads in all incoming messages and executes a given program with configurable arguments. Arguments may contain formatting directives to pass information about messages to the executing program.

If an empty command is passed, Executor.Open returns ErrEmptyCommand.

func (*Executor) Close

func (e *Executor) Close() error

func (*Executor) Open

func (e *Executor) Open(s *discordgo.Session) error

func (*Executor) Write

func (e *Executor) Write(m output.Message)

Jump to

Keyboard shortcuts

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