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.

Source Files

Directories

Path Synopsis
discord
slack
telegram