input

package
v0.10.15 Latest Latest
Warning

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

Go to latest
Published: Mar 23, 2021 License: Apache-2.0 Imports: 1 Imported by: 0

Documentation

Overview

Package input is an interface for bot inputs

Index

Constants

This section is empty.

Variables

View Source
var (
	// Inputs keyed by name
	// Example slack or hipchat
	Inputs = map[string]Input{}
)

Functions

This section is empty.

Types

type Conn

type Conn interface {
	Close() error
	Recv(*Event) error
	Send(*Event) error
}

Conn interface provides a way to send and receive events. Send and Recv both block until succeeding or failing.

type Event

type Event struct {
	Type EventType
	From string
	To   string
	Data []byte
	Meta map[string]interface{}
}

Event is the unit sent and received

type EventType

type EventType string
const (
	TextEvent EventType = "text"
)

type Input

type Input interface {
	// Provide cli flags
	Flags() []cli.Flag
	// Initialise input using cli context
	Init(*cli.Context) error
	// Stream events from the input
	Stream() (Conn, error)
	// Start the input
	Start() error
	// Stop the input
	Stop() error
	// name of the input
	String() string
}

Input is an interface for sources which provide a way to communicate with the bot. Slack, HipChat, XMPP, etc.

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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