console

package
v0.0.0-...-2b3799d Latest Latest
Warning

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

Go to latest
Published: Jun 19, 2017 License: Apache-2.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func REPL

func REPL(name, prefix string)

REPL starts a readline-like bot REPL on the console. All plugins that are present and registered are automatically enabled. name should be a non-empty string. It is reported as the room name/id and will be the string in the REPL prompt, e.g. "foo" -> "foo> ". If prefix is set, it is prepended to every line so you can do, e.g. REPL("foo", "!foo") and every line in the REPL will show up in the hal Evt.Body as "!foo <whatever>". To avoid this, set it to empty string. This will start 2 goroutines.

Types

type Broker

type Broker struct {
	User   string
	Room   string
	Topic  string
	Stdin  chan string
	Stdout chan string
}

func (Broker) GetTopic

func (cb Broker) GetTopic(roomId string) (string, error)

func (Broker) Leave

func (cb Broker) Leave(roomId string) error

func (Broker) LooksLikeRoomId

func (cb Broker) LooksLikeRoomId(room string) bool

func (Broker) LooksLikeUserId

func (cb Broker) LooksLikeUserId(user string) bool

func (Broker) Name

func (cb Broker) Name() string

func (Broker) RoomIdToName

func (b Broker) RoomIdToName(in string) string

required by interface

func (Broker) RoomNameToId

func (b Broker) RoomNameToId(in string) string

func (Broker) Send

func (cb Broker) Send(e hal.Evt)

func (Broker) SendDM

func (cb Broker) SendDM(e hal.Evt)

func (Broker) SendTable

func (cb Broker) SendTable(e hal.Evt, hdr []string, rows [][]string)

func (Broker) SetTopic

func (cb Broker) SetTopic(roomId, topic string) error

func (Broker) SimpleStdin

func (cb Broker) SimpleStdin()

SimpleStdin will loop forever reading stdin and publish each line as an event in the console broker. e.g. go cbroker.SimpleStdin()

func (Broker) SimpleStdout

func (cb Broker) SimpleStdout()

SimpleStdout prints all replies, etc to the broker on os.Stdout. e.g. go cbroker.SimpleStdout()

func (Broker) Stream

func (cb Broker) Stream(out chan *hal.Evt)

func (Broker) UserIdToName

func (b Broker) UserIdToName(in string) string

func (Broker) UserNameToId

func (b Broker) UserNameToId(in string) string

type Config

type Config struct{}

func (Config) NewBroker

func (c Config) NewBroker(name string) Broker

NewBroker returns a new console.Broker.

type SlashReaction

type SlashReaction string

Jump to

Keyboard shortcuts

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