commands

package
v0.0.0-...-20b52b3 Latest Latest
Warning

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

Go to latest
Published: May 14, 2024 License: GPL-3.0 Imports: 4 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrInvalidAnswerMessage    = errors.New("answer message is not valid")
	ErrNoSubCommandHandler     = errors.New("no sub command handler provided")
	ErrInvalidInteraction      = errors.New("message interaction is not valid")
	ErrRequestPropertyNotFound = errors.New("request property is not found")
)

Functions

func IsApplicationCommand

func IsApplicationCommand(i *discordgo.InteractionCreate) bool

func IsMessageCommand

func IsMessageCommand(i *discordgo.InteractionCreate) bool

Types

type AbstractCommand

type AbstractCommand struct{}

func (*AbstractCommand) CallHandler

func (command *AbstractCommand) CallHandler(s *discordgo.Session, i *discordgo.InteractionCreate,
	handlers DiscordHandlers)

func (*AbstractCommand) HandleSubCommand

func (command *AbstractCommand) HandleSubCommand(handlers map[string]DiscordHandler) DiscordHandler

type Description

type Description struct {
	CommandID   string
	Description string
}

type DiscordCommand

type DiscordCommand interface {
	GetName() string
	GetDescriptions(lg discordgo.Locale) []Description
	Matches(i *discordgo.InteractionCreate) bool
	Handle(s *discordgo.Session, i *discordgo.InteractionCreate)
}

type DiscordHandler

type DiscordHandler func(s *discordgo.Session, i *discordgo.InteractionCreate)

type SubCommandHandlers

type SubCommandHandlers map[string]DiscordHandler

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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