Documentation
¶
Overview ¶
Package discord provides the experimental Discord adapter.
Index ¶
- func Defer(ctx *botctx.Context, ephemeral bool) error
- func EditResponse(ctx *botctx.Context, text string) error
- func From(ctx *botctx.Context) (*discordgo.Session, bool)
- func Interaction(ctx *botctx.Context) (*discordgo.Interaction, bool)
- func Respond(ctx *botctx.Context, text string, ephemeral bool) error
- type Config
- type Platform
- func (p *Platform) AnswerCallback(ctx context.Context, callbackID string, text string) error
- func (p *Platform) Capabilities() capability.Capabilities
- func (p *Platform) Edit(ctx context.Context, ev event.Event, msg platform.OutgoingMessage) error
- func (p *Platform) EditByRef(ctx context.Context, ref platform.MessageRef, msg platform.OutgoingMessage) error
- func (p *Platform) Name() string
- func (p *Platform) Raw() any
- func (p *Platform) Send(ctx context.Context, target platform.Target, msg platform.OutgoingMessage) error
- func (p *Platform) SendPrivate(ctx context.Context, userID string, msg platform.OutgoingMessage) error
- func (p *Platform) SendWithRef(ctx context.Context, target platform.Target, msg platform.OutgoingMessage) (platform.MessageRef, error)
- func (p *Platform) SetCommandPrefixes(prefixes []string)
- func (p *Platform) SetEventTypes(types []event.Type)
- func (p *Platform) SetLogger(logger *slog.Logger)
- func (p *Platform) Start(ctx context.Context, dispatcher platform.Dispatcher) error
- func (p *Platform) Validate() error
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func EditResponse ¶ added in v2.0.1
EditResponse edits the original interaction response.
func Interaction ¶ added in v2.0.1
func Interaction(ctx *botctx.Context) (*discordgo.Interaction, bool)
Interaction returns the native Discord interaction carried by the event.
Types ¶
type Config ¶
type Config struct {
Token string
GuildID string
Commands []*discordgo.ApplicationCommand
Intents discordgo.Intent
// DisableTextCommands keeps TypeCommand handlers slash-only.
DisableTextCommands bool
}
Config configures Discord bot authentication and optional slash commands.
type Platform ¶
type Platform struct {
// contains filtered or unexported fields
}
Platform adapts Discord gateway events to AstraEngine contracts.
func (*Platform) AnswerCallback ¶
func (*Platform) Capabilities ¶
func (p *Platform) Capabilities() capability.Capabilities
func (*Platform) EditByRef ¶ added in v2.0.1
func (p *Platform) EditByRef(ctx context.Context, ref platform.MessageRef, msg platform.OutgoingMessage) error
func (*Platform) SendPrivate ¶ added in v2.0.1
func (*Platform) SendWithRef ¶ added in v2.0.1
func (p *Platform) SendWithRef(ctx context.Context, target platform.Target, msg platform.OutgoingMessage) (platform.MessageRef, error)
func (*Platform) SetCommandPrefixes ¶
func (*Platform) SetEventTypes ¶ added in v2.0.1
SetEventTypes limits Discord gateway handlers to events registered by the app.