dgc

package
v0.0.0-...-a329c83 Latest Latest
Warning

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

Go to latest
Published: Feb 1, 2025 License: Apache-2.0 Imports: 10 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrMissingRequiredArguments = makeError("required arguments without values: %+v")                                                                        // arguments marked as required are not present after parsing all the arguments
	ErrMissingRequiredArgument  = makeError("missing required %s argument %s, maybe you didn't mark it as required in the command definition?")              // the handler requested as required a value that is not present
	ErrArgumentIsWrongType      = makeError("required %s argument %s is of type %T (%+v), maybe you didn't use the correct type in the command definition?") // the handler requested a value as one type but it is another tpye

	ErrArgumentHasInvalidValue = ArgumentHasInvalidValueError{DGCError: makeError("the argument %s has a value of type %T (%#v) but the expected type was %s")}
	ErrArgumentHasNoValue      = ArgumentHasNoValueError{DGCError: makeError("the %s has no value")}
)
View Source
var (
	ErrUnknownSlashCommand    = makeError("unknwon command: %s")
	ErrInvalidAmountOfOptions = makeError("a command group or sub command is expected to only have one option present %d are present")
	ErrInvalidSubCommandType  = makeError("the option %+v has not a valid type for a command group or sub command group")

	ErrNoFocusedArgument                 = makeError("there is no argument focused")
	ErrNoAutocompletingArgumentForOption = makeError("no autocomplete argument found for the option %+v")
)
View Source
var (
	ErrAlreadyResponded = errors.New("already responded, send a follow up")
)
View Source
var (
	ErrMessageCommandHasNoMessage = errors.New("Message command was used but no message was given")
)
View Source
var (
	ErrMiddlewareCallChain = MiddlewareCallChainError{DGCError: makeError("errors returned by the middlewares: %w")}
)
View Source
var (
	ErrUserCommandHasNoUser = errors.New("User command was used but no user was given")
)

Functions

func GetArgument

func GetArgument[T any](ctx *SlashExecutionContext, name string) (value T, found bool)

func GetArgumentOr

func GetArgumentOr[T any](ctx *SlashExecutionContext, name string, def T) T

func GetRequiredArgument

func GetRequiredArgument[T any](ctx *SlashExecutionContext, name string) T

func NewAttachmentArgument

func NewAttachmentArgument() *attachmentSlashCommandArgumentBuilder

func NewBooleanArgument

func NewBooleanArgument() *booleanArgumentBuilder

func NewChannelArgument

func NewChannelArgument() *channelSlashCommandArgumentBuilder

func NewIntegerArgument

func NewIntegerArgument() *integerSlashCommandArgumentBuilder

func NewIntegerAutocompleteArgument

func NewIntegerAutocompleteArgument() *integerSlashCommandAutocompleteArgumentBuilder

func NewIntegerChoicesArgument

func NewIntegerChoicesArgument() *integerSlashCommandChoicesArgumentBuilder

func NewMentionableArgument

func NewMentionableArgument() *mentionableSlashCommandArgumentBuilder

func NewNumberArgument

func NewNumberArgument() *numberSlashCommandArgumentBuilder

func NewNumberAutocompleteArgument

func NewNumberAutocompleteArgument() *numberSlashCommandAutocompleteArgumentBuilder

func NewNumberChoicesArgument

func NewNumberChoicesArgument() *numberSlashCommandChoicesArgumentBuilder

func NewRoleArgument

func NewRoleArgument() *roleSlashCommandArgumentBuilder

func NewStringArgument

func NewStringArgument() *stringSlashCommandArgumentBuilder

func NewStringAutocompleteArgument

func NewStringAutocompleteArgument() *stringSlashCommandAutocompleteArgumentBuilder

func NewStringChoicesArgument

func NewStringChoicesArgument() *stringSlashCommandChoicesArgumentBuilder

func NewUserArgument

func NewUserArgument() *userSlashCommandArgumentBuilder

Types

type ArgumentChoice

type ArgumentChoice[T any] struct {
	Name          string
	Value         T
	Localizations map[discordgo.Locale]string
}

type ArgumentHasInvalidValueError

