discord

package
v0.22.1 Latest Latest
Warning

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

Go to latest
Published: Aug 16, 2026 License: MIT Imports: 7 Imported by: 0

Documentation

Overview

Package discord is the gateway's Discord channel adapter. It uses the maintained bwmarrin/discordgo gateway client (a real-time websocket, unlike Telegram's long-poll) — the SDK is isolated here so it can't grow a second implementation elsewhere (guarded by TestVendorSDKsOnlyInTheirAdapters). The user creates their own bot in the Discord developer portal, enables the Message Content intent, and puts the token in the global .env as DISCORD_BOT_TOKEN.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Channel

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

Channel is a Discord bot connection.

func New

func New(token, mediaDir string) (*Channel, error)

New builds a Discord channel for the given bot token. It requests the message intents (Message Content is privileged — the user must enable it on the bot). mediaDir is the gateway media spool attachments are downloaded into; "" disables attachment handling.

func (*Channel) Name

func (c *Channel) Name() string

Name returns the adapter identifier.

func (*Channel) Send

func (c *Channel) Send(ctx context.Context, conversation string, msg channels.Outbound) error

Send posts a reply to a channel, splitting it with the shared chunker to respect Discord's per-message length limit. A synthesized voice rendition (VoicePath) is uploaded first as a file, best-effort — the text always follows.

func (*Channel) Start

func (c *Channel) Start(ctx context.Context, sink channels.Sink) error

Start opens the gateway websocket, forwards each user message as an Inbound, and blocks until ctx is cancelled. discordgo reconnects internally, so a dropped socket doesn't return an error and take the gateway down.

Jump to

Keyboard shortcuts

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