plug

package module
v0.5.3 Latest Latest
Warning

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

Go to latest
Published: Nov 24, 2020 License: MIT Imports: 10 Imported by: 2

README

plug

Plugin system for Snart.

Documentation

Overview

Package plug provides plugin functionality for Snart.

Index

Constants

This section is empty.

Variables

View Source
var Dirs = []string{
	".",
	"plugs",
}

Dirs is a list of directories to search for Plugs.

View Source
var ErrNoPlug = errors.New("no such plug")

ErrNoPlug occurs when a named Plug cannot be found.

Functions

This section is empty.

Types

type Base

type Base struct {
	DB    *db.DB
	State *state.State
	Route *route.Route
	Err   chan error
}

Base is a Plug that provides stub functionality to be embedded into other Plugs.

func (*Base) Gamers

func (b *Base) Gamers() []gamer.Gamer

Gamers returns additional gamer.Gamers to be added to the Queue.

func (*Base) Intents

func (b *Base) Intents() gateway.Intents

Intents returns additional Intents to be ORed in.

func (*Base) PlugDB

func (b *Base) PlugDB(d *db.DB)

PlugDB loads the given db.DB into the Base.

func (*Base) PlugErr

func (b *Base) PlugErr(e chan error)

PlugErr loads the given error channel into the Base.

func (*Base) PlugRoute added in v0.5.0

func (b *Base) PlugRoute(r *route.Route)

PlugRoute loads the given Route into the Base.

func (*Base) PlugState added in v0.5.0

func (b *Base) PlugState(s *state.State)

PlugState loads the given State into the Base.

func (*Base) Unload added in v0.5.0

func (b *Base) Unload() error

Unload removes all of the Plug's associations.

type Plug

type Plug interface {
	String() string

	PlugDB(*db.DB)
	PlugState(*state.State)
	PlugRoute(*route.Route)
	PlugErr(chan error)

	Intents() gateway.Intents
	Gamers() []gamer.Gamer

	Unload() error
}

Plug provides all the components of a Snart plugin.

func Load added in v0.5.0

func Load(name string) (Plug, error)

Load loads and returns the named Plug.

Jump to

Keyboard shortcuts

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