> ## Documentation Index
> Fetch the complete documentation index at: https://docs.mirage.strukto.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# discord

> Discord REST API client speaking the OpenClaw Discord action vocabulary.

Mirage's built-in Discord REST API client follows the Discord action
vocabulary from the upstream
[OpenClaw](https://github.com/openclaw/openclaw) project. The Mirage command
tree is discoverable with `discord --help`.

**Licenses:** OpenClaw uses the
[MIT License](https://github.com/openclaw/openclaw/blob/main/LICENSE); Mirage's
independent Discord implementation uses
[Apache-2.0](https://github.com/strukto-ai/mirage/blob/main/LICENSE).

## Install

```typescript theme={null}
import { DISCORD } from '@struktoai/mirage-core'
import { DiscordVFS, Workspace } from '@struktoai/mirage-node'

const config = { token: 'bot-token' }
const ws = new Workspace({ '/discord': new DiscordVFS(config) })
ws.registerCli('discord', DISCORD, config)
```

Two installs under different names are two accounts. In YAML, the same
install rides the `clis:` section; see the [CLI overview](/typescript/cli/index).

## Verbs

The verbs follow that OpenClaw Discord action vocabulary (bare verbs:
`send`, `read`, `edit`, `delete`, `react`, `search`, `thread-create`,
`poll`); `members` and `server-info` are mirage extensions. IDs are
Discord snowflakes, discoverable from the mounted tree
(`<name>__<id>` path segments).

### Messages

```bash theme={null}
discord send --channel 1256522563555819574 --text "Hello from MIRAGE"
discord send --channel 1256522563555819574 --text "A reply" --reply-to 1489887688978075769
discord read --channel 1256522563555819574 --limit 20
discord edit --channel 1256522563555819574 --message 1489887688978075769 --text "Edited"
discord delete --channel 1256522563555819574 --message 1489887688978075769
```

| Verb | Flags | Writes |
| - | - | - |
| `send` | `--channel --text [--reply-to]` | yes |
| `read` | `--channel [--limit]` | no |
| `edit` | `--channel --message --text` | yes |
| `delete` | `--channel --message` | yes |

`edit` only works on messages the bot authored.

### Reactions, threads, polls

```bash theme={null}
discord react --channel 1256522563555819574 --message 1489887688978075769 --emoji "👍"
discord thread-create --channel 1256522563555819574 --message 1489887688978075769 --name "Budget talk"
discord poll --channel 1256522563555819574 --question "Lunch?" --answer Pizza --answer Sushi --duration 24
```

| Verb | Flags | Writes |
| - | - | - |
| `react` | `--channel --message --emoji` | yes |
| `thread-create` | `--channel --name [--message]` | yes |
| `poll` | `--channel --question --answer... [--duration] [--multiselect]` | yes |

`--answer` repeats, one per poll option.

### Guild metadata and search

```bash theme={null}
discord server-info --guild 1256522563555819574
discord members --guild 1256522563555819574 --query "alice"
discord search --guild 1256522563555819574 --query "deploy" --channel 1256522563555819574
```

| Verb | Flags | Writes |
| - | - | - |
| `server-info` | `--guild` | no |
| `members` | `--guild [--query]` | no |
| `search` | `--guild --query [--channel]` | no |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.