switchboard

package module
v0.0.0-...-f916fe3 Latest Latest
Warning

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

Go to latest
Published: Nov 17, 2023 License: MIT Imports: 6 Imported by: 2

README

switchboard

Utility library for Discordgo providing streamlined interaction support

Documentation

Index

Constants

This section is empty.

Variables

View Source
var ErrHandlerInvalidFirstParameterType = errors.New(
	"incorrect first parameter type for handler - first parameter must be of type *discordgo.Session",
)
View Source
var ErrHandlerInvalidParameterCount = errors.New(
	"invalid number of handler arguments",
)
View Source
var ErrHandlerInvalidSecondParameterType = errors.New(
	"incorrect second parameter type for handler - second parameter must be of type *discordgo.InteractionCreate",
)
View Source
var ErrHandlerInvalidThirdParameterType = errors.New(
	"incorrect third parameter type for handler - third parameter must be of type struct",
)
View Source
var ErrHandlerNotFunction = errors.New(
	"provided command handler is not a function",
)
View Source
var ErrInvalidArgumentType = errors.New(
	"struct field type is not a supported option type",
)
View Source
var ErrMessageHandlerInvalidThirdParameterType = errors.New(
	"incorrect third parameter type for handler - third parameter must be of type *discordgo.Message",
)
View Source
var ErrUnknownCommand = errors.New("unknown command")
View Source
var ErrUnsupportedDefaultArgType = errors.New(
	"attempted to use default value for option type which does not currently support default values",
)
View Source
var ErrUnsupportedInteractionType = errors.New("unsupported interaction type")

Functions

This section is empty.

Types

type Command

type Command struct {
	Name        string
	Description string
	Handler     any
	GuildID     string

	Type CommandType
}

func (*Command) ToDiscordCommand

func (c *Command) ToDiscordCommand() (*discordgo.ApplicationCommand, error)

type CommandType

type CommandType int
const (
	SlashCommand CommandType = iota
	MessageCommand
)

type Switchboard

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

func (*Switchboard) AddCommand

func (s *Switchboard) AddCommand(command *Command) error

func (*Switchboard) HandleInteractionCreate

func (s *Switchboard) HandleInteractionCreate(session *discordgo.Session, interaction *discordgo.InteractionCreate)

func (*Switchboard) SyncCommands

func (s *Switchboard) SyncCommands(session *discordgo.Session, appId string) error

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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