mirror of
https://github.com/openclaw/openclaw.git
synced 2026-05-08 09:51:22 +00:00
refactor: plugin catalog + nextcloud policy
This commit is contained in:
@@ -150,6 +150,7 @@ describe("getDmHistoryLimitFromSessionKey", () => {
|
||||
"signal",
|
||||
"imessage",
|
||||
"msteams",
|
||||
"nextcloud-talk",
|
||||
] as const;
|
||||
|
||||
for (const provider of providers) {
|
||||
@@ -168,6 +169,7 @@ describe("getDmHistoryLimitFromSessionKey", () => {
|
||||
"signal",
|
||||
"imessage",
|
||||
"msteams",
|
||||
"nextcloud-talk",
|
||||
] as const;
|
||||
|
||||
for (const provider of providers) {
|
||||
|
||||
@@ -62,22 +62,16 @@ export function getDmHistoryLimitFromSessionKey(
|
||||
return providerConfig.dmHistoryLimit;
|
||||
};
|
||||
|
||||
switch (provider) {
|
||||
case "telegram":
|
||||
return getLimit(config.channels?.telegram);
|
||||
case "whatsapp":
|
||||
return getLimit(config.channels?.whatsapp);
|
||||
case "discord":
|
||||
return getLimit(config.channels?.discord);
|
||||
case "slack":
|
||||
return getLimit(config.channels?.slack);
|
||||
case "signal":
|
||||
return getLimit(config.channels?.signal);
|
||||
case "imessage":
|
||||
return getLimit(config.channels?.imessage);
|
||||
case "msteams":
|
||||
return getLimit(config.channels?.msteams);
|
||||
default:
|
||||
return undefined;
|
||||
}
|
||||
const resolveProviderConfig = (
|
||||
cfg: ClawdbotConfig | undefined,
|
||||
providerId: string,
|
||||
): { dmHistoryLimit?: number; dms?: Record<string, { historyLimit?: number }> } | undefined => {
|
||||
const channels = cfg?.channels;
|
||||
if (!channels || typeof channels !== "object") return undefined;
|
||||
const entry = (channels as Record<string, unknown>)[providerId];
|
||||
if (!entry || typeof entry !== "object" || Array.isArray(entry)) return undefined;
|
||||
return entry as { dmHistoryLimit?: number; dms?: Record<string, { historyLimit?: number }> };
|
||||
};
|
||||
|
||||
return getLimit(resolveProviderConfig(config, provider));
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user