type ArgumentHasInvalidValueError struct{ DGCError }

func (ArgumentHasInvalidValueError) Is

func (ArgumentHasInvalidValueError) New

func (e ArgumentHasInvalidValueError) New(name string, foundValue any, expectedValueType string) ArgumentHasInvalidValueError

func (ArgumentHasInvalidValueError) Values

func (e ArgumentHasInvalidValueError) Values() (name string, foundValue any, expectedValueType string)

type ArgumentHasNoValueError

type ArgumentHasNoValueError struct{ DGCError }

func (ArgumentHasNoValueError) Is

func (e ArgumentHasNoValueError) Is(target error) bool

func (ArgumentHasNoValueError) New

func (ArgumentHasNoValueError) Values

func (e ArgumentHasNoValueError) Values() (name string)

type ArgumentParsingInformation

type ArgumentParsingInformation struct {
	Options        []*discordgo.ApplicationCommandInteractionDataOption
	Resolved       *discordgo.ApplicationCommandInteractionDataResolved
	Autocompleting bool
}

func (*ArgumentParsingInformation) FindOption

Searches for an option in the slice of options with the same name, returning the first one found, nil if not found

type AttachmentSlashCommandArgument

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

func (*AttachmentSlashCommandArgument) Name

func (a *AttachmentSlashCommandArgument) Name() string

func (*AttachmentSlashCommandArgument) Parse

type BooleanSlashCommandArgument

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

func (*BooleanSlashCommandArgument) Name

func (a *BooleanSlashCommandArgument) Name() string

func (*BooleanSlashCommandArgument) Parse

type ChannelSlashCommandArgument

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

func (*ChannelSlashCommandArgument) Name

func (a *ChannelSlashCommandArgument) Name() string

func (*ChannelSlashCommandArgument) Parse

type CommandBuilder

type CommandBuilder interface {
	// contains filtered or unexported methods
}

type CommandMiddleware

type CommandMiddleware = func(ctx *RespondingContext, next func()) error

type DGCError

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

func (DGCError) Error

func (err DGCError) Error() string

func (DGCError) Is

func (err DGCError) Is(other error) bool

func (DGCError) Unwrap

func (err DGCError) Unwrap() []error

type DGCommander

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

func New

func New(ctx context.Context, log *slog.Logger, session *discordgo.Session, timeProvider TimeProvider) *DGCommander

func (*DGCommander) AddCommand

func (*DGCommander) AddMiddleware

func (c *DGCommander) AddMiddleware(middleware CommandMiddleware) *DGCommander

type DefaultTimeProvider

type DefaultTimeProvider struct{}

func (DefaultTimeProvider) Now

type IntegerSlashCommandArgument

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

func (*IntegerSlashCommandArgument) Name

func (*IntegerSlashCommandArgument) Parse

type IntegerSlashCommandAutocompleteArgumentHandler

type IntegerSlashCommandAutocompleteArgumentHandler struct {
	IntegerSlashCommandArgument
	// contains filtered or unexported fields
}

func (*IntegerSlashCommandAutocompleteArgumentHandler) Autocomplete

func (arg *IntegerSlashCommandAutocompleteArgumentHandler) Autocomplete(ctx *SlashAutocompleteContext) error

func (*IntegerSlashCommandAutocompleteArgumentHandler) IsForOption

func (arg *IntegerSlashCommandAutocompleteArgumentHandler) IsForOption(option *discordgo.ApplicationCommandInteractionDataOption) bool

type InvokationInformation

type InvokationInformation struct {
	DGC     *DGCommander
	Session *discordgo.Session

	Sender *discordgo.User
	I      *discordgo.InteractionCreate

	ReceivedTime time.Time
	// contains filtered or unexported fields
}

type MemberSlashCommandArgument

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

func (*MemberSlashCommandArgument) Name

func (a *MemberSlashCommandArgument) Name() string

func (*MemberSlashCommandArgument) Parse

type MentionableSlashCommandArgument

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

func (*MentionableSlashCommandArgument) Name

func (*MentionableSlashCommandArgument) Parse

type MessageCommandBuilder

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

func NewMessageCommand

