builder

package
v0.0.0-...-0f7ec88 Latest Latest
Warning

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

Go to latest
Published: Jun 25, 2024 License: BSD-3-Clause Imports: 14 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FillContextReply

func FillContextReply[K Event](cb *ContextBuilder, event K, ctx context.Context) (context.Context, error)

func FillPlayerContext

func FillPlayerContext(cb *ContextBuilder, userID snowflake.ID, ctx context.Context) (context.Context, error)

func GetContext

func GetContext(ctx context.Context, app interfaces.App, userID snowflake.ID, opts ...ContextOption) (context.Context, error)

func WithContext

func WithContext[K Event](app interfaces.App, handler func(e *K) error, opts ...ContextOption) func(e *K) error

func WithContextD

func WithContextD[D any, K Event](app interfaces.App, handler func(d D, e *K) error, opts ...ContextOption) func(d D, e *K) error

func WithPlayer

func WithPlayer() func(a *ContextBuilder)

func WithPlayerCards

func WithPlayerCards() func(a *ContextBuilder)

func WithPlayerGithubStars

func WithPlayerGithubStars() func(a *ContextBuilder)

func WithPlayerLootBoxes

func WithPlayerLootBoxes() func(a *ContextBuilder)

func WithPlayerSelectedCard

func WithPlayerSelectedCard() func(a *ContextBuilder)

Types

type Command

type Command struct {
	Name        string
	Description string

	bot.Client
	*handler.Mux
	// contains filtered or unexported fields
}

func NewCommand

func NewCommand(opts ...CommandOption) *Command

func (*Command) Register

func (cmd *Command) Register() error

type CommandOption

type CommandOption func(a *Command)

func WithApp

func WithApp(app interfaces.App) CommandOption

func WithCommandName

func WithCommandName(name string) CommandOption

func WithDescription

func WithDescription(desc string) CommandOption

func WithRegisterFunc

func WithRegisterFunc(r RegisterFunc) CommandOption

type ContextBuilder

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

type ContextKey

type ContextKey string
var (
	PlayerKey ContextKey = "player"
	ErrorKey  ContextKey
)

type ContextOption

type ContextOption func(a *ContextBuilder)
type Menu struct {
	Name  string
	Emoji discord.Emoji

	Commands []*Command
	// contains filtered or unexported fields
}
func (m *Menu) RegisterCommands() ([]discord.ApplicationCommandCreate, error)
type MenuOption func(a *Menu)

func WithCommands

func WithCommands(cmds ...*Command) MenuOption

func WithEmoji

func WithEmoji(emoji discord.Emoji) MenuOption

func WithMenuName

func WithMenuName(name string) MenuOption
type MenuStore struct {
	Menus    []*Menu
	Commands []*Command
	// contains filtered or unexported fields
}

func NewMenuStore

func NewMenuStore(app interfaces.App) *MenuStore
func (ms *MenuStore) NewMenu(opts ...MenuOption) *Menu
func (ms *MenuStore) RegisterCommands() ([]discord.ApplicationCommandCreate, error)

type RegisterFunc

type RegisterFunc func(h *handler.Mux) error

Jump to

Keyboard shortcuts

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