mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-04 04:01:42 +00:00
Adds a Discord Activities integration so an agent can show a self-contained HTML widget to Discord users, opened as a sandboxed Activity inside the client. Off by default: routes, the discord_widget tool, and the launch handler register only when channels.discord.activities is configured. OAuth identifies the user and gates on the account allowlist; widget lookup is capability- or instance-validated; token exchange is rate-limited; widget HTML runs in a no-network sandboxed iframe.
25 lines
725 B
JavaScript
25 lines
725 B
JavaScript
#!/usr/bin/env node
|
|
|
|
import fs from "node:fs/promises";
|
|
import path from "node:path";
|
|
import { fileURLToPath } from "node:url";
|
|
import { build } from "esbuild";
|
|
|
|
const modulePath = fileURLToPath(import.meta.url);
|
|
const repoRoot = path.resolve(path.dirname(modulePath), "..");
|
|
const discordDir = path.join(repoRoot, "extensions/discord");
|
|
const outputPath = path.join(repoRoot, "extensions/discord/assets/embedded-app-sdk.mjs");
|
|
|
|
await fs.mkdir(path.dirname(outputPath), { recursive: true });
|
|
await build({
|
|
entryPoints: ["@discord/embedded-app-sdk"],
|
|
absWorkingDir: discordDir,
|
|
bundle: true,
|
|
platform: "browser",
|
|
target: "es2020",
|
|
format: "esm",
|
|
minify: true,
|
|
legalComments: "none",
|
|
outfile: outputPath,
|
|
});
|