func NewMessageCommand() *MessageCommandBuilder

func (*MessageCommandBuilder) AddMiddleware

func (b *MessageCommandBuilder) AddMiddleware(middleware M) B

func (*MessageCommandBuilder) AllowEverywhere

func (b *MessageCommandBuilder) AllowEverywhere(allowed bool) B

func (*MessageCommandBuilder) AllowInBotDM

func (b *MessageCommandBuilder) AllowInBotDM(allowed bool) B

func (*MessageCommandBuilder) AllowInGuilds

func (b *MessageCommandBuilder) AllowInGuilds(allowed bool) B

func (*MessageCommandBuilder) AllowInPrivateChannel

func (b *MessageCommandBuilder) AllowInPrivateChannel(allowed bool) B

func (*MessageCommandBuilder) ForGuild

func (b *MessageCommandBuilder) ForGuild(guildId string) B

func (*MessageCommandBuilder) GuildInstallable

func (b *MessageCommandBuilder) GuildInstallable(installable bool) B

func (*MessageCommandBuilder) Handler

func (*MessageCommandBuilder) Name

func (b *MessageCommandBuilder) Name() *util.Localizable[B]

func (*MessageCommandBuilder) Nsfw

func (b *MessageCommandBuilder) Nsfw(nsfw bool) B

func (*MessageCommandBuilder) UserInstallable

func (b *MessageCommandBuilder) UserInstallable(installable bool) B

type MessageCommandHandler

type MessageCommandHandler func(ctx *MessageExecutionContext) error

type MessageExecutionContext

type MessageExecutionContext struct {
	*RespondingContext
	Message *discordgo.Message
}

func (MessageExecutionContext) EndTime

func (ctx MessageExecutionContext) EndTime() time.Time

func (MessageExecutionContext) Finish

func (ctx MessageExecutionContext) Finish()

type MessageMiddleware

type MessageMiddleware = func(info *MessageExecutionContext, next func()) error

type MiddlewareCallChainError

type MiddlewareCallChainError struct{ DGCError }

func (MiddlewareCallChainError) Is

func (e MiddlewareCallChainError) Is(target error) bool

func (MiddlewareCallChainError) New

func (MiddlewareCallChainError) Values

func (e MiddlewareCallChainError) Values() (errs []error)

type MultiSlashCommandBuilder

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

func NewMultiSlashCommandBuilder

func NewMultiSlashCommandBuilder() *MultiSlashCommandBuilder

func (*MultiSlashCommandBuilder) AddSubCommand

func (*MultiSlashCommandBuilder) AddSubCommandGroup

func (*MultiSlashCommandBuilder) Description

func (b *MultiSlashCommandBuilder) Description() *util.Localizable[B]

type NumberSlashCommandArgument

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

func (*NumberSlashCommandArgument) Name

func (a *NumberSlashCommandArgument) Name() string

func (*NumberSlashCommandArgument) Parse

type NumberSlashCommandAutocompleteArgumentHandler

type NumberSlashCommandAutocompleteArgumentHandler struct {
	NumberSlashCommandArgument
	// contains filtered or unexported fields
}

func (*NumberSlashCommandAutocompleteArgumentHandler) Autocomplete

func (arg *NumberSlashCommandAutocompleteArgumentHandler) Autocomplete(ctx *SlashAutocompleteContext) error

func (*NumberSlashCommandAutocompleteArgumentHandler) IsForOption

func (arg *NumberSlashCommandAutocompleteArgumentHandler) IsForOption(option *discordgo.ApplicationCommandInteractionDataOption) bool

func (*NumberSlashCommandAutocompleteArgumentHandler) Name

func (a *NumberSlashCommandAutocompleteArgumentHandler) Name() string

type RespondingContext

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

func (*RespondingContext) AddFollowup

func (ctx *RespondingContext) AddFollowup(wait bool, data *discordgo.WebhookParams) (*discordgo.Message, error)

func (RespondingContext) EndTime

func (ctx RespondingContext) EndTime() time.Time

func (RespondingContext) Finish

func (ctx RespondingContext) Finish()

func (*RespondingContext) RespondLatter

