generic

package
v0.12.4 Latest Latest
Warning

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

Go to latest
Published: Apr 20, 2024 License: GPL-3.0 Imports: 18 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func PermissionCheck

func PermissionCheck(ctx context.Context, c *components.Components, g *ent.Guild, client bot.Client, m discord.ResolvedMember, guildID snowflake.ID, perms []Permission) bool

func RolePermissionCheck

func RolePermissionCheck(g *ent.Guild, guildID snowflake.ID, client bot.Client, roleIds []snowflake.ID, perms []Permission) bool

Types

type AutocompleteHandler

func (AutocompleteHandler) DiscordPermission

func (c AutocompleteHandler) DiscordPermission() discord.Permissions

func (AutocompleteHandler) Handler

func (AutocompleteHandler) Permissions

func (c AutocompleteHandler) Permissions() []Permission

type Command

type Command struct {
	Namespace     string
	Private       bool
	CommandCreate []discord.ApplicationCommandCreate
	// /command/subcommand_group/subcommand
	CommandHandlers      map[string]PermissionCommandHandler
	ComponentHandlers    map[string]PermissionComponentHandler
	ModalHandlers        map[string]ModalHandler
	AutocompleteHandlers map[string]PermissionAutocompleteHandler
	EventHandler         EventHandler[bot.Event]
	Schedulers           []components.Scheduler
	// contains filtered or unexported fields
}

func (*Command) AutocompleteHandler

func (gc *Command) AutocompleteHandler() func(event *events.AutocompleteInteractionCreate) error

func (*Command) CommandHandler

func (gc *Command) CommandHandler() func(event *events.ApplicationCommandInteractionCreate) error

func (*Command) ComponentHandler

func (gc *Command) ComponentHandler() func(event *events.ComponentInteractionCreate) error

func (*Command) Create

func (gc *Command) Create() []discord.ApplicationCommandCreate

func (*Command) IsPrivate

func (gc *Command) IsPrivate() bool

func (*Command) ModalHandler

func (gc *Command) ModalHandler() func(event *events.ModalSubmitInteractionCreate) error

func (*Command) Name

func (gc *Command) Name() string

func (*Command) OnEvent

func (gc *Command) OnEvent() func(event bot.Event) error

func (*Command) Scheduler

func (gc *Command) Scheduler() []components.Scheduler

func (*Command) SetComponent

func (gc *Command) SetComponent(c *components.Components) *Command

type CommandHandler

func (CommandHandler) DiscordPermission

func (c CommandHandler) DiscordPermission() discord.Permissions

func (CommandHandler) Permissions

func (c CommandHandler) Permissions() []Permission

type ComponentHandler

func (ComponentHandler) DiscordPermission

func (c ComponentHandler) DiscordPermission() discord.Permissions

func (ComponentHandler) Handler

func (ComponentHandler) Permissions

func (c ComponentHandler) Permissions() []Permission

type EventHandler

type EventHandler[E bot.Event] func(c *components.Components, event E) errors.Error

type PAutocompleteHandler

type PAutocompleteHandler struct {
	AutocompleteHandler EventHandler[*events.AutocompleteInteractionCreate]
	Permission          []Permission
	DiscordPerm         discord.Permissions
}

func (PAutocompleteHandler) DiscordPermission

func (c PAutocompleteHandler) DiscordPermission() discord.Permissions

func (PAutocompleteHandler) Handler

func (PAutocompleteHandler) Permissions

func (c PAutocompleteHandler) Permissions() []Permission

type PCommandHandler

type PCommandHandler struct {
	CommandHandler EventHandler[*events.ApplicationCommandInteractionCreate]
	Permission     []Permission
	DiscordPerm    discord.Permissions
}

func (PCommandHandler) DiscordPermission

func (c PCommandHandler) DiscordPermission() discord.Permissions

func (PCommandHandler) Permissions

func (c PCommandHandler) Permissions() []Permission

type PComponentHandler

type PComponentHandler struct {
	ComponentHandler EventHandler[*events.ComponentInteractionCreate]
	Permission       []Permission
	DiscordPerm      discord.Permissions
}

func (PComponentHandler) DiscordPermission

func (c PComponentHandler) DiscordPermission() discord.Permissions

func (PComponentHandler) Handler

func (PComponentHandler) Permissions

func (c PComponentHandler) Permissions() []Permission

type Permission

type Permission interface {
	PermString() string
	Default() bool
}

type PermissionDefaultString

type PermissionDefaultString string

func (PermissionDefaultString) Default

func (p PermissionDefaultString) Default() bool

func (PermissionDefaultString) PermString

func (p PermissionDefaultString) PermString() string

type PermissionHandler

type PermissionHandler[E bot.Event] interface {
	Handler() EventHandler[E]
	Permissions() []Permission
	DiscordPermission() discord.Permissions
}

type PermissionString

type PermissionString string

func (PermissionString) Default

func (p PermissionString) Default() bool

func (PermissionString) PermString

func (p PermissionString) PermString() string

Jump to

Keyboard shortcuts

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