input

package
v1.8.5 Latest Latest
Warning

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

Go to latest
Published: Aug 5, 2019 License: Apache-2.0 Imports: 1 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

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