dispatcher

package
v23.5.0 Latest Latest
Warning

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

Go to latest
Published: Nov 19, 2021 License: MIT Imports: 15 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ETFPayloadToMessage

func ETFPayloadToMessage(ctx context.Context, ep ETFPayload) (wsapi.WSMessage, error)

ETFPayloadToMessage converts a specialized etf payload to a websocket message

Types

type DispatchHandlerFunc

type DispatchHandlerFunc = func(Payload, wsapi.WSMessage, chan<- wsapi.WSMessage) snowflake.Snowflake

DispatcherFunc is the api that a bot expects a handler function to have

type Dispatcher

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

func NewDispatcher

func NewDispatcher(deps dependencies) *Dispatcher

NewDispatcher creates a new Dispatcher object with default state and session management handlers installed

func (*Dispatcher) AddHandler

func (c *Dispatcher) AddHandler(event string, handler DispatchHandlerFunc)

func (*Dispatcher) ConnectToBot

func (c *Dispatcher) ConnectToBot(b *bot.DiscordBot)

func (*Dispatcher) GenerateHeartbeat

func (c *Dispatcher) GenerateHeartbeat(reqCtx context.Context, seqNum int) (wsapi.WSMessage, error)

func (*Dispatcher) HandleRequest

func (c *Dispatcher) HandleRequest(req wsapi.WSMessage, resp chan<- wsapi.WSMessage) snowflake.Snowflake

func (*Dispatcher) SetDebug

func (c *Dispatcher) SetDebug(val bool)

type ETFPayload

type ETFPayload interface {
	Payload() (etfapi.Payload, error)
}

ETFPayload is the interface that a specialized etf api payload conforms to

type Logger

type Logger = interface {
	Log(keyvals ...interface{}) error
	Message(string, ...interface{})
	Err(string, error, ...interface{})
	Printf(string, ...interface{})
}

type Payload

type Payload = interface {
	EventName() string
	Contents() map[string]etfapi.Element
}

Jump to

Keyboard shortcuts

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