discord

package
v2.0.4 Latest Latest
Warning

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

Go to latest
Published: Aug 26, 2026 License: GPL-3.0 Imports: 17 Imported by: ? modules, 0 packages

The first number is the count of modules that contain a package that imports this one. The module count is a better indicator of popularity than the package count. A module with 100 importing packages is counted only once instead of 100 times, reflecting the fact that the choice to use the package was likely made only once, not 100 times.
A '?' means that the value hasn't been computed yet.

Documentation

Overview

Package discord provides the experimental Discord adapter.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Defer added in v2.0.1

func Defer(ctx *botctx.Context, ephemeral bool) error

Defer acknowledges an interaction whose response will be sent later.

func EditResponse added in v2.0.1

func EditResponse(ctx *botctx.Context, text string) error

EditResponse edits the original interaction response.

func From added in v2.0.1

func From(ctx *botctx.Context) (*discordgo.Session, bool)

From returns the native Discord session for the current adapter.

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.

func Respond added in v2.0.1

func Respond(ctx *botctx.Context, text string, ephemeral bool) error

Respond sends the initial response to a Discord interaction.

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 New

func New(cfg Config) *Platform

New creates a Discord adapter.

func (*Platform) AnswerCallback

func (p *Platform) AnswerCallback(ctx context.Context, callbackID string, text string) error

func (*Platform) Capabilities

func (p *Platform) Capabilities() capability.Capabilities

func (*Platform) Edit added in v2.0.1

func (*Platform) EditByRef added in v2.0.1

func (*Platform) Name

func (p *Platform) Name() string

func (*Platform) Raw

func (p *Platform) Raw() any

func (*Platform) Send

func (*Platform) SendPrivate added in v2.0.1

func (p *Platform) SendPrivate(ctx context.Context, userID string, msg platform.OutgoingMessage) error

func (*Platform) SendWithRef added in v2.0.1

func (*Platform) SetCommandPrefixes

func (p *Platform) SetCommandPrefixes(prefixes []string)

func (*Platform) SetEventTypes added in v2.0.1

func (p *Platform) SetEventTypes(types []event.Type)

SetEventTypes limits Discord gateway handlers to events registered by the app.

func (*Platform) SetLogger

func (p *Platform) SetLogger(logger *slog.Logger)

SetLogger configures structured adapter diagnostics.

func (*Platform) Start

func (p *Platform) Start(ctx context.Context, dispatcher platform.Dispatcher) error

func (*Platform) Validate added in v2.0.2

func (p *Platform) Validate() error

Jump to

Keyboard shortcuts

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