func (ctx *RespondingContext) RespondLatter() error

func (*RespondingContext) RespondWithMessage

func (ctx *RespondingContext) RespondWithMessage(message *discordgo.InteractionResponseData) error

func (*RespondingContext) RespondWithModal

func (ctx *RespondingContext) RespondWithModal(modal *discordgo.InteractionResponseData) error

type RoleSlashCommandArgument

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

func (*RoleSlashCommandArgument) Name

func (a *RoleSlashCommandArgument) Name() string

func (*RoleSlashCommandArgument) Parse

type SimpleSlashCommandBuilder

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

func NewSimpleSlashCommandBuilder

func NewSimpleSlashCommandBuilder() *SimpleSlashCommandBuilder

func (*SimpleSlashCommandBuilder) AddArgument

func (b *SimpleSlashCommandBuilder) AddArgument(arg SlashCommandArgumentBuilder) B

func (*SimpleSlashCommandBuilder) AddArguments

func (b *SimpleSlashCommandBuilder) AddArguments(args ...SlashCommandArgumentBuilder) B

func (*SimpleSlashCommandBuilder) Description

func (b *SimpleSlashCommandBuilder) Description() *util.Localizable[B]

func (*SimpleSlashCommandBuilder) Handler

type SlashAutocompleteContext

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

func (*SlashAutocompleteContext) AddChoice

func (ctx *SlashAutocompleteContext) AddChoice(name string, value any) *SlashAutocompleteContext

func (*SlashAutocompleteContext) AddLocalizedChoice

func (ctx *SlashAutocompleteContext) AddLocalizedChoice(name string, value any, localizations map[discordgo.Locale]string) *SlashAutocompleteContext

func (SlashAutocompleteContext) EndTime

func (ctx SlashAutocompleteContext) EndTime() time.Time

func (SlashAutocompleteContext) Finish

func (ctx SlashAutocompleteContext) Finish()

func (*SlashAutocompleteContext) GetAttachment

func (args *SlashAutocompleteContext) GetAttachment(name string) (value *discordgo.MessageAttachment, found bool)

func (*SlashAutocompleteContext) GetAttachmentOr

func (args *SlashAutocompleteContext) GetAttachmentOr(name string, def *discordgo.MessageAttachment) *discordgo.MessageAttachment

func (*SlashAutocompleteContext) GetBool

func (args *SlashAutocompleteContext) GetBool(name string) (value bool, found bool)

func (*SlashAutocompleteContext) GetBoolOr

func (args *SlashAutocompleteContext) GetBoolOr(name string, def bool) bool

func (*SlashAutocompleteContext) GetChannel

func (args *SlashAutocompleteContext) GetChannel(name string) (value *discordgo.Channel, found bool)

func (*SlashAutocompleteContext) GetChannelOr

func (args *SlashAutocompleteContext) GetChannelOr(name string, def *discordgo.Channel) *discordgo.Channel

func (*SlashAutocompleteContext) GetInteger

func (args *SlashAutocompleteContext) GetInteger(name string) (value int64, found bool)

func (*SlashAutocompleteContext) GetIntegerOr

func (args *SlashAutocompleteContext) GetIntegerOr(name string, def int64) int64

func (*SlashAutocompleteContext) GetMember

func (args *SlashAutocompleteContext) GetMember(name string) (value *discordgo.Member, found bool)

func (*SlashAutocompleteContext) GetMemberOr

func (args *SlashAutocompleteContext) GetMemberOr(name string, def *discordgo.Member) *discordgo.Member

func (*SlashAutocompleteContext) GetNumber

func (args *SlashAutocompleteContext) GetNumber(name string) (value float64, found bool)

func (*SlashAutocompleteContext) GetNumberOr

func (args *SlashAutocompleteContext) GetNumberOr(name string, def float64) float64

func (*SlashAutocompleteContext) GetRequiredAttachment

func (args *SlashAutocompleteContext) GetRequiredAttachment(name string) *discordgo.MessageAttachment

func (*SlashAutocompleteContext) GetRequiredBool

func (args *SlashAutocompleteContext) GetRequiredBool(name string) bool

