events

package
v0.28.3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2021 License: GPL-3.0 Imports: 8 Imported by: 0

Documentation

Index

Constants

View Source
const ExchangeName = "events"

Variables

View Source
var (

	// complete event types
	EventTypeDiscordAll            = eventTypeDiscord + ".*.*"
	EventTypeDiscordMessageAll     = eventTypeDiscordMessage + ".*"
	EventTypeDiscordMessageChannel = eventTypeDiscordMessage + ".channel"
	EventTypeDiscordMessagePrivate = eventTypeDiscordMessage + ".private"
	EventTypeDiscordUserAction     = eventTypeDiscordUser + ".action"
)

Functions

This section is empty.

Types

type Client

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

func NewClient

func NewClient(dsn string) (*Client, error)

func (*Client) AddHandler

func (ec *Client) AddHandler(topic string, handler interface{})

func (*Client) Close

func (ec *Client) Close()

func (*Client) DiscordMessageChannelEmitter

func (ec *Client) DiscordMessageChannelEmitter(msg *hivelib.ChatMessage) error

func (*Client) DiscordMessagePrivateEmitter

func (ec *Client) DiscordMessagePrivateEmitter(msg *hivelib.ChatMessage) error

func (*Client) DiscordUserActionEmitter

func (ec *Client) DiscordUserActionEmitter(action *hivelib.ChatUserAction) error

func (*Client) Run

func (ec *Client) Run() error

func (*Client) Subscribe

func (ec *Client) Subscribe(topics ...string) error

type EventHandler

type EventHandler interface {
	// Handle is called whenever an event of Type() happens.
	// It is the receivers responsibility to type assert that the interface
	// is the expected struct.
	Handle(*Client, interface{})
}

type EventInterfaceProvider

type EventInterfaceProvider interface {
	// New returns a new instance of the struct this event handler handles.
	// This is called once per event.
	New() interface{}
}

Jump to

Keyboard shortcuts

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