import {
listCombinedAccountIds,
normalizeAccountId,
resolveNormalizedAccountEntry,
} from "openclaw/plugin-sdk/account-resolution"; import type { OpenClawConfig } from "openclaw/plugin-sdk/config-runtime"; import { resolveTwitchToken, type TwitchTokenResolution } from "./token.js"; import type { TwitchAccountConfig } from "./types.js"; import { isAccountConfigured } from "./utils/twitch.js";
/** * Default account ID for Twitch
*/
export const DEFAULT_ACCOUNT_ID = "default";
// Merge: base-level takes precedence over accounts.default const merged: Partial<TwitchAccountConfig> = {
...accountFromAccounts,
...baseLevel,
} as Partial<TwitchAccountConfig>;
// Only return if we have at least username if (merged.username) { return merged as TwitchAccountConfig;
}
// Fall through to accounts.default if no base-level username if (accountFromAccounts) { return accountFromAccounts;
}
returnnull;
}
// For non-default accounts, only check accounts object const account = resolveNormalizedAccountEntry(accounts, normalizedAccountId, normalizeAccountId); if (!account) { returnnull;
}
return account;
}
/** * List all configured account IDs * * Includes both explicit accounts and implicit "default" from base-level config
*/
export function listAccountIds(cfg: OpenClawConfig): string[] { const twitch = cfg.channels?.twitch; // Access accounts via unknown to handle union type (single-account vs multi-account) const twitchRaw = twitch as Record<string, unknown> | undefined; const accountMap = twitchRaw?.accounts as Record<string, unknown> | undefined;
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.