func (*SlashAutocompleteContext) GetRequiredChannel

func (args *SlashAutocompleteContext) GetRequiredChannel(name string) *discordgo.Channel

func (*SlashAutocompleteContext) GetRequiredInteger

func (args *SlashAutocompleteContext) GetRequiredInteger(name string) int64

func (*SlashAutocompleteContext) GetRequiredMember

func (args *SlashAutocompleteContext) GetRequiredMember(name string) *discordgo.Member

func (*SlashAutocompleteContext) GetRequiredNumber

func (args *SlashAutocompleteContext) GetRequiredNumber(name string) float64

func (*SlashAutocompleteContext) GetRequiredRole

func (args *SlashAutocompleteContext) GetRequiredRole(name string) *discordgo.Role

func (*SlashAutocompleteContext) GetRequiredString

func (args *SlashAutocompleteContext) GetRequiredString(name string) string

func (*SlashAutocompleteContext) GetRequiredUser

func (args *SlashAutocompleteContext) GetRequiredUser(name string) *discordgo.User

func (*SlashAutocompleteContext) GetRole

func (args *SlashAutocompleteContext) GetRole(name string) (value *discordgo.Role, found bool)

func (*SlashAutocompleteContext) GetRoleOr

func (args *SlashAutocompleteContext) GetRoleOr(name string, def *discordgo.Role) *discordgo.Role

func (*SlashAutocompleteContext) GetString

func (args *SlashAutocompleteContext) GetString(name string) (value string, found bool)

func (*SlashAutocompleteContext) GetStringOr

func (args *SlashAutocompleteContext) GetStringOr(name string, def string) string

func (*SlashAutocompleteContext) GetUser

func (args *SlashAutocompleteContext) GetUser(name string) (value *discordgo.User, found bool)

func (*SlashAutocompleteContext) GetUserOr

func (args *SlashAutocompleteContext) GetUserOr(name string, def *discordgo.User) *discordgo.User

type SlashCommandArgument

type SlashCommandArgument interface {
	// Parse extracts the value of this argument based on the provided parsing information.
	//
	// It returns:
	//  - valueName: the name associated with the parsed value.
	//  - value: the parsed value of this argument.
	//
	// Errors:
	//  - ErrArgumentHasNoValue: if the value of this argument is not present.
	//  - ErrArgumentHasInvalidValue: if the value of this argument has an invalid type.
	Parse(info *ArgumentParsingInformation) (valueName string, value any, err error)
	Name() string
}

SlashCommandArgument represents an argument in a slash command that can parse its value from provided argument parsing information.

type SlashCommandArgumentBuilder

type SlashCommandArgumentBuilder interface {
	DiscordDefineForCreation() *discordgo.ApplicationCommandOption
	// If the returned requiredName is not nil, when the arguments of a given command are being parsed, a value associated
	// to the returned requiredName must be present, if not, the handler of the command won't be invoked, returning an error
	// ErrMissingRequiredArguments to the user who used the command
	Create() (requiredName *string, argument SlashCommandArgument)
}

type SlashCommandAutocompleteArgument

type SlashCommandAutocompleteArgument interface {
	SlashCommandArgument
	IsForOption(option *discordgo.ApplicationCommandInteractionDataOption) bool
	Autocomplete(*SlashAutocompleteContext) error
}

type SlashCommandAutocompleteArgumentHandler

type SlashCommandAutocompleteArgumentHandler func(*SlashAutocompleteContext) error

type SlashCommandHandler

type SlashCommandHandler func(ctx *SlashExecutionContext) error

type SlashExecutionContext

type SlashExecutionContext struct {
	*RespondingContext
	// contains filtered or unexported fields
}

func (SlashExecutionContext) EndTime

func (ctx SlashExecutionContext) EndTime() time.Time

func (SlashExecutionContext) Finish

func (ctx SlashExecutionContext) Finish()

func (*SlashExecutionContext) GetAttachment

func (args *SlashExecutionContext) GetAttachment(name string) (value *discordgo.MessageAttachment, found bool)

func (*SlashExecutionContext) GetAttachmentOr

