feat(discord): Discord transport

This commit is contained in:
Shadow
2025-12-15 10:11:18 -06:00
committed by Peter Steinberger
parent 557f8e5a04
commit ac659ff5a7
44 changed files with 1352 additions and 56 deletions

View File

@@ -155,10 +155,13 @@ export function registerCronCli(program: Command) {
.option("--deliver", "Deliver agent output", false)
.option(
"--channel <channel>",
"Delivery channel (last|whatsapp|telegram)",
"Delivery channel (last|whatsapp|telegram|discord)",
"last",
)
.option("--to <dest>", "Delivery destination (E.164 or Telegram chatId)")
.option(
"--to <dest>",
"Delivery destination (E.164, Telegram chatId, or Discord channel/user)",
)
.option(
"--best-effort-deliver",
"Do not fail the job if delivery fails",
@@ -411,9 +414,12 @@ export function registerCronCli(program: Command) {
.option("--deliver", "Deliver agent output", false)
.option(
"--channel <channel>",
"Delivery channel (last|whatsapp|telegram)",
"Delivery channel (last|whatsapp|telegram|discord)",
)
.option(
"--to <dest>",
"Delivery destination (E.164, Telegram chatId, or Discord channel/user)",
)
.option("--to <dest>", "Delivery destination")
.option(
"--best-effort-deliver",
"Do not fail job if delivery fails",

View File

@@ -1,15 +1,18 @@
import { sendMessageDiscord } from "../discord/send.js";
import { logWebSelfId, sendMessageWhatsApp } from "../providers/web/index.js";
import { sendMessageTelegram } from "../telegram/send.js";
export type CliDeps = {
sendMessageWhatsApp: typeof sendMessageWhatsApp;
sendMessageTelegram: typeof sendMessageTelegram;
sendMessageDiscord: typeof sendMessageDiscord;
};
export function createDefaultDeps(): CliDeps {
return {
sendMessageWhatsApp,
sendMessageTelegram,
sendMessageDiscord,
};
}

View File

@@ -149,10 +149,10 @@ export function buildProgram() {
program
.command("send")
.description("Send a message (WhatsApp web or Telegram bot)")
.description("Send a message (WhatsApp Web, Telegram bot, or Discord)")
.requiredOption(
"-t, --to <number>",
"Recipient: E.164 for WhatsApp (e.g. +15555550123) or Telegram chat id/@username",
"Recipient: E.164 for WhatsApp, Telegram chat id/@username, or Discord channel/user",
)
.requiredOption("-m, --message <text>", "Message body")
.option(
@@ -161,7 +161,7 @@ export function buildProgram() {
)
.option(
"--provider <provider>",
"Delivery provider: whatsapp|telegram (default: whatsapp)",
"Delivery provider: whatsapp|telegram|discord (default: whatsapp)",
)
.option("--dry-run", "Print payload and skip sending", false)
.option("--json", "Output result as JSON", false)
@@ -202,9 +202,13 @@ Examples:
"Thinking level: off | minimal | low | medium | high",
)
.option("--verbose <on|off>", "Persist agent verbose level for the session")
.option(
"--provider <provider>",
"Delivery provider: whatsapp|telegram|discord (default: whatsapp)",
)
.option(
"--deliver",
"Send the agent's reply back to WhatsApp (requires --to)",
"Send the agent's reply back to the selected provider (requires --to)",
false,
)
.option("--json", "Output result as JSON", false)
@@ -247,7 +251,11 @@ Examples:
.command("status")
.description("Show web session health and recent session recipients")
.option("--json", "Output JSON instead of text", false)
.option("--deep", "Probe providers (WA connect + Telegram API)", false)
.option(
"--deep",
"Probe providers (WhatsApp Web + Telegram + Discord)",
false,
)
.option("--timeout <ms>", "Probe timeout in milliseconds", "10000")
.option("--verbose", "Verbose logging", false)
.addHelpText(
@@ -256,7 +264,7 @@ Examples:
Examples:
clawdis status # show linked account + session store summary
clawdis status --json # machine-readable output
clawdis status --deep # run provider probes (WA + Telegram)
clawdis status --deep # run provider probes (WA + Telegram + Discord)
clawdis status --deep --timeout 5000 # tighten probe timeout`,
)
.action(async (opts) => {