Skip to content

Discord Implementation

The Discord channel is built on discord.js and supports Embeds, threads, reactions, role permissions, and other native Discord features.

Source Location

src/discord/
├── send.ts              # Message sending module
├── channels.ts          # Channel operations
├── emojis.ts            # Custom emojis
├── guild.ts             # Server operations
├── messages.ts          # Message processing
├── reactions.ts         # Reaction operations
├── outbound.ts          # Outbound adapter
├── threads.ts           # Thread management
├── permissions.ts       # Permission checks
├── roles.ts             # Role management
├── timeouts.ts          # Timeout/mute
└── *.test.ts            # Test files

Modular Design

Source: src/discord/send.ts

The Discord implementation is highly modular, with each feature independently exported:

typescript
// src/discord/send.ts (simplified)
export {
  channels,       // Channel CRUD operations
  emojis,         // Custom emoji management
  guild,          // Guild/server operations
  messages,       // Message send/edit/delete
  reactions,      // Add/remove reactions
  outbound,       // OutboundAdapter implementation
  threads,        // Thread create/archive/search
  permissions,    // Permission checks
  roles,          // Role management
  timeouts,       // Member timeouts
};

Message Limits

Discord has stricter message limits than Telegram:

LimitValue
Message length2000 characters
Embed description4096 characters
Embed fields25
File attachment25MB (standard) / 100MB (Nitro)

Thread Support

Discord's thread feature is central to group conversations. OpenClaw supports:

  • Creating new threads
  • Replying within existing threads
  • Thread search and archive management

Permission System

Discord has a complex permission hierarchy:

OpenClaw checks the bot's permissions in the target channel/thread before sending messages.

Summary

  • Built on discord.js with a highly modular design
  • Message limit of 2000 characters, requiring more frequent chunking
  • Supports threads, reactions, Embeds, and permission checks
  • Each feature (channels, emojis, guild, threads, etc.) is independently exported

Next: Message Routing

OpenClaw Source Code Tutorial