func (args *SlashExecutionContext) GetAttachmentOr(name string, def *discordgo.MessageAttachment) *discordgo.MessageAttachment

func (*SlashExecutionContext) GetBool

func (args *SlashExecutionContext) GetBool(name string) (value bool, found bool)

func (*SlashExecutionContext) GetBoolOr

func (args *SlashExecutionContext) GetBoolOr(name string, def bool) bool

func (*SlashExecutionContext) GetChannel

func (args *SlashExecutionContext) GetChannel(name string) (value *discordgo.Channel, found bool)

func (*SlashExecutionContext) GetChannelOr

func (args *SlashExecutionContext) GetChannelOr(name string, def *discordgo.Channel) *discordgo.Channel

func (*SlashExecutionContext) GetInteger

func (args *SlashExecutionContext) GetInteger(name string) (value int64, found bool)

func (*SlashExecutionContext) GetIntegerOr

func (args *SlashExecutionContext) GetIntegerOr(name string, def int64) int64

func (*SlashExecutionContext) GetMember

func (args *SlashExecutionContext) GetMember(name string) (value *discordgo.Member, found bool)

func (*SlashExecutionContext) GetMemberOr

func (args *SlashExecutionContext) GetMemberOr(name string, def *discordgo.Member) *discordgo.Member

func (*SlashExecutionContext) GetNumber

func (args *SlashExecutionContext) GetNumber(name string) (value float64, found bool)

func (*SlashExecutionContext) GetNumberOr

func (args *SlashExecutionContext) GetNumberOr(name string, def float64) float64

func (*SlashExecutionContext) GetRequiredAttachment

func (args *SlashExecutionContext) GetRequiredAttachment(name string) *discordgo.MessageAttachment

func (*SlashExecutionContext) GetRequiredBool

func (args *SlashExecutionContext) GetRequiredBool(name string) bool

func (*SlashExecutionContext) GetRequiredChannel

func (args *SlashExecutionContext) GetRequiredChannel(name string) *discordgo.Channel

func (*SlashExecutionContext) GetRequiredInteger

func (args *SlashExecutionContext) GetRequiredInteger(name string) int64

func (*SlashExecutionContext) GetRequiredMember

func (args *SlashExecutionContext) GetRequiredMember(name string) *discordgo.Member

func (*SlashExecutionContext) GetRequiredNumber

func (args *SlashExecutionContext) GetRequiredNumber(name string) float64

func (*SlashExecutionContext) GetRequiredRole

func (args *SlashExecutionContext) GetRequiredRole(name string) *discordgo.Role

func (*SlashExecutionContext) GetRequiredString

func (args *SlashExecutionContext) GetRequiredString(name string) string

func (*SlashExecutionContext) GetRequiredUser

func (args *SlashExecutionContext) GetRequiredUser(name string) *discordgo.User

func (*SlashExecutionContext) GetRole

func (args *SlashExecutionContext) GetRole(name string) (value *discordgo.Role, found bool)

func (*SlashExecutionContext) GetRoleOr

func (args *SlashExecutionContext) GetRoleOr(name string, def *discordgo.Role) *discordgo.Role

func (*SlashExecutionContext) GetString

func (args *SlashExecutionContext) GetString(name string) (value string, found bool)

func (*SlashExecutionContext) GetStringOr

func (args *SlashExecutionContext) GetStringOr(name string, def string) string

func (*SlashExecutionContext) GetUser

func (args *SlashExecutionContext) GetUser(name string) (value *discordgo.User, found bool)

func (*SlashExecutionContext) GetUserOr

func (args *SlashExecutionContext) GetUserOr(name string, def *discordgo.User) *discordgo.User

type SlashMultiMiddleware

type SlashMultiMiddleware = func(ctx *RespondingContext, next func()) error

type SlashSimpleMiddleware

type SlashSimpleMiddleware = func(ctx *SlashExecutionContext, next func()) error

type StringSlashCommandArgument

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

func (*StringSlashCommandArgument) Name

func (a *StringSlashCommandArgument) Name() string

func (*StringSlashCommandArgument) Parse

type StringSlashCommandAutocompleteArgumentHandler

