middleware

package
v0.0.0-...-a86730a Latest Latest
Warning

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

Go to latest
Published: Jul 16, 2020 License: MIT Imports: 8 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Argument

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

func (*Argument) GetID

func (a *Argument) GetID() (id uint64, ok bool)

func (*Argument) GetNumeric

func (a *Argument) GetNumeric() (value int, ok bool)

func (*Argument) String

func (a *Argument) String() string

type Command

type Command struct {
	Arguments []Argument
}

func GetCommandFromContext

func GetCommandFromContext(ctx context.Context) (Command, error)

Allows you to get command from context after FilterCommand

type CommandOptions

type CommandOptions struct {
	Prefixes []string
	Aliases  []string
}

type Key

type Key int
const (
	CommandKey Key = 0
)

type Middleware

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

func New

func New(session disgord.Session) (*Middleware, error)

Create new Middleware

func (*Middleware) FilterBotMessages

func (h *Middleware) FilterBotMessages(evt interface{}) interface{}

FilterBotMessage doesn't bypass on messages from bots

func (*Middleware) FilterCommand

func (h *Middleware) FilterCommand(commandOptions CommandOptions) func(evt interface{}) interface{}

FilterCommand checks if a message begins with a prefix and if one of the command aliases exists after the prefix

Jump to

Keyboard shortcuts

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