@openclaw/discord 2026.3.7 → 2026.3.8-beta.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/package.json +1 -1
- package/src/channel.ts +11 -21
- package/src/runtime.ts +4 -12
package/package.json
CHANGED
package/src/channel.ts
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { createScopedChannelConfigBase } from "openclaw/plugin-sdk/compat";
|
|
1
2
|
import {
|
|
2
3
|
buildAccountScopedDmSecurityPolicy,
|
|
3
4
|
collectOpenProviderGroupPolicyWarnings,
|
|
@@ -13,7 +14,6 @@ import {
|
|
|
13
14
|
collectDiscordAuditChannelIds,
|
|
14
15
|
collectDiscordStatusIssues,
|
|
15
16
|
DEFAULT_ACCOUNT_ID,
|
|
16
|
-
deleteAccountFromConfigSection,
|
|
17
17
|
discordOnboardingAdapter,
|
|
18
18
|
DiscordConfigSchema,
|
|
19
19
|
getChatChannelMeta,
|
|
@@ -33,7 +33,6 @@ import {
|
|
|
33
33
|
resolveDefaultDiscordAccountId,
|
|
34
34
|
resolveDiscordGroupRequireMention,
|
|
35
35
|
resolveDiscordGroupToolPolicy,
|
|
36
|
-
setAccountEnabledInConfigSection,
|
|
37
36
|
type ChannelMessageActionAdapter,
|
|
38
37
|
type ChannelPlugin,
|
|
39
38
|
type ResolvedDiscordAccount,
|
|
@@ -63,6 +62,15 @@ const discordConfigAccessors = createScopedAccountConfigAccessors({
|
|
|
63
62
|
resolveDefaultTo: (account: ResolvedDiscordAccount) => account.config.defaultTo,
|
|
64
63
|
});
|
|
65
64
|
|
|
65
|
+
const discordConfigBase = createScopedChannelConfigBase({
|
|
66
|
+
sectionKey: "discord",
|
|
67
|
+
listAccountIds: listDiscordAccountIds,
|
|
68
|
+
resolveAccount: (cfg, accountId) => resolveDiscordAccount({ cfg, accountId }),
|
|
69
|
+
inspectAccount: (cfg, accountId) => inspectDiscordAccount({ cfg, accountId }),
|
|
70
|
+
defaultAccountId: resolveDefaultDiscordAccountId,
|
|
71
|
+
clearBaseFields: ["token", "name"],
|
|
72
|
+
});
|
|
73
|
+
|
|
66
74
|
export const discordPlugin: ChannelPlugin<ResolvedDiscordAccount> = {
|
|
67
75
|
id: "discord",
|
|
68
76
|
meta: {
|
|
@@ -93,25 +101,7 @@ export const discordPlugin: ChannelPlugin<ResolvedDiscordAccount> = {
|
|
|
93
101
|
reload: { configPrefixes: ["channels.discord"] },
|
|
94
102
|
configSchema: buildChannelConfigSchema(DiscordConfigSchema),
|
|
95
103
|
config: {
|
|
96
|
-
|
|
97
|
-
resolveAccount: (cfg, accountId) => resolveDiscordAccount({ cfg, accountId }),
|
|
98
|
-
inspectAccount: (cfg, accountId) => inspectDiscordAccount({ cfg, accountId }),
|
|
99
|
-
defaultAccountId: (cfg) => resolveDefaultDiscordAccountId(cfg),
|
|
100
|
-
setAccountEnabled: ({ cfg, accountId, enabled }) =>
|
|
101
|
-
setAccountEnabledInConfigSection({
|
|
102
|
-
cfg,
|
|
103
|
-
sectionKey: "discord",
|
|
104
|
-
accountId,
|
|
105
|
-
enabled,
|
|
106
|
-
allowTopLevel: true,
|
|
107
|
-
}),
|
|
108
|
-
deleteAccount: ({ cfg, accountId }) =>
|
|
109
|
-
deleteAccountFromConfigSection({
|
|
110
|
-
cfg,
|
|
111
|
-
sectionKey: "discord",
|
|
112
|
-
accountId,
|
|
113
|
-
clearBaseFields: ["token", "name"],
|
|
114
|
-
}),
|
|
104
|
+
...discordConfigBase,
|
|
115
105
|
isConfigured: (account) => Boolean(account.token?.trim()),
|
|
116
106
|
describeAccount: (account) => ({
|
|
117
107
|
accountId: account.accountId,
|
package/src/runtime.ts
CHANGED
|
@@ -1,14 +1,6 @@
|
|
|
1
|
+
import { createPluginRuntimeStore } from "openclaw/plugin-sdk/compat";
|
|
1
2
|
import type { PluginRuntime } from "openclaw/plugin-sdk/discord";
|
|
2
3
|
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export
|
|
6
|
-
runtime = next;
|
|
7
|
-
}
|
|
8
|
-
|
|
9
|
-
export function getDiscordRuntime(): PluginRuntime {
|
|
10
|
-
if (!runtime) {
|
|
11
|
-
throw new Error("Discord runtime not initialized");
|
|
12
|
-
}
|
|
13
|
-
return runtime;
|
|
14
|
-
}
|
|
4
|
+
const { setRuntime: setDiscordRuntime, getRuntime: getDiscordRuntime } =
|
|
5
|
+
createPluginRuntimeStore<PluginRuntime>("Discord runtime not initialized");
|
|
6
|
+
export { getDiscordRuntime, setDiscordRuntime };
|