type StringSlashCommandAutocompleteArgumentHandler struct {
	StringSlashCommandArgument
	// contains filtered or unexported fields
}

func (*StringSlashCommandAutocompleteArgumentHandler) Autocomplete

func (arg *StringSlashCommandAutocompleteArgumentHandler) Autocomplete(ctx *SlashAutocompleteContext) error

func (*StringSlashCommandAutocompleteArgumentHandler) IsForOption

func (arg *StringSlashCommandAutocompleteArgumentHandler) IsForOption(option *discordgo.ApplicationCommandInteractionDataOption) bool

func (*StringSlashCommandAutocompleteArgumentHandler) Name

func (a *StringSlashCommandAutocompleteArgumentHandler) Name() string

type SubSlashCommandBuilder

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

func NewSubCommand

func NewSubCommand() *SubSlashCommandBuilder

func (*SubSlashCommandBuilder) AddArgument

func (b *SubSlashCommandBuilder) AddArgument(arg SlashCommandArgumentBuilder) B

func (*SubSlashCommandBuilder) AddArguments

func (b *SubSlashCommandBuilder) AddArguments(args ...SlashCommandArgumentBuilder) B

func (*SubSlashCommandBuilder) AddMiddleware

func (*SubSlashCommandBuilder) Description

func (*SubSlashCommandBuilder) Handler

func (*SubSlashCommandBuilder) Name

type SubSlashCommandGroupBuilder

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

func NewSubCommandGroup

func NewSubCommandGroup() *SubSlashCommandGroupBuilder

func (*SubSlashCommandGroupBuilder) AddMiddleware

func (*SubSlashCommandGroupBuilder) AddSubCommand

func (*SubSlashCommandGroupBuilder) AddSubCommands

func (*SubSlashCommandGroupBuilder) Description

func (*SubSlashCommandGroupBuilder) Name

type TimeProvider

type TimeProvider interface {
	Now() time.Time
}

type UserCommandBuilder

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

func NewUserCommand

func NewUserCommand() *UserCommandBuilder

func (*UserCommandBuilder) AddMiddleware

func (b *UserCommandBuilder) AddMiddleware(middleware M) B

func (*UserCommandBuilder) AllowEverywhere

func (b *UserCommandBuilder) AllowEverywhere(allowed bool) B

func (*UserCommandBuilder) AllowInBotDM

func (b *UserCommandBuilder) AllowInBotDM(allowed bool) B

func (*UserCommandBuilder) AllowInGuilds

func (b *UserCommandBuilder) AllowInGuilds(allowed bool) B

func (*UserCommandBuilder) AllowInPrivateChannel

func (b *UserCommandBuilder) AllowInPrivateChannel(allowed bool) B

func (*UserCommandBuilder) ForGuild

func (b *UserCommandBuilder) ForGuild(guildId string) B

func (*UserCommandBuilder) GuildInstallable

func (b *UserCommandBuilder) GuildInstallable(installable bool) B

func (*UserCommandBuilder) Handler

func (*UserCommandBuilder) Name

func (b *UserCommandBuilder) Name() *util.Localizable[B]

func (*UserCommandBuilder) Nsfw

func (b *UserCommandBuilder) Nsfw(nsfw bool) B

func (*UserCommandBuilder) UserInstallable

func (b *UserCommandBuilder) UserInstallable(installable bool) B

type UserCommandHandler

type UserCommandHandler func(ctx *UserExecutionContext) error

type UserExecutionContext

type UserExecutionContext struct {
	*RespondingContext
	User   *discordgo.User
	Member *discordgo.Member // Nil if not running on a guild
}

func (UserExecutionContext) EndTime

func (ctx UserExecutionContext) EndTime() time.Time

func (UserExecutionContext) Finish

func (ctx UserExecutionContext) Finish()

type UserMiddleware

type UserMiddleware = func(ctx *UserExecutionContext, next func()) error

type UserSlashCommandArgument

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

func (*UserSlashCommandArgument) Name

func (a *UserSlashCommandArgument) Name() string

func (*UserSlashCommandArgument) Parse

Directories

Path Synopsis

Jump to

Keyboard shortcuts

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