Channels
Plugin Discord Embed
OpenClaw plugin for sending rich Discord embeds
Install
npm install
#
Configuration Example
{
"plugins": {
"load": {
"paths": [
"/path/to/openclaw-plugin-discord-embed"
]
},
"entries": {
"openclaw-plugin-discord-embed": {
"enabled": true
}
}
}
}
README
# openclaw-plugin-discord-embed
OpenClaw plugin for sending rich Discord embeds with full formatting support.
## Features
- Full Discord embed support: title, description, fields, author, thumbnail, image, footer, timestamp, color
- Color parsing (hex strings `"#5865F2"` or integers)
- Reply threading via `reply_to`
- Validation of all Discord embed limits with clear error messages
- 30-second request timeout
- Zero runtime dependencies (uses native `fetch`)
## Installation
Add the plugin path to your OpenClaw config:
```json
{
"plugins": {
"load": {
"paths": [
"/path/to/openclaw-plugin-discord-embed"
]
},
"entries": {
"openclaw-plugin-discord-embed": {
"enabled": true
}
}
}
}
```
Then restart OpenClaw (full restart required for plugin changes):
```bash
pkill openclaw-gateway
openclaw gateway start
```
## Configuration
The plugin reads the Discord bot token from your OpenClaw config at `channels.discord.token`. No additional configuration required if you already have Discord set up.
## Usage
The plugin provides a `discord_embed` tool:
```typescript
discord_embed({
channel: string, // Discord channel ID (required)
content?: string, // Plain text above the embed
reply_to?: string, // Message ID to reply to
embed: { // Embed object (required)
title?: string, // Max 256 chars
description?: string, // Max 4096 chars
url?: string, // Makes title a hyperlink
color?: string | number, // "#5865F2" or 5793266
author?: {
name: string, // Required if author present, max 256 chars
url?: string,
icon_url?: string,
},
thumbnail?: { url: string },
fields?: [{ // Max 25 fields
name: string, // Required, max 256 chars
value: string, // Required, max 1024 chars
inline?: boolean,
}],
image?: { url: string },
footer?: {
text: string, // Max 2048 chars
icon_url?: string,
},
timestamp?: string, // ISO8601 timestamp
}
})
```
### Example
```typescript
discord_embed({
channel: "1234567890",
embed: {
title: "Build Complete",
description: "All tests passed!",
color: "#00FF00",
fields: [
{ name: "Duration", value: "2m 34s", inline: true },
{ name: "Tests", value: "142 passed", inline: true }
],
footer: { text: "CI Pipeline" },
timestamp: "2024-01-15T10:30:00Z"
}
})
```
## Discord Embed Limits
| Field | Limit |
|-------|-------|
| Title | 256 characters |
| Description | 4096 characters |
| Fields | 25 max |
| Field name | 256 characters |
| Field value | 1024 characters |
| Footer text | 2048 characters |
| Author name | 256 characters |
| Total characters | 6000 |
| Content (plain text) | 2000 characters |
The plugin validates all limits before sending and returns clear error messages indicating which limit was exceeded and by how much.
## Error Handling
The plugin provides structured error responses for:
- Missing Discord token
- Validation failures (embed limits exceeded)
- Network errors (with 30s timeout)
- Discord API errors (with status code and response body)
## Development
```bash
# Install dependencies
npm install
# Type check
npx tsc --noEmit
```
## License
MIT
channels
Comments
Sign in to leave a comment