got

package module
v0.0.0-...-80aff6b Latest Latest
Warning

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

Go to latest
Published: Mar 9, 2020 License: MIT Imports: 9 Imported by: 0

README

got - Slack Bot Framework

License Go Report Card GolangCI

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func RegisterHandler

func RegisterHandler(hg HandlerGenerator, opts ...MuxOption)

func RegisterHandlerFunc

func RegisterHandlerFunc(hg HandlerFuncGenerator, opts ...MuxOption)

func Start

func Start(ctx context.Context, token string, opts ...Option) error

Types

type Got

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

func New

func New(ctx context.Context, token string, opts ...Option) (*Got, error)

func NewWithSlack

func NewWithSlack(ctx context.Context, s Slack, opts ...Option) (got *Got, err error)

func (*Got) AddHandler

func (got *Got) AddHandler(h Handler, opts ...MuxOption)

func (*Got) AddHandlerFunc

func (got *Got) AddHandlerFunc(f HandlerFunc, opts ...MuxOption)

func (*Got) ID

func (got *Got) ID() string

func (*Got) Logger

func (got *Got) Logger() *zap.SugaredLogger

func (*Got) Name

func (got *Got) Name() string

func (*Got) NewMux

func (got *Got) NewMux() *Mux

func (*Got) RegisterHandler

func (got *Got) RegisterHandler(hgen HandlerGenerator, opts ...MuxOption) error

func (*Got) RegisterHandlerFunc

func (got *Got) RegisterHandlerFunc(hgen HandlerFuncGenerator, opts ...MuxOption) error

func (*Got) Start

func (got *Got) Start(ctx context.Context) error

func (*Got) Store

func (got *Got) Store(namespace string) store.Store

type Handler

type Handler interface {
	Handle(context.Context, *Message)
}

type HandlerFunc

type HandlerFunc func(context.Context, *Message)

func (HandlerFunc) Handle

func (f HandlerFunc) Handle(ctx context.Context, msg *Message)

type HandlerFuncGenerator

type HandlerFuncGenerator func(*Got) (HandlerFunc, error)

type HandlerGenerator

type HandlerGenerator func(*Got) (Handler, error)

type Message

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

func (*Message) Channel

func (m *Message) Channel() string

func (*Message) FullText

func (m *Message) FullText() string

func (*Message) IsMention

func (m *Message) IsMention() bool

func (*Message) RawMessageEvent

func (m *Message) RawMessageEvent() *slack.MessageEvent

func (*Message) Reply

func (m *Message) Reply(msg string)

func (*Message) Send

func (m *Message) Send(msg string)

func (*Message) Text

func (m *Message) Text() string

func (*Message) UserID

func (m *Message) UserID() string

type Mux

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

func (*Mux) AddHandler

func (m *Mux) AddHandler(h Handler, opts ...MuxOption)

func (*Mux) AddHandlerFunc

func (m *Mux) AddHandlerFunc(f HandlerFunc, opts ...MuxOption)

func (*Mux) Handle

func (m *Mux) Handle(ctx context.Context, msg *Message)

type MuxOption

type MuxOption interface {
	// contains filtered or unexported methods
}

func HandleAllMessages

func HandleAllMessages() MuxOption

func HandleOnlyMention

func HandleOnlyMention() MuxOption

func HandleWithRegexp

func HandleWithRegexp(re *regexp.Regexp) MuxOption

func HandleWithRegexpRaw

func HandleWithRegexpRaw(re *regexp.Regexp) MuxOption

type Option

type Option interface {
	// contains filtered or unexported methods
}

func WithLogger

func WithLogger(l *zap.SugaredLogger) Option

func WithStore

func WithStore(s store.Provider) Option

type Slack

type Slack interface {
	AuthTestContext(context.Context) (*slack.AuthTestResponse, error)
	NewRTM(...slack.RTMOption) *slack.RTM
}

Directories

Path Synopsis
stores

Jump to

Keyboard shortcuts

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