Documentation ¶
Index ¶
- Variables
- type Bot
- func (b *Bot) AddCommand(data *discordgo.ApplicationCommand, cmd CommandHandler)
- func (b *Bot) Close()
- func (b *Bot) CollectSingleComponentInteraction(ctx context.Context, msg *discordgo.Message, ...) (*discordgo.InteractionCreate, error)
- func (b *Bot) Login(token string, intent discordgo.Intent) error
- func (b *Bot) NewMessageComponentInteractionChannel(ctx context.Context, msg *discordgo.Message, ...) (<-chan *discordgo.InteractionCreate, error)
- func (b *Bot) SetDestroyCommandsOnClose(destroy bool)
- func (b *Bot) SetNoPanic(noPanic bool)
- type Command
- type CommandCollection
- type CommandHandler
- type InteractionContext
- func (c *InteractionContext) CanRespond() bool
- func (c *InteractionContext) Cancel()
- func (c *InteractionContext) Context() context.Context
- func (c *InteractionContext) Data() discordgo.ApplicationCommandInteractionData
- func (c *InteractionContext) DeferResponse() error
- func (c *InteractionContext) Deferred() bool
- func (c *InteractionContext) EditResponse(params *discordgo.WebhookEdit) (*discordgo.Message, error)
- func (c *InteractionContext) Followup(response *discordgo.WebhookParams, wait bool) (*discordgo.Message, error)
- func (c *InteractionContext) Interaction() *discordgo.InteractionCreate
- func (c *InteractionContext) IsAutocomplete() bool
- func (c *InteractionContext) IsCommand() bool
- func (c *InteractionContext) Options() []*discordgo.ApplicationCommandInteractionDataOption
- func (c *InteractionContext) Respond(responseType discordgo.InteractionResponseType, ...) error
- func (c *InteractionContext) RespondOrFollowup(params *discordgo.WebhookParams, wait bool) (*discordgo.Message, error)
- func (c *InteractionContext) Responded() bool
- func (c *InteractionContext) ResponseContext() context.Context
- func (c *InteractionContext) Session() *discordgo.Session
- func (c *InteractionContext) User() *discordgo.User
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrInvalidOptions = errors.New("invalid options")
View Source
var ErrResponseNotSent = errors.New("response not yet sent")
Functions ¶
This section is empty.
Types ¶
type Bot ¶
type Bot struct {
// contains filtered or unexported fields
}
func (*Bot) AddCommand ¶
func (b *Bot) AddCommand(data *discordgo.ApplicationCommand, cmd CommandHandler)
func (*Bot) CollectSingleComponentInteraction ¶ added in v0.2.4
func (b *Bot) CollectSingleComponentInteraction( ctx context.Context, msg *discordgo.Message, filters ...discordutil.InteractionFilter, ) (*discordgo.InteractionCreate, error)
func (*Bot) NewMessageComponentInteractionChannel ¶ added in v0.2.4
func (b *Bot) NewMessageComponentInteractionChannel( ctx context.Context, msg *discordgo.Message, filters ...discordutil.InteractionFilter, ) (<-chan *discordgo.InteractionCreate, error)
func (*Bot) SetDestroyCommandsOnClose ¶
func (*Bot) SetNoPanic ¶ added in v0.2.2
type Command ¶
type Command struct { Handler CommandHandler Data *discordgo.ApplicationCommand }
type CommandCollection ¶
func NewCommandCollection ¶
func NewCommandCollection() CommandCollection
func (CommandCollection) Add ¶
func (c CommandCollection) Add(data *discordgo.ApplicationCommand, handler CommandHandler)
func (CommandCollection) Handle ¶
func (c CommandCollection) Handle(ctx *InteractionContext) error
type CommandHandler ¶
type CommandHandler interface {
Handle(ctx *InteractionContext) error
}
type InteractionContext ¶
type InteractionContext struct { Logger *slog.Logger Bot *Bot // contains filtered or unexported fields }
func NewInteractionContext ¶
func NewInteractionContext( logger *slog.Logger, bot *Bot, s *discordgo.Session, i *discordgo.InteractionCreate, ctx context.Context, ) *InteractionContext
func (*InteractionContext) CanRespond ¶
func (c *InteractionContext) CanRespond() bool
func (*InteractionContext) Cancel ¶
func (c *InteractionContext) Cancel()
func (*InteractionContext) Context ¶
func (c *InteractionContext) Context() context.Context
Returns a context that is cancelled when the interaction token is invalidated
func (*InteractionContext) Data ¶
func (c *InteractionContext) Data() discordgo.ApplicationCommandInteractionData
func (*InteractionContext) DeferResponse ¶
func (c *InteractionContext) DeferResponse() error
func (*InteractionContext) Deferred ¶
func (c *InteractionContext) Deferred() bool
func (*InteractionContext) EditResponse ¶ added in v0.2.4
func (c *InteractionContext) EditResponse(params *discordgo.WebhookEdit) (*discordgo.Message, error)
func (*InteractionContext) Followup ¶
func (c *InteractionContext) Followup(response *discordgo.WebhookParams, wait bool) (*discordgo.Message, error)
func (*InteractionContext) Interaction ¶
func (c *InteractionContext) Interaction() *discordgo.InteractionCreate
func (*InteractionContext) IsAutocomplete ¶
func (c *InteractionContext) IsAutocomplete() bool
func (*InteractionContext) IsCommand ¶
func (c *InteractionContext) IsCommand() bool
func (*InteractionContext) Options ¶
func (c *InteractionContext) Options() []*discordgo.ApplicationCommandInteractionDataOption
func (*InteractionContext) Respond ¶
func (c *InteractionContext) Respond(responseType discordgo.InteractionResponseType, data *discordgo.InteractionResponseData) error
func (*InteractionContext) RespondOrFollowup ¶
func (c *InteractionContext) RespondOrFollowup(params *discordgo.WebhookParams, wait bool) (*discordgo.Message, error)
func (*InteractionContext) Responded ¶
func (c *InteractionContext) Responded() bool
func (*InteractionContext) ResponseContext ¶
func (c *InteractionContext) ResponseContext() context.Context
Returns a context that is cancelled when the interaction response deadline is reached or when a response is sent
func (*InteractionContext) Session ¶
func (c *InteractionContext) Session() *discordgo.Session
func (*InteractionContext) User ¶ added in v0.2.0
func (c *InteractionContext) User() *discordgo.User
Click to show internal directories.
Click to hide internal directories.