feat: switch message cli to subcommands
This commit is contained in:
@@ -15,15 +15,15 @@ read_when:
|
||||
|
||||
```bash
|
||||
# WhatsApp
|
||||
clawdbot message --action poll --to +15555550123 \
|
||||
clawdbot message poll --to +15555550123 \
|
||||
--poll-question "Lunch today?" --poll-option "Yes" --poll-option "No" --poll-option "Maybe"
|
||||
clawdbot message --action poll --to 123456789@g.us \
|
||||
clawdbot message poll --to 123456789@g.us \
|
||||
--poll-question "Meeting time?" --poll-option "10am" --poll-option "2pm" --poll-option "4pm" --poll-multi
|
||||
|
||||
# Discord
|
||||
clawdbot message --action poll --provider discord --to channel:123456789 \
|
||||
clawdbot message poll --provider discord --to channel:123456789 \
|
||||
--poll-question "Snack?" --poll-option "Pizza" --poll-option "Sushi"
|
||||
clawdbot message --action poll --provider discord --to channel:123456789 \
|
||||
clawdbot message poll --provider discord --to channel:123456789 \
|
||||
--poll-question "Plan?" --poll-option "A" --poll-option "B" --poll-duration-hours 48
|
||||
```
|
||||
|
||||
|
||||
@@ -13,12 +13,9 @@ Single outbound command for sending messages and provider actions
|
||||
## Usage
|
||||
|
||||
```
|
||||
clawdbot message --action <action> [--provider <name>] [flags]
|
||||
clawdbot message <subcommand> [flags]
|
||||
```
|
||||
|
||||
Defaults:
|
||||
- `--action send`
|
||||
|
||||
Provider selection:
|
||||
- `--provider` required if more than one provider is configured.
|
||||
- If exactly one provider is configured, it becomes the default.
|
||||
@@ -33,170 +30,124 @@ Target formats (`--to`):
|
||||
|
||||
## Common flags
|
||||
|
||||
- `--to <dest>`
|
||||
- `--message <text>`
|
||||
- `--media <url>`
|
||||
- `--message-id <id>`
|
||||
- `--reply-to <id>`
|
||||
- `--thread-id <id>` (Telegram forum thread)
|
||||
- `--account <id>` (multi-account providers)
|
||||
- `--dry-run`
|
||||
- `--provider <name>`
|
||||
- `--account <id>`
|
||||
- `--json`
|
||||
- `--dry-run`
|
||||
- `--verbose`
|
||||
|
||||
## Actions
|
||||
|
||||
### `send`
|
||||
Providers: whatsapp, telegram, discord, slack, signal, imessage
|
||||
Required: `--to`, `--message`
|
||||
Optional: `--media`, `--reply-to`, `--thread-id`, `--account`, `--gif-playback`
|
||||
### Core
|
||||
|
||||
### `react`
|
||||
Providers: discord, slack, telegram, whatsapp
|
||||
Required: `--to`, `--message-id`
|
||||
Optional: `--emoji`, `--remove`, `--participant`, `--from-me`, `--account`
|
||||
- `send`
|
||||
- Required: `--to`, `--message`
|
||||
- Optional: `--media`, `--reply-to`, `--thread-id`, `--gif-playback`
|
||||
|
||||
### `reactions`
|
||||
Providers: discord, slack
|
||||
Required: `--to`, `--message-id`
|
||||
Optional: `--limit`
|
||||
- `poll`
|
||||
- Required: `--to`, `--poll-question`, `--poll-option` (repeat)
|
||||
- Optional: `--poll-multi`, `--poll-duration-hours`, `--message`
|
||||
|
||||
### `read`
|
||||
Providers: discord, slack
|
||||
Required: `--to`
|
||||
Optional: `--limit`, `--before`, `--after`, `--around`
|
||||
- `react`
|
||||
- Required: `--to`, `--message-id`
|
||||
- Optional: `--emoji`, `--remove`, `--participant`, `--from-me`, `--channel-id`
|
||||
|
||||
### `edit`
|
||||
Providers: discord, slack
|
||||
Required: `--to`, `--message-id`, `--message`
|
||||
- `reactions`
|
||||
- Required: `--to`, `--message-id`
|
||||
- Optional: `--limit`, `--channel-id`
|
||||
|
||||
### `delete`
|
||||
Providers: discord, slack
|
||||
Required: `--to`, `--message-id`
|
||||
- `read`
|
||||
- Required: `--to`
|
||||
- Optional: `--limit`, `--before`, `--after`, `--around`, `--channel-id`
|
||||
|
||||
### `pin`
|
||||
Providers: discord, slack
|
||||
Required: `--to`, `--message-id`
|
||||
- `edit`
|
||||
- Required: `--to`, `--message-id`, `--message`
|
||||
- Optional: `--channel-id`
|
||||
|
||||
### `unpin`
|
||||
Providers: discord, slack
|
||||
Required: `--to`, `--message-id`
|
||||
- `delete`
|
||||
- Required: `--to`, `--message-id`
|
||||
- Optional: `--channel-id`
|
||||
|
||||
### `list-pins`
|
||||
Providers: discord, slack
|
||||
Required: `--to`
|
||||
- `pin` / `unpin`
|
||||
- Required: `--to`, `--message-id`
|
||||
- Optional: `--channel-id`
|
||||
|
||||
### `poll`
|
||||
Providers: whatsapp, discord
|
||||
Required: `--to`, `--poll-question`, `--poll-option` (repeat)
|
||||
Optional: `--poll-multi`, `--poll-duration-hours`, `--message`
|
||||
- `pins` (list)
|
||||
- Required: `--to`
|
||||
- Optional: `--channel-id`
|
||||
|
||||
### `sticker`
|
||||
Providers: discord
|
||||
Required: `--to`, `--sticker-id` (repeat)
|
||||
Optional: `--message`
|
||||
- `permissions`
|
||||
- Required: `--to`
|
||||
- Optional: `--channel-id`
|
||||
|
||||
### `permissions`
|
||||
Providers: discord
|
||||
Required: `--to` (channel id)
|
||||
- `search`
|
||||
- Required: `--guild-id`, `--query`
|
||||
- Optional: `--channel-id`, `--channel-ids` (repeat), `--author-id`, `--author-ids` (repeat), `--limit`
|
||||
|
||||
### `thread-create`
|
||||
Providers: discord
|
||||
Required: `--to` (channel id), `--thread-name`
|
||||
Optional: `--message-id`, `--auto-archive-min`
|
||||
### Threads
|
||||
|
||||
### `thread-list`
|
||||
Providers: discord
|
||||
Required: `--guild-id`
|
||||
Optional: `--channel-id`, `--include-archived`, `--before`, `--limit`
|
||||
- `thread create`
|
||||
- Required: `--thread-name`, `--to` (channel id) or `--channel-id`
|
||||
- Optional: `--message-id`, `--auto-archive-min`
|
||||
|
||||
### `thread-reply`
|
||||
Providers: discord
|
||||
Required: `--to` (thread id), `--message`
|
||||
Optional: `--media`, `--reply-to`
|
||||
- `thread list`
|
||||
- Required: `--guild-id`
|
||||
- Optional: `--channel-id`, `--include-archived`, `--before`, `--limit`
|
||||
|
||||
### `search`
|
||||
Providers: discord
|
||||
Required: `--guild-id`, `--query`
|
||||
Optional: `--channel-id`, `--channel-ids`, `--author-id`, `--author-ids`, `--limit`
|
||||
- `thread reply`
|
||||
- Required: `--to` (thread id), `--message`
|
||||
- Optional: `--media`, `--reply-to`
|
||||
|
||||
### `member-info`
|
||||
Providers: discord, slack
|
||||
Required: `--user-id`
|
||||
Discord only: also `--guild-id`
|
||||
### Emojis
|
||||
|
||||
### `role-info`
|
||||
Providers: discord
|
||||
Required: `--guild-id`
|
||||
- `emoji list`
|
||||
- Discord: `--guild-id`
|
||||
|
||||
### `emoji-list`
|
||||
Providers: discord, slack
|
||||
Discord only: `--guild-id`
|
||||
- `emoji upload`
|
||||
- Required: `--guild-id`, `--emoji-name`, `--media`
|
||||
- Optional: `--role-ids` (repeat)
|
||||
|
||||
### `emoji-upload`
|
||||
Providers: discord
|
||||
Required: `--guild-id`, `--emoji-name`, `--media`
|
||||
Optional: `--role-ids` (repeat)
|
||||
### Stickers
|
||||
|
||||
### `sticker-upload`
|
||||
Providers: discord
|
||||
Required: `--guild-id`, `--sticker-name`, `--sticker-desc`, `--sticker-tags`, `--media`
|
||||
- `sticker send`
|
||||
- Required: `--to`, `--sticker-id` (repeat)
|
||||
- Optional: `--message`
|
||||
|
||||
### `role-add`
|
||||
Providers: discord
|
||||
Required: `--guild-id`, `--user-id`, `--role-id`
|
||||
- `sticker upload`
|
||||
- Required: `--guild-id`, `--sticker-name`, `--sticker-desc`, `--sticker-tags`, `--media`
|
||||
|
||||
### `role-remove`
|
||||
Providers: discord
|
||||
Required: `--guild-id`, `--user-id`, `--role-id`
|
||||
### Roles / Channels / Members / Voice
|
||||
|
||||
### `channel-info`
|
||||
Providers: discord
|
||||
Required: `--channel-id`
|
||||
- `role info` (Discord): `--guild-id`
|
||||
- `role add` / `role remove` (Discord): `--guild-id`, `--user-id`, `--role-id`
|
||||
- `channel info` (Discord): `--channel-id`
|
||||
- `channel list` (Discord): `--guild-id`
|
||||
- `member info` (Discord/Slack): `--user-id` (+ `--guild-id` for Discord)
|
||||
- `voice status` (Discord): `--guild-id`, `--user-id`
|
||||
|
||||
### `channel-list`
|
||||
Providers: discord
|
||||
Required: `--guild-id`
|
||||
### Events
|
||||
|
||||
### `voice-status`
|
||||
Providers: discord
|
||||
Required: `--guild-id`, `--user-id`
|
||||
- `event list` (Discord): `--guild-id`
|
||||
- `event create` (Discord): `--guild-id`, `--event-name`, `--start-time`
|
||||
- Optional: `--end-time`, `--desc`, `--channel-id`, `--location`, `--event-type`
|
||||
|
||||
### `event-list`
|
||||
Providers: discord
|
||||
Required: `--guild-id`
|
||||
### Moderation (Discord)
|
||||
|
||||
### `event-create`
|
||||
Providers: discord
|
||||
Required: `--guild-id`, `--event-name`, `--start-time`
|
||||
Optional: `--end-time`, `--desc`, `--channel-id`, `--location`, `--event-type`
|
||||
|
||||
### `timeout`
|
||||
Providers: discord
|
||||
Required: `--guild-id`, `--user-id`
|
||||
Optional: `--duration-min`, `--until`, `--reason`
|
||||
|
||||
### `kick`
|
||||
Providers: discord
|
||||
Required: `--guild-id`, `--user-id`
|
||||
Optional: `--reason`
|
||||
|
||||
### `ban`
|
||||
Providers: discord
|
||||
Required: `--guild-id`, `--user-id`
|
||||
Optional: `--reason`, `--delete-days`
|
||||
- `timeout`: `--guild-id`, `--user-id` (+ `--duration-min` or `--until`)
|
||||
- `kick`: `--guild-id`, `--user-id`
|
||||
- `ban`: `--guild-id`, `--user-id` (+ `--delete-days`)
|
||||
|
||||
## Examples
|
||||
|
||||
Send a Discord reply:
|
||||
```
|
||||
clawdbot message --action send --provider discord \
|
||||
clawdbot message send --provider discord \
|
||||
--to channel:123 --message "hi" --reply-to 456
|
||||
```
|
||||
|
||||
Create a Discord poll:
|
||||
```
|
||||
clawdbot message --action poll --provider discord \
|
||||
clawdbot message poll --provider discord \
|
||||
--to channel:123 \
|
||||
--poll-question "Snack?" \
|
||||
--poll-option Pizza --poll-option Sushi \
|
||||
@@ -205,6 +156,6 @@ clawdbot message --action poll --provider discord \
|
||||
|
||||
React in Slack:
|
||||
```
|
||||
clawdbot message --action react --provider slack \
|
||||
clawdbot message react --provider slack \
|
||||
--to C123 --message-id 456 --emoji "✅"
|
||||
```
|
||||
|
||||
@@ -254,7 +254,7 @@ Windows installs should use **WSL2** and follow the Linux systemd section above.
|
||||
|
||||
## CLI helpers
|
||||
- `clawdbot gateway health|status` — request health/status over the Gateway WS.
|
||||
- `clawdbot message --to <num> --message "hi" [--media ...]` — send via Gateway (idempotent for WhatsApp).
|
||||
- `clawdbot message send --to <num> --message "hi" [--media ...]` — send via Gateway (idempotent for WhatsApp).
|
||||
- `clawdbot agent --message "hi" --to <num>` — run an agent turn (waits for final by default).
|
||||
- `clawdbot gateway call <method> --params '{"k":"v"}'` — raw method invoker for debugging.
|
||||
- `clawdbot daemon stop|restart` — stop/restart the supervised gateway service (launchd/systemd).
|
||||
|
||||
@@ -134,7 +134,7 @@ clawdbot gateway --port 19001
|
||||
Send a test message (requires a running Gateway):
|
||||
|
||||
```bash
|
||||
clawdbot message --to +15555550123 --message "Hello from CLAWDBOT"
|
||||
clawdbot message send --to +15555550123 --message "Hello from CLAWDBOT"
|
||||
```
|
||||
|
||||
## Configuration (optional)
|
||||
|
||||
@@ -8,12 +8,12 @@ read_when:
|
||||
CLAWDBOT is now **web-only** (Baileys). This document captures the current media handling rules for send, gateway, and agent replies.
|
||||
|
||||
## Goals
|
||||
- Send media with optional captions via `clawdbot message --media`.
|
||||
- Send media with optional captions via `clawdbot message send --media`.
|
||||
- Allow auto-replies from the web inbox to include media alongside text.
|
||||
- Keep per-type limits sane and predictable.
|
||||
|
||||
## CLI Surface
|
||||
- `clawdbot message --media <path-or-url> [--message <caption>]`
|
||||
- `clawdbot message send --media <path-or-url> [--message <caption>]`
|
||||
- `--media` optional; caption can be empty for media-only sends.
|
||||
- `--dry-run` prints the resolved payload; `--json` emits `{ provider, to, messageId, mediaUrl, caption }`.
|
||||
|
||||
@@ -30,7 +30,7 @@ CLAWDBOT is now **web-only** (Baileys). This document captures the current media
|
||||
|
||||
## Auto-Reply Pipeline
|
||||
- `getReplyFromConfig` returns `{ text?, mediaUrl?, mediaUrls? }`.
|
||||
- When media is present, the web sender resolves local paths or URLs using the same pipeline as `clawdbot message`.
|
||||
- When media is present, the web sender resolves local paths or URLs using the same pipeline as `clawdbot message send`.
|
||||
- Multiple media entries are sent sequentially if provided.
|
||||
|
||||
## Inbound Media to Commands (Pi)
|
||||
|
||||
@@ -223,7 +223,7 @@ Outbound Telegram API calls retry on transient network/429 errors with exponenti
|
||||
|
||||
## Delivery targets (CLI/cron)
|
||||
- Use a chat id (`123456789`) or a username (`@name`) as the target.
|
||||
- Example: `clawdbot message --provider telegram --to 123456789 --message "hi"`.
|
||||
- Example: `clawdbot message send --provider telegram --to 123456789 --message "hi"`.
|
||||
|
||||
## Troubleshooting
|
||||
|
||||
|
||||
@@ -158,7 +158,7 @@ Behavior:
|
||||
- Caption only on first media item.
|
||||
- Media fetch supports HTTP(S) and local paths.
|
||||
- Animated GIFs: WhatsApp expects MP4 with `gifPlayback: true` for inline looping.
|
||||
- CLI: `clawdbot message --media <mp4> --gif-playback`
|
||||
- CLI: `clawdbot message send --media <mp4> --gif-playback`
|
||||
- Gateway: `send` params include `gifPlayback: true`
|
||||
|
||||
## Media limits + optimization
|
||||
|
||||
@@ -560,7 +560,7 @@ Outbound attachments from the agent must include a `MEDIA:<path-or-url>` line (o
|
||||
CLI sending:
|
||||
|
||||
```bash
|
||||
clawdbot message --to +15555550123 --message "Here you go" --media /path/to/file.png
|
||||
clawdbot message send --to +15555550123 --message "Here you go" --media /path/to/file.png
|
||||
```
|
||||
|
||||
Note: images are resized/recompressed (max side 2048px) to hit size limits. See [Images](/nodes/images).
|
||||
|
||||
@@ -152,7 +152,7 @@ In a new terminal:
|
||||
|
||||
```bash
|
||||
clawdbot health
|
||||
clawdbot message --to +15555550123 --message "Hello from Clawdbot"
|
||||
clawdbot message send --to +15555550123 --message "Hello from Clawdbot"
|
||||
```
|
||||
|
||||
If `health` shows “no auth configured”, go back to the wizard and set OAuth/key auth — the agent won’t be able to respond without it.
|
||||
|
||||
Reference in New Issue
Block a user