ui

package
v0.0.0-...-8568aec Latest Latest
Warning

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

Go to latest
Published: Mar 5, 2017 License: MIT Imports: 5 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ChatMsgHandler

type ChatMsgHandler func(ctx context.Context, msg interface{})

ChatMsgHandler handles incoming messages from users; each message should invoke ChatMsgHandler in a separate goroutine.

type Chatter

type Chatter interface {
	Talker
	Listener
}

Chatter combines Talker and Listener.

type Listener

type Listener interface {
	Listen(ChatMsgHandler) error
}

Listener keeps listening to incoming messages, do any pre-processing if needed and calls ChatMsgHandler with the messages; it will not return utils error happens.

type SlackChat

type SlackChat struct {
	// contains filtered or unexported fields
}

SlackChat implements Chatter interface. It wraps the slack.Client and its RTM websocket for seamless communication.

func NewSlackChat

func NewSlackChat(token string, lg *log.Logger) *SlackChat

NewSlackChat uses the token to set the slack client properly, but no connection is made so far.

func (*SlackChat) Listen

func (t *SlackChat) Listen(f ChatMsgHandler) error

Listen keeps receiving the RTM events and dispatches them to the handler function in separate goroutines.

func (*SlackChat) SetLogger

func (t *SlackChat) SetLogger(lg *log.Logger)

SetLogger resets the Logger.

func (*SlackChat) Talk

func (t *SlackChat) Talk(target, msg string, options interface{}) error

type Talker

type Talker interface {
	Talk(target, msg string, options interface{}) error
}

Talker sends message to target with any options; msg as a string should be supported by most backends and useful even sending alone, while target and options are backend-specific.

Jump to

Keyboard shortcuts

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