mirror of
https://github.com/openclaw/openclaw.git
synced 2026-04-05 06:11:24 +00:00
29 lines
771 B
TypeScript
29 lines
771 B
TypeScript
import {
|
|
createPatchedAccountSetupAdapter,
|
|
createSetupInputPresenceValidator,
|
|
DEFAULT_ACCOUNT_ID,
|
|
} from "openclaw/plugin-sdk/setup";
|
|
|
|
const channel = "zalo" as const;
|
|
|
|
export const zaloSetupAdapter = createPatchedAccountSetupAdapter({
|
|
channelKey: channel,
|
|
validateInput: createSetupInputPresenceValidator({
|
|
defaultAccountOnlyEnvError: "ZALO_BOT_TOKEN can only be used for the default account.",
|
|
whenNotUseEnv: [
|
|
{
|
|
someOf: ["token", "tokenFile"],
|
|
message: "Zalo requires token or --token-file (or --use-env).",
|
|
},
|
|
],
|
|
}),
|
|
buildPatch: (input) =>
|
|
input.useEnv
|
|
? {}
|
|
: input.tokenFile
|
|
? { tokenFile: input.tokenFile }
|
|
: input.token
|
|
? { botToken: input.token }
|
|
: {},
|
|
});
|