Documentation
¶
Overview ¶
Package discord provides the discord_send tool for sending messages to Discord.
Two delivery modes:
Webhook (simplest — no bot account required): Create a webhook in your Discord server settings → Integrations. Set DISCORD_WEBHOOK_URL. One webhook per channel.
Bot API (richer — requires a Discord application and bot token): Set DISCORD_BOT_TOKEN. The bot must be invited to the server with the "Send Messages" permission. Supports embeds, files, threads.
Implementation notes for contributors:
- Discord webhooks accept the same payload shape as Slack webhooks (content + embeds). Start with webhooks — no OAuth flow needed.
- Embeds are the Discord equivalent of Block Kit: title, description, color (hex int), fields (name/value pairs), footer, thumbnail.
- Rate limits: 5 requests per 2 seconds per webhook. Add exponential backoff with Retry-After header handling.
- Discord API docs: https://discord.com/developers/docs/resources/webhook
Env vars:
DISCORD_WEBHOOK_URL — Webhook URL (preferred for simple sends) DISCORD_BOT_TOKEN — Bot token for the Bot API mode
See GitHub issue for full implementation spec.
Index ¶
- Variables
- type SendTool
- func (t *SendTool) BackfillInput(_ context.Context, in map[string]any) map[string]any
- func (t *SendTool) Call(_ context.Context, _ tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
- func (t *SendTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult
- func (t *SendTool) Definition() tool.Definition
- func (t *SendTool) Description(_ context.Context) (string, error)
- func (t *SendTool) FormatResult(data any) string
- func (t *SendTool) IsConcurrencySafe(_ map[string]any) bool
- func (t *SendTool) IsEnabled() bool
- func (t *SendTool) IsReadOnly(_ map[string]any) bool
- func (t *SendTool) ValidateInput(_ context.Context, in map[string]any) (map[string]any, error)
Constants ¶
This section is empty.
Variables ¶
View Source
var ErrNotImplemented = errors.New("discord_send: not implemented — see GitHub issue")
Functions ¶
This section is empty.
Types ¶
type SendTool ¶
type SendTool struct{}
func NewSendTool ¶
func NewSendTool() *SendTool
func (*SendTool) BackfillInput ¶
func (*SendTool) Call ¶
func (t *SendTool) Call(_ context.Context, _ tool.CallInput, _ types.CanUseToolFn) (tool.CallResult, error)
func (*SendTool) CheckPermissions ¶
func (t *SendTool) CheckPermissions(_ context.Context, in map[string]any, _ tool.ToolUseContext) types.PermissionResult
func (*SendTool) Definition ¶
func (t *SendTool) Definition() tool.Definition
func (*SendTool) FormatResult ¶
Click to show internal directories.
Click to hide internal directories.