mirror of
https://github.com/openclaw/openclaw.git
synced 2026-08-28 05:16:23 -06:00
99d662473c
* fix(channels): validate headless channel setup * docs(channels): document headless provisioning * fix(channels): repair setup metadata typing * chore(channels): regenerate official channel catalog for env metadata * fix(slack): keep mode-conditional env contract plugin-owned Static --use-env declaration keeps only the unconditional SLACK_BOT_TOKEN; socket-vs-HTTP conditional requirements (app token, signing secret) stay in Slack's own setup validation so HTTP mode no longer demands an irrelevant SLACK_APP_TOKEN. * chore(sdk): regenerate api baselines and catalog after rebase * fix(slack): align manifest env declaration with runtime contract * chore(sdk): regenerate api baselines after rebase * chore(sdk): regenerate api baselines after rebase * chore(sdk): regenerate api baselines after rebase
33 lines
1.1 KiB
TypeScript
33 lines
1.1 KiB
TypeScript
import { defineChannelSetupContract } from "openclaw/plugin-sdk/channel-setup";
|
|
// Discord plugin module implements setup adapter behavior.
|
|
import {
|
|
createEnvPatchedAccountSetupAdapter,
|
|
type ChannelSetupAdapter,
|
|
} from "openclaw/plugin-sdk/setup-runtime";
|
|
|
|
const channel = "discord" as const;
|
|
|
|
const discordSetupAdapter: ChannelSetupAdapter = createEnvPatchedAccountSetupAdapter({
|
|
channelKey: channel,
|
|
defaultAccountOnlyEnvError: "DISCORD_BOT_TOKEN can only be used for the default account.",
|
|
missingCredentialError: "Discord requires token (or --use-env).",
|
|
hasCredentials: (input) => Boolean(input.token),
|
|
buildPatch: (input) => (input.token ? { token: input.token } : {}),
|
|
});
|
|
|
|
export const discordSetupContract = defineChannelSetupContract({
|
|
fields: {
|
|
token: {
|
|
kind: "string",
|
|
sensitive: true,
|
|
cli: { flags: "--token <token>", description: "Discord bot token" },
|
|
},
|
|
useEnv: {
|
|
kind: "boolean",
|
|
cli: { flags: "--use-env", description: "Use DISCORD_BOT_TOKEN" },
|
|
envVars: ["DISCORD_BOT_TOKEN"],
|
|
},
|
|
},
|
|
legacyAdapter: discordSetupAdapter,
|
|
});
|