plugins

package
v0.0.0-...-f0c0f71 Latest Latest
Warning

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

Go to latest
Published: Aug 7, 2022 License: MIT Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Add

func Add[T any](col Collection[*Plugin[T]], plugin ...*Plugin[T])

Adds a plugin to the collection.

Types

type Collection

type Collection[T any] map[string]T

type Plugin

type Plugin[T any] struct {
	// Plugin name.
	Name string
	// Plugin type.
	Type PluginType
	// Handler is the function that will be called for the differents plugins
	Handler func(*discordgo.Session, T)
	// Discord interaction
	Interaction func(*discordgo.Session, *discordgo.InteractionCreate)
}

Plugin represents a plugin for the bot.

func Get

func Get[T any](col Collection[*Plugin[T]], key string) (*Plugin[T], error)

Gets a plugin from the collection.

type PluginHandler

type PluginHandler interface {
	AddHandler(interface{}) func()
	AddHandlerOnce(interface{}) func()
}

PluginHandler represents the structs that will be used to handle the plugins. Like discordgo.Session.

type PluginType

type PluginType string
const (
	MessageCreateType PluginType = "message_create"
)

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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