@openclaw/discord 2026.7.1 → 2026.7.2-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/dist/action-runtime-api.js +1 -1
- package/dist/{allow-list-C-MqM-B_.js → allow-list-B7qOH5xu.js} +22 -1
- package/dist/{api-DPRqYi4Z.js → api--f62GFaS.js} +38 -23
- package/dist/api.js +15 -15
- package/dist/approval-custom-id-NYPYj9Po.js +58 -0
- package/dist/{approval-handler.runtime-Bw2pZNk1.js → approval-handler.runtime-DeyIiw5I.js} +28 -23
- package/dist/approval-message-safety-C-8BL6Kv.js +47 -0
- package/dist/{audit-MLpDpN3Z.js → audit-Df2w046a.js} +3 -3
- package/dist/{channel-actions-D_fjVUZ_.js → channel-actions-ChpBSRcu.js} +6 -4
- package/dist/{channel-actions.runtime-CVHlFqQg.js → channel-actions.runtime-D8V8tyCq.js} +41 -12
- package/dist/channel-config-api.js +1 -1
- package/dist/{channel-DGWPH5u3.js → channel-nYmJ7FKQ.js} +275 -62
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-tZcpIn4e.js → channel.setup-DyihrqHH.js} +3 -3
- package/dist/{components-BIBizbtZ.js → components-BVrfRS-F.js} +78 -52
- package/dist/config-api-B18fR8M5.js +3 -0
- package/dist/{config-schema-BgIhO3ko.js → config-schema-_bUKcWRm.js} +42 -82
- package/dist/conversation-identity-BpkAzklg.js +94 -0
- package/dist/{directory-config-ByaUKL1f.js → directory-config-BUe-qq_C.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-BX79ImQA.js → directory-live-DZByMdPO.js} +6 -6
- package/dist/{doctor-Bgoxm5AN.js → doctor-bMaWXFKu.js} +5 -4
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{doctor-contract-CU7lnZTF.js → doctor-contract-wId6pV41.js} +41 -37
- package/dist/{handle-action.guild-admin-CgJSNVui.js → handle-action.guild-admin-C_PQcBEV.js} +12 -12
- package/dist/index.js +1 -1
- package/dist/legacy-state-migrations-api.js +24 -2
- package/dist/{manager.runtime-DaB-CTrt.js → manager.runtime-3RVMVkyx.js} +546 -154
- package/dist/{message-handler-DcgvugZt.js → message-handler-CIxWq5Yh.js} +8 -9
- package/dist/{message-handler.preflight-DvLXiYVH.js → message-handler.preflight-BI86IbHz.js} +46 -22
- package/dist/{message-handler.process-Cjf30P_B.js → message-handler.process-bPS_9_tb.js} +241 -107
- package/dist/{message-utils-B_3yA5bN.js → message-utils-D4j07taS.js} +2 -3
- package/dist/{outbound-adapter-82RWi_SR.js → outbound-adapter-Czny0Fae.js} +16 -68
- package/dist/outbound-components-oJKLj62G.js +99 -0
- package/dist/pluralkit-UXq1OyUI.js +40 -0
- package/dist/{probe-D1ImJEo2.js → probe-DxjMBeVG.js} +1 -1
- package/dist/{probe.runtime-B1dsEeBD.js → probe.runtime-Bc8Oo6e8.js} +1 -1
- package/dist/{provider-BkfbC9FQ.js → provider-DWvDNb4J.js} +702 -236
- package/dist/{provider-session.runtime-BDjyFw6Y.js → provider-session.runtime-D5pCGibh.js} +3 -3
- package/dist/provider.runtime-C2iIfbTs.js +2 -0
- package/dist/{resolve-allowlist-common-CWbE8XlH.js → resolve-allowlist-common-B9S8LLBd.js} +5 -5
- package/dist/{resolve-channels-CcpvWoRa.js → resolve-channels-BrkWOKdG.js} +7 -7
- package/dist/{resolve-users-DJamun9s.js → resolve-users-OjrXXvJP.js} +5 -5
- package/dist/{runtime-C6rRmQ6l.js → runtime-C618lis9.js} +223 -33
- package/dist/runtime-api.actions.js +2 -2
- package/dist/runtime-api.js +23 -23
- package/dist/runtime-api.lookup.js +5 -5
- package/dist/runtime-api.monitor-DSbfGnzS.js +6 -0
- package/dist/runtime-api.monitor.js +7 -7
- package/dist/runtime-api.send.js +5 -5
- package/dist/runtime-api.threads.js +5 -5
- package/dist/{send-iJ0B4bAX.js → send-BFpa_DHn.js} +21 -12
- package/dist/{send.components-D0I39utR.js → send.components-BaXQJKWT.js} +15 -10
- package/dist/{send.outbound-Bj61Q3a0.js → send.outbound-BlA6VzSE.js} +22 -12
- package/dist/{send.receipt-BpBQED_5.js → send.receipt-aegk69an.js} +59 -75
- package/dist/{send.shared-wAwMhHDN.js → send.shared-Xz7IMVpu.js} +44 -20
- package/dist/{sender-identity-CEsfDF0L.js → sender-identity-C62lBe18.js} +1 -1
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-BQVKfnev.js → shared-BLYBt5SA.js} +3 -3
- package/dist/{subagent-hooks-B-bJxxGg.js → subagent-hooks-DKJ4p-Oy.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-DVnqSyTt.js → system-events-DKwfE-2z.js} +2 -2
- package/dist/{target-resolver-CwHaSLt3.js → target-resolver-BQyEHyeS.js} +2 -2
- package/dist/targets-DvItNIvP.js +3 -0
- package/dist/thread-binding-api-BDZJD4na.js +4 -0
- package/dist/thread-binding-api.js +1 -3
- package/dist/{thread-bindings-DsTxqu3E.js → thread-bindings-BbzjUuNB.js} +26 -43
- package/dist/{thread-bindings.discord-api-BjIf9lGs.js → thread-bindings.discord-api-DJD3qwIN.js} +8 -10
- package/dist/{thread-bindings.manager-Bwmtqc3E.js → thread-bindings.manager-BIBm6bQd.js} +4 -4
- package/dist/{thread-bindings.session-updates-Chs3HgGa.js → thread-bindings.session-updates-eRcJlzIU.js} +1 -1
- package/dist/{thread-bindings.state-iSWjCYjB.js → thread-bindings.state-9VAxhVf6.js} +3 -14
- package/dist/{timeouts-C5TBc_9x.js → timeouts-ZRc9Lw4y.js} +3 -15
- package/dist/timeouts.js +1 -1
- package/dist/{transcripts-source-BvvM5Ns9.js → transcripts-source-CLZ5X8fh.js} +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-BVcJgILg.js → typing-BnYT7Szq.js} +2 -2
- package/node_modules/p-map/index.d.ts +155 -0
- package/node_modules/p-map/index.js +284 -0
- package/node_modules/p-map/license +9 -0
- package/node_modules/p-map/package.json +57 -0
- package/node_modules/p-map/readme.md +190 -0
- package/npm-shrinkwrap.json +16 -3
- package/openclaw.plugin.json +70 -2
- package/package.json +6 -4
- package/dist/config-api-JiPdJeb0.js +0 -2
- package/dist/conversation-identity-DWC5d8Sy.js +0 -272
- package/dist/pluralkit-DcD-3EcL.js +0 -24
- package/dist/preview-streaming-DXT8oJdo.js +0 -8
- package/dist/provider.runtime-WrJXikSv.js +0 -2
- package/dist/runtime-api.monitor-C2_WVtJf.js +0 -6
- package/dist/targets-69w7c3vU.js +0 -3
|
@@ -1,8 +1,9 @@
|
|
|
1
|
-
import { a as resolveDiscordReplyReference, l as normalizeDiscordOutboundTarget, t as createDiscordSendReceipt, u as chunkDiscordTextWithMode } from "./send.receipt-
|
|
2
|
-
import { d as readDiscordComponentSpec } from "./components-BIBizbtZ.js";
|
|
1
|
+
import { a as resolveDiscordReplyReference, l as normalizeDiscordOutboundTarget, t as createDiscordSendReceipt, u as chunkDiscordTextWithMode } from "./send.receipt-aegk69an.js";
|
|
3
2
|
import { n as notifyDiscordInboundEventOutboundPayloadSuccess } from "./inbound-event-delivery-CEPlt2uz.js";
|
|
4
|
-
import {
|
|
3
|
+
import { a as sendDiscordComponentMessageLazy, i as resolveDiscordComponentSpec, n as buildDiscordPresentationPayload, t as DISCORD_PRESENTATION_CAPABILITIES } from "./outbound-components-oJKLj62G.js";
|
|
4
|
+
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
|
+
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
6
7
|
import { getReplyPayloadTtsSupplement, resolvePayloadMediaUrls, sendPayloadMediaSequenceOrFallback, sendTextMediaPayload } from "openclaw/plugin-sdk/reply-payload";
|
|
7
8
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
8
9
|
import { createReplyToFanout, resolveOutboundSendDep } from "openclaw/plugin-sdk/channel-outbound";
|
|
@@ -20,7 +21,13 @@ function normalizeMediaPathForExtension(mediaUrl) {
|
|
|
20
21
|
const trimmed = mediaUrl.trim();
|
|
21
22
|
if (!trimmed) return "";
|
|
22
23
|
try {
|
|
23
|
-
|
|
24
|
+
const parsed = new URL(trimmed);
|
|
25
|
+
const fileName = parsed.pathname.slice(parsed.pathname.lastIndexOf("/") + 1);
|
|
26
|
+
try {
|
|
27
|
+
return normalizeLowercaseStringOrEmpty(decodeURIComponent(fileName));
|
|
28
|
+
} catch {
|
|
29
|
+
return normalizeLowercaseStringOrEmpty(fileName);
|
|
30
|
+
}
|
|
24
31
|
} catch {
|
|
25
32
|
const withoutHash = trimmed.split("#", 1)[0] ?? trimmed;
|
|
26
33
|
return normalizeLowercaseStringOrEmpty(withoutHash.split("?", 1)[0] ?? withoutHash);
|
|
@@ -48,43 +55,8 @@ function normalizeDiscordApprovalPayload(payload) {
|
|
|
48
55
|
} : payload;
|
|
49
56
|
}
|
|
50
57
|
//#endregion
|
|
51
|
-
//#region extensions/discord/src/outbound-components.ts
|
|
52
|
-
const loadDiscordComponentSend = createLazyRuntimeNamedExport(() => import("./send.components-D0I39utR.js").then((n) => n.i), "sendDiscordComponentMessage");
|
|
53
|
-
async function sendDiscordComponentMessageLazy(...args) {
|
|
54
|
-
return await (await loadDiscordComponentSend())(...args);
|
|
55
|
-
}
|
|
56
|
-
const loadDiscordSharedInteractive = createLazyRuntimeModule(() => import("./components-BIBizbtZ.js").then((n) => n.a));
|
|
57
|
-
function addPayloadTextFallback(spec, payload) {
|
|
58
|
-
return spec.text ? spec : {
|
|
59
|
-
...spec,
|
|
60
|
-
text: payload.text?.trim() ? payload.text : void 0
|
|
61
|
-
};
|
|
62
|
-
}
|
|
63
|
-
async function buildDiscordPresentationPayload(params) {
|
|
64
|
-
const componentSpec = (await loadDiscordSharedInteractive()).buildDiscordPresentationComponents(params.presentation);
|
|
65
|
-
if (!componentSpec) return null;
|
|
66
|
-
return {
|
|
67
|
-
...params.payload,
|
|
68
|
-
channelData: {
|
|
69
|
-
...params.payload.channelData,
|
|
70
|
-
discord: {
|
|
71
|
-
...params.payload.channelData?.discord,
|
|
72
|
-
presentationComponents: componentSpec
|
|
73
|
-
}
|
|
74
|
-
}
|
|
75
|
-
};
|
|
76
|
-
}
|
|
77
|
-
async function resolveDiscordComponentSpec(payload) {
|
|
78
|
-
const discordData = payload.channelData?.discord;
|
|
79
|
-
const rawComponentSpec = discordData?.presentationComponents ?? (discordData?.components && typeof discordData.components === "object" && !Array.isArray(discordData.components) ? readDiscordComponentSpec(discordData.components) : null);
|
|
80
|
-
if (rawComponentSpec) return addPayloadTextFallback(rawComponentSpec, payload);
|
|
81
|
-
if (!payload.interactive) return;
|
|
82
|
-
const interactiveSpec = (await loadDiscordSharedInteractive()).buildDiscordInteractiveComponents(payload.interactive);
|
|
83
|
-
return interactiveSpec ? addPayloadTextFallback(interactiveSpec, payload) : void 0;
|
|
84
|
-
}
|
|
85
|
-
//#endregion
|
|
86
58
|
//#region extensions/discord/src/outbound-send-context.ts
|
|
87
|
-
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-
|
|
59
|
+
const loadDiscordSendRuntime = createLazyRuntimeModule(() => import("./send-BFpa_DHn.js").then((n) => n.t));
|
|
88
60
|
function resolveDiscordOutboundTarget(params) {
|
|
89
61
|
if (params.threadId == null) return params.to;
|
|
90
62
|
const threadId = normalizeOptionalStringifiedId(params.threadId) ?? "";
|
|
@@ -172,7 +144,8 @@ async function sendDiscordOutboundPayload(params) {
|
|
|
172
144
|
let deliveredVoice = false;
|
|
173
145
|
let lastResult;
|
|
174
146
|
try {
|
|
175
|
-
|
|
147
|
+
const voiceUrl = expectDefined(mediaUrls.at(0), "non-empty Discord voice media URLs");
|
|
148
|
+
lastResult = await sendContext.sendVoice(sendContext.target, voiceUrl, { ...resolveDiscordDeliveryOptions(ctx, sendContext, voiceReply) });
|
|
176
149
|
deliveredVoice = true;
|
|
177
150
|
} catch (err) {
|
|
178
151
|
const supplement = getReplyPayloadTtsSupplement(payload);
|
|
@@ -268,7 +241,7 @@ const DISCORD_INTERNAL_RUNTIME_SCAFFOLDING_TAG_RE = /<\s*\/?\s*(?:system-reminde
|
|
|
268
241
|
function stripDiscordInternalRuntimeScaffolding(text) {
|
|
269
242
|
return text.replace(DISCORD_INTERNAL_RUNTIME_SCAFFOLDING_BLOCK_RE, "").replace(DISCORD_INTERNAL_RUNTIME_SCAFFOLDING_SELF_CLOSING_RE, "").replace(DISCORD_INTERNAL_RUNTIME_SCAFFOLDING_TAG_RE, "");
|
|
270
243
|
}
|
|
271
|
-
const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-
|
|
244
|
+
const loadDiscordThreadBindings = createLazyRuntimeModule(() => import("./thread-bindings-BbzjUuNB.js").then((n) => n.t));
|
|
272
245
|
function resolveDiscordWebhookIdentity(params) {
|
|
273
246
|
const usernameRaw = normalizeOptionalString(params.identity?.name);
|
|
274
247
|
const fallbackUsername = normalizeOptionalString(params.binding.label) ?? params.binding.agentId;
|
|
@@ -312,32 +285,7 @@ const discordOutbound = {
|
|
|
312
285
|
sanitizeText: ({ text }) => stripDiscordInternalRuntimeScaffolding(text),
|
|
313
286
|
pollMaxOptions: 10,
|
|
314
287
|
normalizePayload: ({ payload }) => normalizeDiscordApprovalPayload(payload),
|
|
315
|
-
presentationCapabilities:
|
|
316
|
-
supported: true,
|
|
317
|
-
buttons: true,
|
|
318
|
-
selects: true,
|
|
319
|
-
context: true,
|
|
320
|
-
divider: true,
|
|
321
|
-
limits: {
|
|
322
|
-
actions: {
|
|
323
|
-
maxActions: 25,
|
|
324
|
-
maxActionsPerRow: 5,
|
|
325
|
-
maxRows: 5,
|
|
326
|
-
maxLabelLength: 80,
|
|
327
|
-
supportsDisabled: true
|
|
328
|
-
},
|
|
329
|
-
selects: {
|
|
330
|
-
maxOptions: 25,
|
|
331
|
-
maxLabelLength: 100,
|
|
332
|
-
maxValueBytes: 100
|
|
333
|
-
},
|
|
334
|
-
text: {
|
|
335
|
-
maxLength: DISCORD_TEXT_CHUNK_LIMIT,
|
|
336
|
-
encoding: "characters",
|
|
337
|
-
markdownDialect: "discord-markdown"
|
|
338
|
-
}
|
|
339
|
-
}
|
|
340
|
-
},
|
|
288
|
+
presentationCapabilities: DISCORD_PRESENTATION_CAPABILITIES,
|
|
341
289
|
deliveryCapabilities: { durableFinal: {
|
|
342
290
|
text: true,
|
|
343
291
|
media: true,
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
import { d as readDiscordComponentSpec } from "./components-BVrfRS-F.js";
|
|
2
|
+
import { createLazyRuntimeModule, createLazyRuntimeNamedExport } from "openclaw/plugin-sdk/lazy-runtime";
|
|
3
|
+
//#region extensions/discord/src/outbound-components.ts
|
|
4
|
+
const DISCORD_MESSAGE_COMPONENT_LIMIT = 40;
|
|
5
|
+
const DISCORD_TEXT_DISPLAY_LIMIT = 2e3;
|
|
6
|
+
const DISCORD_PRESENTATION_CAPABILITIES = {
|
|
7
|
+
supported: true,
|
|
8
|
+
buttons: true,
|
|
9
|
+
selects: true,
|
|
10
|
+
context: true,
|
|
11
|
+
divider: true,
|
|
12
|
+
charts: false,
|
|
13
|
+
limits: {
|
|
14
|
+
actions: {
|
|
15
|
+
maxActions: 25,
|
|
16
|
+
maxActionsPerRow: 5,
|
|
17
|
+
maxRows: 5,
|
|
18
|
+
maxLabelLength: 80,
|
|
19
|
+
supportsDisabled: true
|
|
20
|
+
},
|
|
21
|
+
selects: {
|
|
22
|
+
maxOptions: 25,
|
|
23
|
+
maxLabelLength: 100,
|
|
24
|
+
maxValueBytes: 100
|
|
25
|
+
},
|
|
26
|
+
text: {
|
|
27
|
+
maxLength: DISCORD_TEXT_DISPLAY_LIMIT - Array.from("-# ").length,
|
|
28
|
+
encoding: "characters",
|
|
29
|
+
markdownDialect: "discord-markdown"
|
|
30
|
+
}
|
|
31
|
+
}
|
|
32
|
+
};
|
|
33
|
+
const loadDiscordComponentSend = createLazyRuntimeNamedExport(() => import("./send.components-BaXQJKWT.js").then((n) => n.i), "sendDiscordComponentMessage");
|
|
34
|
+
async function sendDiscordComponentMessageLazy(...args) {
|
|
35
|
+
return await (await loadDiscordComponentSend())(...args);
|
|
36
|
+
}
|
|
37
|
+
const loadDiscordSharedInteractive = createLazyRuntimeModule(() => import("./components-BVrfRS-F.js").then((n) => n.a));
|
|
38
|
+
function addPayloadTextFallback(spec, payload) {
|
|
39
|
+
return spec.text ? spec : {
|
|
40
|
+
...spec,
|
|
41
|
+
text: payload.text?.trim() ? payload.text : void 0
|
|
42
|
+
};
|
|
43
|
+
}
|
|
44
|
+
function countDiscordComponentBlock(block) {
|
|
45
|
+
if (block.type === "section") return 1 + (block.texts?.length ? block.texts.length : block.text ? 1 : 0) + (block.accessory ? 1 : 0);
|
|
46
|
+
if (block.type === "actions") return 1 + (block.buttons?.length ?? (block.select ? 1 : 0));
|
|
47
|
+
return 1;
|
|
48
|
+
}
|
|
49
|
+
function countDiscordMessageComponents(params) {
|
|
50
|
+
const blocks = params.spec.blocks ?? [];
|
|
51
|
+
let count = 1 + (params.spec.text ? 1 : 0);
|
|
52
|
+
for (const block of blocks) count += countDiscordComponentBlock(block);
|
|
53
|
+
if (params.spec.modal) {
|
|
54
|
+
const lastBlock = blocks.at(-1);
|
|
55
|
+
const triggerFitsLastRow = lastBlock?.type === "actions" && !lastBlock.select && (lastBlock.buttons?.length ?? 0) < 5;
|
|
56
|
+
count += triggerFitsLastRow ? 1 : 2;
|
|
57
|
+
}
|
|
58
|
+
const hasFileBlock = blocks.some((block) => block.type === "file");
|
|
59
|
+
if (params.includesMedia && !hasFileBlock) count += 1;
|
|
60
|
+
return count;
|
|
61
|
+
}
|
|
62
|
+
function isDiscordComponentSpecWithinMessageLimit(params) {
|
|
63
|
+
const countedSpec = addPayloadTextFallback(params.spec, { text: params.fallbackText });
|
|
64
|
+
if (countedSpec.text && Array.from(countedSpec.text).length > DISCORD_TEXT_DISPLAY_LIMIT) return false;
|
|
65
|
+
return countDiscordMessageComponents({
|
|
66
|
+
spec: countedSpec,
|
|
67
|
+
includesMedia: params.includesMedia === true
|
|
68
|
+
}) <= DISCORD_MESSAGE_COMPONENT_LIMIT;
|
|
69
|
+
}
|
|
70
|
+
async function buildDiscordPresentationPayload(params) {
|
|
71
|
+
const componentSpec = (await loadDiscordSharedInteractive()).buildDiscordPresentationComponents(params.presentation);
|
|
72
|
+
if (!componentSpec) return null;
|
|
73
|
+
const includesMedia = Boolean(params.payload.mediaUrl || params.payload.mediaUrls?.some((mediaUrl) => mediaUrl));
|
|
74
|
+
if (!isDiscordComponentSpecWithinMessageLimit({
|
|
75
|
+
spec: componentSpec,
|
|
76
|
+
fallbackText: params.payload.text,
|
|
77
|
+
includesMedia
|
|
78
|
+
})) return null;
|
|
79
|
+
return {
|
|
80
|
+
...params.payload,
|
|
81
|
+
channelData: {
|
|
82
|
+
...params.payload.channelData,
|
|
83
|
+
discord: {
|
|
84
|
+
...params.payload.channelData?.discord,
|
|
85
|
+
presentationComponents: componentSpec
|
|
86
|
+
}
|
|
87
|
+
}
|
|
88
|
+
};
|
|
89
|
+
}
|
|
90
|
+
async function resolveDiscordComponentSpec(payload) {
|
|
91
|
+
const discordData = payload.channelData?.discord;
|
|
92
|
+
const rawComponentSpec = discordData?.presentationComponents ?? (discordData?.components && typeof discordData.components === "object" && !Array.isArray(discordData.components) ? readDiscordComponentSpec(discordData.components) : null);
|
|
93
|
+
if (rawComponentSpec) return addPayloadTextFallback(rawComponentSpec, payload);
|
|
94
|
+
if (!payload.interactive) return;
|
|
95
|
+
const interactiveSpec = (await loadDiscordSharedInteractive()).buildDiscordInteractiveComponents(payload.interactive);
|
|
96
|
+
return interactiveSpec ? addPayloadTextFallback(interactiveSpec, payload) : void 0;
|
|
97
|
+
}
|
|
98
|
+
//#endregion
|
|
99
|
+
export { sendDiscordComponentMessageLazy as a, resolveDiscordComponentSpec as i, buildDiscordPresentationPayload as n, isDiscordComponentSpecWithinMessageLimit as r, DISCORD_PRESENTATION_CAPABILITIES as t };
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
import { Xt as __exportAll } from "./send.receipt-aegk69an.js";
|
|
2
|
+
import { resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
3
|
+
import { readProviderJsonResponse, readResponseTextLimited } from "openclaw/plugin-sdk/provider-http";
|
|
4
|
+
import { buildTimeoutAbortSignal } from "openclaw/plugin-sdk/extension-shared";
|
|
5
|
+
//#region extensions/discord/src/pluralkit.ts
|
|
6
|
+
var pluralkit_exports = /* @__PURE__ */ __exportAll({ fetchPluralKitMessageInfo: () => fetchPluralKitMessageInfo });
|
|
7
|
+
const PLURALKIT_API_BASE = "https://api.pluralkit.me/v2";
|
|
8
|
+
const PLURALKIT_ERROR_BODY_LIMIT_BYTES = 8 * 1024;
|
|
9
|
+
const PLURALKIT_LOOKUP_TIMEOUT_MS = 1e4;
|
|
10
|
+
async function fetchPluralKitMessageInfo(params) {
|
|
11
|
+
if (!params.config?.enabled) return null;
|
|
12
|
+
const fetchImpl = resolveFetch(params.fetcher);
|
|
13
|
+
if (!fetchImpl) return null;
|
|
14
|
+
const headers = {};
|
|
15
|
+
if (params.config.token?.trim()) headers.Authorization = params.config.token.trim();
|
|
16
|
+
const url = `${PLURALKIT_API_BASE}/messages/${params.messageId}`;
|
|
17
|
+
const timeout = buildTimeoutAbortSignal({
|
|
18
|
+
signal: params.signal,
|
|
19
|
+
timeoutMs: PLURALKIT_LOOKUP_TIMEOUT_MS,
|
|
20
|
+
operation: "discord.pluralkit.lookup",
|
|
21
|
+
url
|
|
22
|
+
});
|
|
23
|
+
try {
|
|
24
|
+
const res = await fetchImpl(url, {
|
|
25
|
+
headers,
|
|
26
|
+
signal: timeout.signal
|
|
27
|
+
});
|
|
28
|
+
if (res.status === 404) return null;
|
|
29
|
+
if (!res.ok) {
|
|
30
|
+
const text = await readResponseTextLimited(res, PLURALKIT_ERROR_BODY_LIMIT_BYTES).catch(() => "");
|
|
31
|
+
const detail = text.trim() ? `: ${text.trim()}` : "";
|
|
32
|
+
throw new Error(`PluralKit API failed (${res.status})${detail}`);
|
|
33
|
+
}
|
|
34
|
+
return await readProviderJsonResponse(res, "PluralKit message");
|
|
35
|
+
} finally {
|
|
36
|
+
timeout.cleanup();
|
|
37
|
+
}
|
|
38
|
+
}
|
|
39
|
+
//#endregion
|
|
40
|
+
export { pluralkit_exports as n, fetchPluralKitMessageInfo as t };
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { p as normalizeDiscordToken } from "./accounts-P19jm1lf.js";
|
|
2
|
-
import { n as
|
|
2
|
+
import { n as DiscordApiError, r as fetchDiscord } from "./api--f62GFaS.js";
|
|
3
3
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
4
4
|
import { resolveFetch } from "openclaw/plugin-sdk/fetch-runtime";
|
|
5
5
|
import { readProviderJsonResponse } from "openclaw/plugin-sdk/provider-http";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as resolveDiscordPrivilegedIntentsFromFlags, i as probeDiscord, n as fetchDiscordApplicationSummary, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-
|
|
1
|
+
import { a as resolveDiscordPrivilegedIntentsFromFlags, i as probeDiscord, n as fetchDiscordApplicationSummary, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-DxjMBeVG.js";
|
|
2
2
|
export { fetchDiscordApplicationId, fetchDiscordApplicationSummary, parseApplicationIdFromToken, probeDiscord, resolveDiscordPrivilegedIntentsFromFlags };
|