router

package
v0.0.0-...-ab0e0a7 Latest Latest
Warning

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

Go to latest
Published: Feb 15, 2021 License: AGPL-3.0 Imports: 7 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type ArgumentConstructor

type ArgumentConstructor struct {
	To       string
	Required bool
	Output   typeguard.Output
}

ArgumentConstructor defines the structure of an argument

type Arguments

type Arguments map[string]ArgumentConstructor

Arguments defines the structure of a collection of arguments

type Callback

type Callback func(s *discordgo.Session, m *discordgo.MessageCreate, a Arguments)

Callback defines the structure of the callback function for a command

type Command

type Command struct {
	Name        string
	Args        Arguments
	Run         Callback
	Permissions []int
}

Command defines the structure of a command

type Router

type Router struct {
	Commands map[string]Command
	// contains filtered or unexported fields
}

Router defines the structure of the Router

func New

func New() *Router

New returns a new Router

func (*Router) AddCommand

func (r *Router) AddCommand(c Command)

AddCommand Adds a new command to the router

func (*Router) OnMessageCreateHandler

func (r *Router) OnMessageCreateHandler(s *discordgo.Session, m *discordgo.MessageCreate)

OnMessageCreateHandler handles the message create event

func (*Router) SetPrefix

func (r *Router) SetPrefix(prefix string)

SetPrefix sets the command prefix

Jump to

Keyboard shortcuts

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