connector

package
v0.0.0-...-ba21cce Latest Latest
Warning

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

Go to latest
Published: Apr 16, 2018 License: MIT Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrBotNotFound = errors.New("No Such registered team")

Functions

This section is empty.

Types

type Connector

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

Connector internally manages connections to slack teams.

ffjson: skip

func NewConnector

func NewConnector() *Connector

NewConnector creates a new Connector object

func (*Connector) Open

func (c *Connector) Open(team, url string) error

Open opens a websocket connection for the passed URL and assigns it to the given team.

func (*Connector) SetMessageHandler

func (c *Connector) SetMessageHandler(messageHandler MessageHandler)

SetMessageHandler sets the message handler for the connector.

func (*Connector) Typing

func (c *Connector) Typing(team, channel string) error

Typing sends a typing payload.

type MessageHandler

type MessageHandler func(msg []byte, team string)

MessageHandler is a callback to attach that is invoked whenever a new message is received

type MessagePayload

type MessagePayload struct {
	Message json.RawMessage `json:"message"`
	Team    string          `json:"team"`
}

MessagePayload is the payload received from slack over a connection.

func (*MessagePayload) MarshalJSON

func (j *MessagePayload) MarshalJSON() ([]byte, error)

MarshalJSON marshal bytes to json - template

func (*MessagePayload) MarshalJSONBuf

func (j *MessagePayload) MarshalJSONBuf(buf fflib.EncodingBuffer) error

MarshalJSONBuf marshal buff to json - template

func (*MessagePayload) UnmarshalJSON

func (j *MessagePayload) UnmarshalJSON(input []byte) error

UnmarshalJSON umarshall json - template of ffjson

func (*MessagePayload) UnmarshalJSONFFLexer

func (j *MessagePayload) UnmarshalJSONFFLexer(fs *fflib.FFLexer, state fflib.FFParseState) error

UnmarshalJSONFFLexer fast json unmarshall - template ffjson

Directories

Path Synopsis
contrib

Jump to

Keyboard shortcuts

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