@openclaw/discord 2026.11.3 → 2026.11.5-beta.2
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/.setup/{account-inspect-8cCu6uPG.mjs → account-inspect-DGkdWwix.mjs} +1 -1
- package/dist/.setup/{accounts-ljrzXBJi.mjs → accounts-C_25wyxC.mjs} +9 -6
- package/dist/.setup/{active-turn-thread-route-C4tp9noA.mjs → active-turn-thread-route-KvRTAVE3.mjs} +1 -2
- package/dist/.setup/{allow-list-BKqOldGy.mjs → allow-list-BXrS8-R9.mjs} +4 -152
- package/dist/.setup/{api-DqmMUZau.mjs → api-BlBD4ism.mjs} +10 -20
- package/dist/.setup/{approval-handler.runtime-D0qu1um7.mjs → approval-handler.runtime-BGYjX1t9.mjs} +80 -61
- package/dist/.setup/{approval-message-updates-CdurC9Ej.mjs → approval-message-updates-DKsCfxSW.mjs} +2 -2
- package/dist/.setup/{audit-ChorIwio.mjs → audit-5b-FXj9R.mjs} +4 -4
- package/dist/.setup/{channel-ZilgdF5e.mjs → channel-CWwTHWFo.mjs} +134 -202
- package/dist/.setup/channel-access-9cyzozUP.mjs +24 -0
- package/dist/.setup/channel.setup-B3MtmBQG.mjs +238 -0
- package/dist/.setup/{components-Du9NhD8h.mjs → components-YCvQ6YLS.mjs} +209 -430
- package/dist/.setup/components.base-CiS0h_XP.mjs +32 -0
- package/dist/.setup/{config-schema-_uBILpQf.mjs → config-schema-BNKN1cu5.mjs} +6 -7
- package/dist/.setup/{conversation-binding-route-8Ul1KpGF.mjs → conversation-binding-route-kCTw8cij.mjs} +2 -2
- package/dist/.setup/{directory-config-3iVub-3m.mjs → directory-config-Ble81PWH.mjs} +1 -1
- package/dist/.setup/{directory-live-BDVl2DoC.mjs → directory-live-DH3tpS3x.mjs} +52 -57
- package/dist/.setup/{discord-BMD-JiVS.mjs → discord-DGVSguhx.mjs} +1124 -1710
- package/dist/.setup/{doctor-hQKbkNKq.mjs → doctor-eujgbnpZ.mjs} +3 -5
- package/dist/.setup/endpoint-runtime-lf4DeLas.mjs +139 -0
- package/dist/.setup/guilds-eDq22iSM.mjs +22 -0
- package/dist/.setup/{handle-action-B1lmt4ms.mjs → handle-action-CktwmzMz.mjs} +15 -15
- package/dist/.setup/{handle-action.guild-admin-B6g31cwt.mjs → handle-action.guild-admin-WLQ7fRqI.mjs} +5 -5
- package/dist/.setup/listeners-Df8lx3vK.mjs +47 -0
- package/dist/.setup/{live-policy-config-C_Q966Wh.mjs → live-policy-config-DiBVuaU6.mjs} +2 -3
- package/dist/.setup/{message-handler-CkI3yMjL.mjs → message-handler-hhNSioxo.mjs} +154 -115
- package/dist/.setup/{message-handler.preflight-CEfkFV9U.mjs → message-handler.preflight-BZcZE1o-.mjs} +30 -105
- package/dist/.setup/{message-handler.preflight-pluralkit-D5si80_L.mjs → message-handler.preflight-pluralkit-CYZfXXb6.mjs} +9 -22
- package/dist/.setup/{message-handler.process-DsMtetRf.mjs → message-handler.process-B0n-mQ99.mjs} +256 -373
- package/dist/.setup/outbound-payload-BaZmjewa.mjs +447 -0
- package/dist/.setup/{outbound-session-route-BtUpGBTb.mjs → outbound-session-route-Cgx4i9cS.mjs} +139 -86
- package/dist/.setup/{preflight-audio-wWgsZG5F.mjs → preflight-audio-C6QtD6HX.mjs} +1 -5
- package/dist/.setup/{presence-cache-DCeTsL73.mjs → presence-cache-Dq-3nH7R.mjs} +1 -6
- package/dist/.setup/{probe-CBaoCs-c.mjs → probe-DezB-6xz.mjs} +5 -9
- package/dist/.setup/{provider-CI_OLfvz.mjs → provider-BN2bCIUp.mjs} +3440 -4308
- package/dist/.setup/{provider-session.runtime-TWOo_JZx.mjs → provider-session.runtime-Dr_5X43t.mjs} +3 -3
- package/dist/.setup/provider.runtime-BuJpl0Pv.mjs +1 -0
- package/dist/.setup/proxy-fetch-BzXwBAXt.mjs +30 -0
- package/dist/.setup/{realtime-session.runtime-DvfS4vJj.mjs → realtime-session.runtime-BTDWsV4d.mjs} +44 -81
- package/dist/.setup/{receive-recovery-CKvaG2Hf.mjs → receive-recovery-C3Ks4wAQ.mjs} +13 -27
- package/dist/.setup/{resolve-allowlist-common-cIjtqh2F.mjs → resolve-allowlist-common-Bk8Fj6Ik.mjs} +3 -13
- package/dist/.setup/{resolve-channels-Cj5i7hzj.mjs → resolve-channels-Bp8frXvc.mjs} +7 -8
- package/dist/.setup/{resolve-users-BQLbysRB.mjs → resolve-users-Cvcj22sG.mjs} +4 -7
- package/dist/.setup/{runtime-RWnuJgWB.mjs → runtime-BJaCvlmq.mjs} +196 -239
- package/dist/.setup/{runtime-plifsKg9.mjs → runtime-BMgTyuwg.mjs} +6 -6
- package/dist/.setup/{secret-config-contract-z6FhbT8E.mjs → secret-config-contract-B1kE4sDv.mjs} +4 -9
- package/dist/.setup/{send-da6ENJ9f.mjs → send-CVW7V-VZ.mjs} +149 -175
- package/dist/.setup/{send.components-CWZUuGvA.mjs → send.components-C8YXdnO_.mjs} +59 -71
- package/dist/.setup/{send.outbound-qZ3iK3Vq.mjs → send.outbound-Uzcmh3Yd.mjs} +76 -129
- package/dist/.setup/{send.receipt-C18khRYH.mjs → send.receipt-NZDOTZBU.mjs} +30 -32
- package/dist/.setup/{send.shared-CnlMgoqQ.mjs → send.shared-a_6Oeyg1.mjs} +38 -115
- package/dist/.setup/{sender-identity-DgbJykq0.mjs → sender-identity-76HFb8eK.mjs} +3 -9
- package/dist/.setup/setup-plugin-api-BExhGEhL.mjs +2 -0
- package/dist/.setup/shared-interactive-DmzaoKOM.mjs +316 -0
- package/dist/.setup/{shared-CY5vJM48.mjs → shared-yDUSExm2.mjs} +8 -11
- package/dist/.setup/{subagent-hooks-CIu2TFz3.mjs → subagent-hooks-CDkdHQyy.mjs} +1 -1
- package/dist/.setup/{system-events-DCOLXkwS.mjs → system-events-yfWz150v.mjs} +2 -2
- package/dist/.setup/{target-resolver-CApivu3G.mjs → target-resolver-BOOzqxxM.mjs} +3 -3
- package/dist/.setup/{thread-bindings-DcvT_JgI.mjs → thread-bindings-zce4cpu_.mjs} +12 -20
- package/dist/.setup/{thread-bindings.manager-5Sh7yedN.mjs → thread-bindings.manager-NywKzUtc.mjs} +22 -42
- package/dist/.setup/{thread-bindings.session-updates-BMdJeJMc.mjs → thread-bindings.session-updates-D0j7oh8S.mjs} +11 -18
- package/dist/.setup/{threading-CzjFeUSe.mjs → threading-DodLYDt-.mjs} +68 -105
- package/dist/.setup/{timeouts-CuNARfyw.mjs → timeouts-cIxzatmv.mjs} +1 -1
- package/dist/.setup/{transcripts-source-8RDQrSVb.mjs → transcripts-source-ie9GBWaU.mjs} +110 -179
- package/dist/.setup/{voice-runtime-BsDILmAv.mjs → voice-runtime-B7V_LTdX.mjs} +231 -452
- package/dist/.source-module-urls/d6c089460280c5a04184542d6712e04545caeb1ebb290d3504377b4cc5e22fea.json +1 -0
- package/dist/account-inspect-api.js +1 -1
- package/dist/action-runtime-api.js +1 -2
- package/dist/activities-api.js +286 -341
- package/dist/api.js +16 -16
- package/dist/channel-config-api.js +1 -2
- package/dist/channel-plugin-api.js +1 -2
- package/dist/contract-api.js +1 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/runtime-api.js +22 -22
- package/dist/runtime-setter-api.js +1 -2
- package/dist/secret-contract-api.js +1 -2
- package/dist/security-audit-contract-api.js +1 -2
- package/dist/security-contract-api.js +1 -2
- package/dist/session-key-api.js +1 -2
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -2
- package/dist/src/voice/audio-worker.runtime.js +56 -68
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/thread-binding-api.js +1 -2
- package/dist/transcripts-source-api.js +1 -1
- package/node_modules/@napi-rs/wasm-runtime/dist/fs.js +3339 -4021
- package/node_modules/@napi-rs/wasm-runtime/package.json +1 -1
- package/node_modules/@types/lodash/README.md +1 -1
- package/node_modules/@types/lodash/common/function.d.ts +2 -2
- package/node_modules/@types/lodash/package.json +2 -2
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/util.d.ts +6 -3
- package/node_modules/discord-api-types/package.json +4 -4
- package/node_modules/discord-api-types/rest/v10/index.d.ts +8 -0
- package/node_modules/discord-api-types/rest/v10/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v10/index.js +8 -0
- package/node_modules/discord-api-types/rest/v10/index.js.map +1 -1
- package/node_modules/discord-api-types/rest/v10/oauth2.d.ts +26 -2
- package/node_modules/discord-api-types/rest/v10/oauth2.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/index.d.ts +8 -0
- package/node_modules/discord-api-types/rest/v9/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/index.js +8 -0
- package/node_modules/discord-api-types/rest/v9/index.js.map +1 -1
- package/node_modules/discord-api-types/rest/v9/oauth2.d.ts +26 -2
- package/node_modules/discord-api-types/rest/v9/oauth2.d.ts.map +1 -1
- package/node_modules/typebox/build/format/duration.d.mts +2 -2
- package/node_modules/typebox/build/format/duration.mjs +2 -2
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_email.mjs +1 -0
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
- package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
- package/node_modules/typebox/build/format/ipv4.mjs +2 -2
- package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
- package/node_modules/typebox/build/format/ipv6.mjs +1 -1
- package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
- package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
- package/node_modules/typebox/build/schema/build.mjs +1 -0
- package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
- package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
- package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
- package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
- package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
- package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
- package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
- package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
- package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
- package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
- package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
- package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
- package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
- package/node_modules/typebox/build/system/memory/create.mjs +18 -13
- package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
- package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
- package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
- package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
- package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
- package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
- package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
- package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
- package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
- package/node_modules/typebox/build/system/memory/update.mjs +43 -16
- package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
- package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
- package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
- package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
- package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
- package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
- package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
- package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
- package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
- package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
- package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
- package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
- package/node_modules/typebox/package.json +1 -1
- package/node_modules/typebox/readme.md +1 -1
- package/node_modules/undici/docs/docs/api/Interceptors.md +15 -2
- package/node_modules/undici/lib/dispatcher/client-h2.js +78 -3
- package/node_modules/undici/lib/dispatcher/pool-base.js +20 -3
- package/node_modules/undici/package.json +3 -3
- package/node_modules/undici/types/api.d.ts +1 -1
- package/node_modules/undici/types/utility.d.ts +4 -4
- package/node_modules/uuid/package.json +17 -17
- package/node_modules/zod/package.json +1 -1
- package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
- package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
- package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
- package/node_modules/zod/src/v4/core/compile.ts +9 -0
- package/node_modules/zod/src/v4/core/schemas.ts +35 -1
- package/node_modules/zod/src/v4/core/util.ts +13 -0
- package/node_modules/zod/src/v4/core/versions.ts +1 -1
- package/node_modules/zod/v4/core/compile.cjs +8 -0
- package/node_modules/zod/v4/core/compile.js +8 -0
- package/node_modules/zod/v4/core/schemas.cjs +30 -0
- package/node_modules/zod/v4/core/schemas.d.cts +3 -1
- package/node_modules/zod/v4/core/schemas.d.ts +3 -1
- package/node_modules/zod/v4/core/schemas.js +30 -0
- package/node_modules/zod/v4/core/util.cjs +15 -0
- package/node_modules/zod/v4/core/util.d.cts +2 -0
- package/node_modules/zod/v4/core/util.d.ts +2 -0
- package/node_modules/zod/v4/core/util.js +14 -0
- package/node_modules/zod/v4/core/versions.cjs +1 -1
- package/node_modules/zod/v4/core/versions.js +1 -1
- package/openclaw.plugin.json +1 -31
- package/package.json +8 -8
- package/dist/.setup/channel-access-DasWY_OV.mjs +0 -48
- package/dist/.setup/channel.setup-DaDQdctj.mjs +0 -249
- package/dist/.setup/outbound-adapter-DfAanoCO.mjs +0 -543
- package/dist/.setup/provider.runtime-DnionCyo.mjs +0 -2
- package/dist/.setup/setup-plugin-api-D1QuM187.mjs +0 -3
- package/dist/.setup/targets-UWWZ6gF7.mjs +0 -3
- package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
- package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
|
@@ -1,19 +1,20 @@
|
|
|
1
|
-
import { l as resolveDiscordAccount, o as listEnabledDiscordAccounts, u as resolveDiscordAccountAllowFrom } from "./accounts-
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
1
|
+
import { l as resolveDiscordAccount, o as listEnabledDiscordAccounts, u as resolveDiscordAccountAllowFrom } from "./accounts-C_25wyxC.mjs";
|
|
2
|
+
import { k as getChannelMessage, t as discord_exports, z as DiscordError } from "./discord-DGVSguhx.mjs";
|
|
3
|
+
import { f as resolveDiscordGuildEntry, i as normalizeDiscordAllowList, l as resolveDiscordChannelConfigWithFallback, n as hasConfiguredDiscordChannels, o as normalizeDiscordSlug, p as resolveDiscordMemberAccessState, r as isDiscordGroupAllowedByPolicy, t as allowListMatches, w as isDiscordThreadChannelType } from "./allow-list-BXrS8-R9.mjs";
|
|
4
|
+
import { i as resolveDiscordEndpointMediaGuard, n as getDiscordEndpointRuntime } from "./endpoint-runtime-lf4DeLas.mjs";
|
|
5
|
+
import { l as withAbortTimeout } from "./timeouts-cIxzatmv.mjs";
|
|
5
6
|
import { t as resolveDiscordCommandOwnerAllowFrom } from "./command-owners-C7rUdqUX.mjs";
|
|
6
|
-
import {
|
|
7
|
+
import { t as resolveDiscordChannelInfoSafe } from "./channel-access-9cyzozUP.mjs";
|
|
7
8
|
import { createSubsystemLogger, getChildLogger, logVerbose } from "openclaw/plugin-sdk/runtime-env";
|
|
8
9
|
import { DEFAULT_ACCOUNT_ID, normalizeAccountId } from "openclaw/plugin-sdk/account-id";
|
|
9
10
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId, summarizeStringEntries, uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
10
11
|
import { ComponentType, StickerFormatType } from "discord-api-types/v10";
|
|
11
|
-
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
12
12
|
import { saveRemoteMedia } from "openclaw/plugin-sdk/media-runtime";
|
|
13
13
|
import { formatErrorMessage } from "openclaw/plugin-sdk/ssrf-runtime";
|
|
14
14
|
import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
|
|
15
|
-
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
16
15
|
import { createReplyReferencePlanner } from "openclaw/plugin-sdk/reply-reference";
|
|
16
|
+
import { pruneMapToMaxSize } from "openclaw/plugin-sdk/collection-runtime";
|
|
17
|
+
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
17
18
|
import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
18
19
|
import { getFileExtension, normalizeMimeType } from "openclaw/plugin-sdk/media-mime";
|
|
19
20
|
import { formatMediaPlaceholderText } from "openclaw/plugin-sdk/channel-inbound";
|
|
@@ -36,12 +37,11 @@ function normalizeDiscordChannelId(value) {
|
|
|
36
37
|
return normalizeOptionalStringifiedId(value) ?? "";
|
|
37
38
|
}
|
|
38
39
|
function resolveDiscordMessageChannelId(params) {
|
|
39
|
-
|
|
40
|
-
return normalizeDiscordChannelId(message.channelId) || normalizeDiscordChannelId(message.channel_id) || normalizeDiscordChannelId(message.rawData?.channel_id) || normalizeDiscordChannelId(params.eventChannelId);
|
|
40
|
+
return normalizeDiscordChannelId(params.message.channelId) || normalizeDiscordChannelId(params.eventChannelId);
|
|
41
41
|
}
|
|
42
|
-
function buildDiscordChannelInfo(channel
|
|
42
|
+
function buildDiscordChannelInfo(channel) {
|
|
43
43
|
const info = resolveDiscordChannelInfoSafe(channel);
|
|
44
|
-
const type = info.type
|
|
44
|
+
const type = info.type;
|
|
45
45
|
return type === void 0 ? null : {
|
|
46
46
|
type,
|
|
47
47
|
name: info.name,
|
|
@@ -63,7 +63,7 @@ async function resolveDiscordChannelInfo(client, channelId) {
|
|
|
63
63
|
cacheDiscordChannelInfo(channelId, null, DISCORD_CHANNEL_INFO_NEGATIVE_CACHE_TTL_MS, now);
|
|
64
64
|
return null;
|
|
65
65
|
}
|
|
66
|
-
const payload = buildDiscordChannelInfo(channel
|
|
66
|
+
const payload = buildDiscordChannelInfo(channel);
|
|
67
67
|
if (!payload) return null;
|
|
68
68
|
cacheDiscordChannelInfo(channelId, payload, DISCORD_CHANNEL_INFO_CACHE_TTL_MS, now);
|
|
69
69
|
return payload;
|
|
@@ -81,22 +81,16 @@ function normalizeDiscordStickerItems(value) {
|
|
|
81
81
|
return value.filter((entry) => Boolean(entry) && typeof entry === "object" && typeof entry.id === "string" && typeof entry.name === "string");
|
|
82
82
|
}
|
|
83
83
|
function resolveDiscordMessageStickers(message) {
|
|
84
|
-
const
|
|
85
|
-
const normalized = normalizeDiscordStickerItems(stickers);
|
|
84
|
+
const normalized = normalizeDiscordStickerItems(message.stickers);
|
|
86
85
|
if (normalized.length > 0) return normalized;
|
|
87
86
|
const rawData = message.rawData;
|
|
88
|
-
return normalizeDiscordStickerItems(rawData?.sticker_items ?? rawData?.stickers);
|
|
89
|
-
}
|
|
90
|
-
function resolveDiscordSnapshotStickers(snapshot) {
|
|
91
|
-
const stickers = normalizeDiscordStickerItems(snapshot.stickers);
|
|
92
|
-
return stickers.length > 0 ? stickers : normalizeDiscordStickerItems(snapshot.sticker_items);
|
|
87
|
+
return normalizeDiscordStickerItems(message.sticker_items ?? rawData?.sticker_items ?? rawData?.stickers);
|
|
93
88
|
}
|
|
94
89
|
function hasDiscordMessageStickers(message) {
|
|
95
90
|
return resolveDiscordMessageStickers(message).length > 0;
|
|
96
91
|
}
|
|
97
92
|
function resolveDiscordMessageSnapshots(message) {
|
|
98
|
-
|
|
99
|
-
return normalizeDiscordMessageSnapshots(rawData?.message_snapshots ?? message.message_snapshots ?? message.messageSnapshots);
|
|
93
|
+
return normalizeDiscordMessageSnapshots(message.rawData?.message_snapshots);
|
|
100
94
|
}
|
|
101
95
|
function normalizeDiscordMessageSnapshots(snapshots) {
|
|
102
96
|
if (!Array.isArray(snapshots)) return [];
|
|
@@ -117,10 +111,10 @@ function resolveDiscordReferencedReplyMessageId(message) {
|
|
|
117
111
|
}
|
|
118
112
|
function formatDiscordSnapshotAuthor(author) {
|
|
119
113
|
if (!author) return;
|
|
120
|
-
const globalName = normalizeOptionalString(author.global_name)
|
|
121
|
-
const username = normalizeOptionalString(author.username)
|
|
122
|
-
const name = normalizeOptionalString(author.name)
|
|
123
|
-
const discriminator = normalizeOptionalString(author.discriminator)
|
|
114
|
+
const globalName = normalizeOptionalString(author.global_name);
|
|
115
|
+
const username = normalizeOptionalString(author.username);
|
|
116
|
+
const name = normalizeOptionalString(author.name);
|
|
117
|
+
const discriminator = normalizeOptionalString(author.discriminator);
|
|
124
118
|
const base = globalName || username || name || author.id;
|
|
125
119
|
if (username && discriminator && discriminator !== "0") return `@${username}#${discriminator}`;
|
|
126
120
|
return base ? `@${base}` : void 0;
|
|
@@ -140,16 +134,17 @@ function mergeHostnameList(...lists) {
|
|
|
140
134
|
const merged = lists.flatMap((list) => list ?? []).map((value) => value.trim()).filter((value) => value.length > 0);
|
|
141
135
|
return merged.length > 0 ? uniqueStrings(merged) : void 0;
|
|
142
136
|
}
|
|
143
|
-
/**
|
|
137
|
+
/** Merges caller network policy with the Discord-owned CDN allowlist. */
|
|
144
138
|
function resolveDiscordCdnPolicy(policy) {
|
|
145
139
|
if (!policy) return DISCORD_MEDIA_SSRF_POLICY;
|
|
140
|
+
const hostnameAllowlist = mergeHostnameList(DISCORD_MEDIA_SSRF_POLICY.hostnameAllowlist, policy.hostnameAllowlist);
|
|
141
|
+
const allowedHostnames = mergeHostnameList(DISCORD_MEDIA_SSRF_POLICY.allowedHostnames, policy.allowedHostnames);
|
|
146
142
|
return {
|
|
147
143
|
...DISCORD_MEDIA_SSRF_POLICY,
|
|
148
|
-
|
|
149
|
-
allowedHostnames:
|
|
150
|
-
|
|
151
|
-
|
|
152
|
-
allowIpv6UniqueLocalRange: policy.allowIpv6UniqueLocalRange
|
|
144
|
+
...policy,
|
|
145
|
+
...allowedHostnames ? { allowedHostnames } : {},
|
|
146
|
+
...hostnameAllowlist ? { hostnameAllowlist } : {},
|
|
147
|
+
allowRfc2544BenchmarkRange: Boolean(DISCORD_MEDIA_SSRF_POLICY.allowRfc2544BenchmarkRange) || Boolean(policy.allowRfc2544BenchmarkRange)
|
|
153
148
|
};
|
|
154
149
|
}
|
|
155
150
|
//#endregion
|
|
@@ -197,16 +192,64 @@ function resolveDiscordMediaClassification(params) {
|
|
|
197
192
|
};
|
|
198
193
|
}
|
|
199
194
|
async function resolveMessageMedia(message, operation, errorPrefix) {
|
|
200
|
-
|
|
201
|
-
|
|
202
|
-
|
|
203
|
-
|
|
204
|
-
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
209
|
-
|
|
195
|
+
const attachmentErrorPrefix = `${errorPrefix} attachment`;
|
|
196
|
+
for (const attachment of message.attachments ?? []) {
|
|
197
|
+
const attachmentUrl = normalizeOptionalString(attachment.url);
|
|
198
|
+
if (!attachmentUrl) {
|
|
199
|
+
logVerbose(`${attachmentErrorPrefix} ${attachment.id ?? "attachment"}: missing url`);
|
|
200
|
+
operation.out.push(resolveDiscordMediaClassification({ attachment }));
|
|
201
|
+
continue;
|
|
202
|
+
}
|
|
203
|
+
try {
|
|
204
|
+
const saved = await fetchDiscordMedia(operation, {
|
|
205
|
+
url: attachmentUrl,
|
|
206
|
+
filePathHint: attachment.filename ?? attachmentUrl,
|
|
207
|
+
fallbackContentType: attachment.content_type,
|
|
208
|
+
originalFilename: attachment.filename
|
|
209
|
+
});
|
|
210
|
+
const classification = resolveDiscordMediaClassification({
|
|
211
|
+
attachment,
|
|
212
|
+
fetchedContentType: saved.contentType
|
|
213
|
+
});
|
|
214
|
+
operation.out.push({
|
|
215
|
+
path: saved.path,
|
|
216
|
+
fileName: attachment.filename,
|
|
217
|
+
...classification
|
|
218
|
+
});
|
|
219
|
+
} catch {
|
|
220
|
+
const id = attachment.id ?? "attachment";
|
|
221
|
+
getChildLogger({ module: "discord-media" }).warn(`${attachmentErrorPrefix} ${id}`);
|
|
222
|
+
operation.out.push(resolveDiscordMediaClassification({ attachment }));
|
|
223
|
+
}
|
|
224
|
+
}
|
|
225
|
+
const stickerErrorPrefix = `${errorPrefix} sticker`;
|
|
226
|
+
for (const sticker of resolveDiscordMessageStickers(message) ?? []) {
|
|
227
|
+
const candidates = resolveStickerAssetCandidates(sticker);
|
|
228
|
+
let downloaded = false;
|
|
229
|
+
for (const candidate of candidates) try {
|
|
230
|
+
const saved = await fetchDiscordMedia(operation, {
|
|
231
|
+
url: candidate.url,
|
|
232
|
+
filePathHint: candidate.fileName,
|
|
233
|
+
fallbackContentType: inferStickerContentType(sticker),
|
|
234
|
+
originalFilename: candidate.fileName
|
|
235
|
+
});
|
|
236
|
+
operation.out.push({
|
|
237
|
+
path: saved.path,
|
|
238
|
+
contentType: saved.contentType,
|
|
239
|
+
fileName: candidate.fileName,
|
|
240
|
+
kind: "sticker"
|
|
241
|
+
});
|
|
242
|
+
downloaded = true;
|
|
243
|
+
break;
|
|
244
|
+
} catch {}
|
|
245
|
+
if (!downloaded) {
|
|
246
|
+
getChildLogger({ module: "discord-media" }).warn(`${stickerErrorPrefix} ${sticker.id}`);
|
|
247
|
+
operation.out.push({
|
|
248
|
+
contentType: inferStickerContentType(sticker),
|
|
249
|
+
kind: "sticker"
|
|
250
|
+
});
|
|
251
|
+
}
|
|
252
|
+
}
|
|
210
253
|
return operation.out;
|
|
211
254
|
}
|
|
212
255
|
async function resolveMediaList(message, maxBytes, options) {
|
|
@@ -216,18 +259,7 @@ async function resolveForwardedMediaList(message, maxBytes, options) {
|
|
|
216
259
|
const snapshots = resolveDiscordMessageSnapshots(message);
|
|
217
260
|
const operation = createDiscordMediaOperation(maxBytes, options);
|
|
218
261
|
if (snapshots.length > 0) {
|
|
219
|
-
for (const snapshot of snapshots) {
|
|
220
|
-
await appendResolvedMediaFromAttachments({
|
|
221
|
-
...operation,
|
|
222
|
-
attachments: snapshot.message?.attachments,
|
|
223
|
-
errorPrefix: "discord: failed to download forwarded attachment"
|
|
224
|
-
});
|
|
225
|
-
await appendResolvedMediaFromStickers({
|
|
226
|
-
...operation,
|
|
227
|
-
stickers: snapshot.message ? resolveDiscordSnapshotStickers(snapshot.message) : [],
|
|
228
|
-
errorPrefix: "discord: failed to download forwarded sticker"
|
|
229
|
-
});
|
|
230
|
-
}
|
|
262
|
+
for (const snapshot of snapshots) await resolveMessageMedia(snapshot.message ?? {}, operation, "discord: failed to download forwarded");
|
|
231
263
|
return operation.out;
|
|
232
264
|
}
|
|
233
265
|
const referencedForward = resolveDiscordReferencedForwardMessage(message);
|
|
@@ -254,37 +286,6 @@ async function fetchDiscordMedia(operation, params) {
|
|
|
254
286
|
run: (signal) => save(operation.abortSignal ? AbortSignal.any([operation.abortSignal, signal]) : signal)
|
|
255
287
|
}) : save(operation.abortSignal);
|
|
256
288
|
}
|
|
257
|
-
async function appendResolvedMediaFromAttachments(params) {
|
|
258
|
-
for (const attachment of params.attachments ?? []) {
|
|
259
|
-
const attachmentUrl = normalizeOptionalString(attachment.url);
|
|
260
|
-
if (!attachmentUrl) {
|
|
261
|
-
logVerbose(`${params.errorPrefix} ${attachment.id ?? attachment.filename ?? "attachment"}: missing url`);
|
|
262
|
-
params.out.push(resolveDiscordMediaClassification({ attachment }));
|
|
263
|
-
continue;
|
|
264
|
-
}
|
|
265
|
-
try {
|
|
266
|
-
const saved = await fetchDiscordMedia(params, {
|
|
267
|
-
url: attachmentUrl,
|
|
268
|
-
filePathHint: attachment.filename ?? attachmentUrl,
|
|
269
|
-
fallbackContentType: attachment.content_type,
|
|
270
|
-
originalFilename: attachment.filename
|
|
271
|
-
});
|
|
272
|
-
const classification = resolveDiscordMediaClassification({
|
|
273
|
-
attachment,
|
|
274
|
-
fetchedContentType: saved.contentType
|
|
275
|
-
});
|
|
276
|
-
params.out.push({
|
|
277
|
-
path: saved.path,
|
|
278
|
-
fileName: attachment.filename,
|
|
279
|
-
...classification
|
|
280
|
-
});
|
|
281
|
-
} catch (err) {
|
|
282
|
-
const id = attachment.id ?? attachmentUrl;
|
|
283
|
-
getChildLogger({ module: "discord-media" }).warn(`${params.errorPrefix} ${id}: ${String(err)}`);
|
|
284
|
-
params.out.push(resolveDiscordMediaClassification({ attachment }));
|
|
285
|
-
}
|
|
286
|
-
}
|
|
287
|
-
}
|
|
288
289
|
function resolveStickerAssetCandidates(sticker) {
|
|
289
290
|
const baseName = sticker.name?.trim() || `sticker-${sticker.id}`;
|
|
290
291
|
const isLottie = sticker.format_type === StickerFormatType.Lottie;
|
|
@@ -293,15 +294,6 @@ function resolveStickerAssetCandidates(sticker) {
|
|
|
293
294
|
fileName: `${baseName}.${extension}`
|
|
294
295
|
}));
|
|
295
296
|
}
|
|
296
|
-
function formatStickerError(err) {
|
|
297
|
-
if (err instanceof Error) return err.message;
|
|
298
|
-
if (typeof err === "string") return err;
|
|
299
|
-
try {
|
|
300
|
-
return JSON.stringify(err) ?? "unknown error";
|
|
301
|
-
} catch {
|
|
302
|
-
return "unknown error";
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
297
|
function inferStickerContentType(sticker) {
|
|
306
298
|
switch (sticker.format_type) {
|
|
307
299
|
case StickerFormatType.GIF: return "image/gif";
|
|
@@ -311,37 +303,6 @@ function inferStickerContentType(sticker) {
|
|
|
311
303
|
default: return;
|
|
312
304
|
}
|
|
313
305
|
}
|
|
314
|
-
async function appendResolvedMediaFromStickers(params) {
|
|
315
|
-
for (const sticker of params.stickers ?? []) {
|
|
316
|
-
const candidates = resolveStickerAssetCandidates(sticker);
|
|
317
|
-
let lastError;
|
|
318
|
-
for (const candidate of candidates) try {
|
|
319
|
-
const saved = await fetchDiscordMedia(params, {
|
|
320
|
-
url: candidate.url,
|
|
321
|
-
filePathHint: candidate.fileName,
|
|
322
|
-
fallbackContentType: inferStickerContentType(sticker),
|
|
323
|
-
originalFilename: candidate.fileName
|
|
324
|
-
});
|
|
325
|
-
params.out.push({
|
|
326
|
-
path: saved.path,
|
|
327
|
-
contentType: saved.contentType,
|
|
328
|
-
fileName: candidate.fileName,
|
|
329
|
-
kind: "sticker"
|
|
330
|
-
});
|
|
331
|
-
lastError = null;
|
|
332
|
-
break;
|
|
333
|
-
} catch (err) {
|
|
334
|
-
lastError = err;
|
|
335
|
-
}
|
|
336
|
-
if (lastError) {
|
|
337
|
-
getChildLogger({ module: "discord-media" }).warn(`${params.errorPrefix} ${sticker.id}: ${formatStickerError(lastError)}`);
|
|
338
|
-
params.out.push({
|
|
339
|
-
contentType: inferStickerContentType(sticker),
|
|
340
|
-
kind: "sticker"
|
|
341
|
-
});
|
|
342
|
-
}
|
|
343
|
-
}
|
|
344
|
-
}
|
|
345
306
|
function isImageAttachment(attachment) {
|
|
346
307
|
if ((attachment.content_type ?? "").startsWith("image/")) return true;
|
|
347
308
|
const name = normalizeLowercaseStringOrEmpty(attachment.filename);
|
|
@@ -354,11 +315,8 @@ function formatDiscordMediaText(params) {
|
|
|
354
315
|
}
|
|
355
316
|
//#endregion
|
|
356
317
|
//#region extensions/discord/src/monitor/message-text.ts
|
|
357
|
-
function resolveDiscordEmbedText(embeds) {
|
|
358
|
-
return (embeds ?? []).flatMap(({ title, description }) => [normalizeOptionalString(title), normalizeOptionalString(description)]).filter(Boolean).join("\n");
|
|
359
|
-
}
|
|
360
318
|
function resolveDiscordMessageText(message, options) {
|
|
361
|
-
const baseText = resolveDiscordMentions(resolveDiscordMessageMentionDocuments(message).map((text) => text.trim()).join("\n") ||
|
|
319
|
+
const baseText = resolveDiscordMentions(resolveDiscordMessageMentionDocuments(message).map((text) => text.trim()).join("\n") || "", message);
|
|
362
320
|
if (!options?.includeForwarded) return baseText;
|
|
363
321
|
return [baseText, resolveDiscordForwardedMessagesText(message)].filter(Boolean).join("\n");
|
|
364
322
|
}
|
|
@@ -368,7 +326,7 @@ function resolveDiscordMessageMentionDocuments(message) {
|
|
|
368
326
|
const embedDocuments = (message.embeds ?? []).flatMap(({ title, description }) => [title, description].filter((value) => typeof value === "string" && Boolean(value.trim())));
|
|
369
327
|
if (embedDocuments.length > 0) return embedDocuments;
|
|
370
328
|
const componentDocuments = [];
|
|
371
|
-
collectDiscordTextDisplayDocuments(
|
|
329
|
+
collectDiscordTextDisplayDocuments(message.components, componentDocuments);
|
|
372
330
|
return componentDocuments;
|
|
373
331
|
}
|
|
374
332
|
function resolveDiscordMessageBatch(last, preceding) {
|
|
@@ -386,16 +344,6 @@ function resolveDiscordMessageBatch(last, preceding) {
|
|
|
386
344
|
enumerable: true,
|
|
387
345
|
configurable: true
|
|
388
346
|
},
|
|
389
|
-
message_snapshots: {
|
|
390
|
-
value: last.message_snapshots,
|
|
391
|
-
enumerable: true,
|
|
392
|
-
configurable: true
|
|
393
|
-
},
|
|
394
|
-
messageSnapshots: {
|
|
395
|
-
value: last.messageSnapshots,
|
|
396
|
-
enumerable: true,
|
|
397
|
-
configurable: true
|
|
398
|
-
},
|
|
399
347
|
rawData: {
|
|
400
348
|
value: { ...last.rawData },
|
|
401
349
|
enumerable: true,
|
|
@@ -406,7 +354,7 @@ function resolveDiscordMessageBatch(last, preceding) {
|
|
|
406
354
|
/** Adds native media text only for history surfaces that cannot carry structured facts. */
|
|
407
355
|
function resolveDiscordMessageHistoryText(message, options) {
|
|
408
356
|
return [resolveDiscordMessageText(message, options), formatDiscordMediaText({
|
|
409
|
-
attachments: message.attachments
|
|
357
|
+
attachments: message.attachments,
|
|
410
358
|
stickers: resolveDiscordMessageStickers(message)
|
|
411
359
|
})].filter(Boolean).join("\n");
|
|
412
360
|
}
|
|
@@ -428,15 +376,6 @@ function resolveDiscordForwardedMessagesText(message) {
|
|
|
428
376
|
if (!referencedForward) return "";
|
|
429
377
|
return formatDiscordForwardedMessageBlock(resolveDiscordMessageHistoryText(referencedForward), referencedForward.author);
|
|
430
378
|
}
|
|
431
|
-
function resolveDiscordMessageComponents(message) {
|
|
432
|
-
const components = message.components;
|
|
433
|
-
if (components !== void 0) return components;
|
|
434
|
-
try {
|
|
435
|
-
return message.rawData?.components;
|
|
436
|
-
} catch {
|
|
437
|
-
return;
|
|
438
|
-
}
|
|
439
|
-
}
|
|
440
379
|
function extractDiscordComponentsV2Text(components) {
|
|
441
380
|
const parts = [];
|
|
442
381
|
collectDiscordTextDisplayDocuments(components, parts);
|
|
@@ -466,9 +405,9 @@ function resolveDiscordRawMessageText(message) {
|
|
|
466
405
|
const content = normalizeOptionalString(message.content) ?? "";
|
|
467
406
|
const mediaText = formatDiscordMediaText({
|
|
468
407
|
attachments: message.attachments ?? void 0,
|
|
469
|
-
stickers:
|
|
408
|
+
stickers: resolveDiscordMessageStickers(message)
|
|
470
409
|
});
|
|
471
|
-
return [content ||
|
|
410
|
+
return [content || (message.embeds ?? []).flatMap(({ title, description }) => [normalizeOptionalString(title), normalizeOptionalString(description)]).filter(Boolean).join("\n") || extractDiscordComponentsV2Text(message.components) || resolveDiscordForwardedMessagesTextFromSnapshots(normalizeDiscordMessageSnapshots(message.message_snapshots)), mediaText].filter(Boolean).join("\n");
|
|
472
411
|
}
|
|
473
412
|
//#endregion
|
|
474
413
|
//#region extensions/discord/src/monitor/threading.cache.ts
|
|
@@ -502,28 +441,23 @@ const IN_FLIGHT_DISCORD_THREAD_STARTERS = /* @__PURE__ */ new Map();
|
|
|
502
441
|
function resolveDiscordThreadChannel(params) {
|
|
503
442
|
if (!params.isGuildMessage) return null;
|
|
504
443
|
const { message, channelInfo } = params;
|
|
505
|
-
const channel = "channel" in message ? message.channel : void 0;
|
|
506
|
-
if (channel && typeof channel === "object" && "isThread" in channel && typeof channel.isThread === "function" && channel.isThread()) return channel;
|
|
507
444
|
if (!isDiscordThreadChannelType(channelInfo?.type)) return null;
|
|
508
445
|
const messageChannelId = params.messageChannelId || resolveDiscordMessageChannelId({ message });
|
|
509
446
|
if (!messageChannelId) return null;
|
|
510
447
|
return {
|
|
511
448
|
id: messageChannelId,
|
|
512
|
-
name: channelInfo?.name
|
|
513
|
-
parentId: channelInfo?.parentId
|
|
514
|
-
|
|
515
|
-
ownerId: channelInfo?.ownerId ?? void 0
|
|
449
|
+
name: channelInfo?.name,
|
|
450
|
+
parentId: channelInfo?.parentId,
|
|
451
|
+
ownerId: channelInfo?.ownerId
|
|
516
452
|
};
|
|
517
453
|
}
|
|
518
454
|
async function resolveDiscordThreadParentInfo(params) {
|
|
519
455
|
const { threadChannel, channelInfo, client } = params;
|
|
520
|
-
|
|
521
|
-
|
|
522
|
-
if (!parentId && threadChannel.id) parentId = (await resolveDiscordChannelInfo(client, threadChannel.id))?.parentId ?? void 0;
|
|
456
|
+
let parentId = threadChannel.parentId ?? channelInfo?.parentId;
|
|
457
|
+
if (!parentId && threadChannel.id) parentId = (await resolveDiscordChannelInfo(client, threadChannel.id))?.parentId;
|
|
523
458
|
if (!parentId) return {};
|
|
524
|
-
let parentName = resolveDiscordChannelNameSafe(parent);
|
|
525
459
|
const parentInfo = await resolveDiscordChannelInfo(client, parentId);
|
|
526
|
-
parentName =
|
|
460
|
+
const parentName = parentInfo?.name;
|
|
527
461
|
const parentType = parentInfo?.type;
|
|
528
462
|
return {
|
|
529
463
|
id: parentId,
|
|
@@ -544,7 +478,7 @@ async function resolveDiscordThreadStarter(params) {
|
|
|
544
478
|
try {
|
|
545
479
|
return await pending;
|
|
546
480
|
} finally {
|
|
547
|
-
|
|
481
|
+
IN_FLIGHT_DISCORD_THREAD_STARTERS.delete(cacheKey);
|
|
548
482
|
}
|
|
549
483
|
}
|
|
550
484
|
async function resolveDiscordThreadStarterUncached(params, cacheKey, messageChannelId) {
|
|
@@ -583,7 +517,7 @@ function buildDiscordThreadStarterPayload(params) {
|
|
|
583
517
|
authorName: starter.author?.username ?? void 0,
|
|
584
518
|
authorTag,
|
|
585
519
|
memberRoleIds: Array.isArray(starter.member?.roles) ? starter.member.roles : void 0,
|
|
586
|
-
timestamp: params.resolveTimestampMs(starter.timestamp)
|
|
520
|
+
timestamp: params.resolveTimestampMs(starter.timestamp)
|
|
587
521
|
};
|
|
588
522
|
}
|
|
589
523
|
function resolveDiscordThreadStarterAuthorTag(author) {
|
|
@@ -620,12 +554,12 @@ function resolveDiscordReplyDeliveryPlan(params) {
|
|
|
620
554
|
//#region extensions/discord/src/monitor/thread-channel-context.ts
|
|
621
555
|
async function resolveDiscordThreadLikeChannelContext(params) {
|
|
622
556
|
const safeChannelInfo = resolveDiscordChannelInfoSafe(params.channel);
|
|
623
|
-
const channelId =
|
|
557
|
+
const channelId = safeChannelInfo.id ?? params.channelIdFallback ?? "";
|
|
624
558
|
const channelInfo = params.channelInfo !== void 0 ? params.channelInfo : channelId ? await resolveDiscordChannelInfo(params.client, channelId) : null;
|
|
625
559
|
const channelType = safeChannelInfo.type ?? channelInfo?.type;
|
|
626
560
|
const channelName = safeChannelInfo.name ?? channelInfo?.name;
|
|
627
561
|
const channelSlug = channelName ? normalizeDiscordSlug(channelName) : "";
|
|
628
|
-
const parentId =
|
|
562
|
+
const parentId = safeChannelInfo.parentId ?? channelInfo?.parentId;
|
|
629
563
|
const isThreadChannel = isDiscordThreadChannelType(channelType);
|
|
630
564
|
let threadParentId;
|
|
631
565
|
let threadParentName;
|
|
@@ -636,8 +570,7 @@ async function resolveDiscordThreadLikeChannelContext(params) {
|
|
|
636
570
|
threadChannel: {
|
|
637
571
|
id: channelId,
|
|
638
572
|
name: channelName,
|
|
639
|
-
parentId
|
|
640
|
-
parent: void 0
|
|
573
|
+
parentId
|
|
641
574
|
},
|
|
642
575
|
channelInfo
|
|
643
576
|
});
|
|
@@ -654,8 +587,7 @@ async function resolveDiscordThreadLikeChannelContext(params) {
|
|
|
654
587
|
parentId,
|
|
655
588
|
threadParentId,
|
|
656
589
|
threadParentName,
|
|
657
|
-
threadParentSlug
|
|
658
|
-
channelInfo
|
|
590
|
+
threadParentSlug
|
|
659
591
|
};
|
|
660
592
|
}
|
|
661
593
|
async function resolveFetchedDiscordThreadLikeChannelContext(params) {
|
|
@@ -665,12 +597,6 @@ async function resolveFetchedDiscordThreadLikeChannelContext(params) {
|
|
|
665
597
|
});
|
|
666
598
|
}
|
|
667
599
|
//#endregion
|
|
668
|
-
//#region extensions/discord/src/voice/config.ts
|
|
669
|
-
function resolveDiscordVoiceEnabled(voice) {
|
|
670
|
-
if (voice?.enabled !== void 0) return voice.enabled;
|
|
671
|
-
return voice !== void 0;
|
|
672
|
-
}
|
|
673
|
-
//#endregion
|
|
674
600
|
//#region extensions/discord/src/voice/owner-access.ts
|
|
675
601
|
async function resolveDiscordVoiceAccessTarget(params) {
|
|
676
602
|
const [guild, channel] = await Promise.all([params.client.fetchGuild(params.guildId).catch(() => null), params.client.fetchChannel(params.channelId).catch(() => null)]);
|
|
@@ -779,6 +705,12 @@ async function authorizeDiscordVoiceIngress(initialParams) {
|
|
|
779
705
|
};
|
|
780
706
|
}
|
|
781
707
|
//#endregion
|
|
708
|
+
//#region extensions/discord/src/voice/config.ts
|
|
709
|
+
function resolveDiscordVoiceEnabled(voice) {
|
|
710
|
+
if (voice?.enabled !== void 0) return voice.enabled;
|
|
711
|
+
return voice !== void 0;
|
|
712
|
+
}
|
|
713
|
+
//#endregion
|
|
782
714
|
//#region extensions/discord/src/voice/transcripts-source.ts
|
|
783
715
|
const TRANSCRIPTS_STATE = resolveGlobalSingleton(Symbol.for("openclaw.discordTranscriptsState"), () => ({
|
|
784
716
|
managersByAccountId: /* @__PURE__ */ new Map(),
|
|
@@ -964,8 +896,7 @@ async function waitForManager(request) {
|
|
|
964
896
|
resolve();
|
|
965
897
|
}
|
|
966
898
|
};
|
|
967
|
-
const timer = setTimeout(waiter.resolve, startupWaitMs);
|
|
968
|
-
timer.unref?.();
|
|
899
|
+
const timer = setTimeout(waiter.resolve, startupWaitMs).unref();
|
|
969
900
|
request.abortSignal?.addEventListener("abort", waiter.resolve, { once: true });
|
|
970
901
|
managerWaiters.add(waiter);
|
|
971
902
|
});
|
|
@@ -1246,4 +1177,4 @@ const discordVoiceTranscriptsSourceProvider = {
|
|
|
1246
1177
|
}
|
|
1247
1178
|
};
|
|
1248
1179
|
//#endregion
|
|
1249
|
-
export { resolveDiscordChannelInfo as A, resolveMediaList as C, resolveDiscordMessageStickers as D, hasDiscordMessageStickers as E, resolveDiscordReferencedReplyMessage as O, resolveForwardedMediaList as S, resolveDiscordCdnPolicy as T, resolveDiscordMessageBatch as _,
|
|
1180
|
+
export { resolveDiscordChannelInfo as A, resolveMediaList as C, resolveDiscordMessageStickers as D, hasDiscordMessageStickers as E, resolveDiscordReferencedReplyMessage as O, resolveForwardedMediaList as S, resolveDiscordCdnPolicy as T, resolveDiscordMessageBatch as _, resolveDiscordVoiceEnabled as a, resolveDiscordMessageText as b, resolveDiscordVoiceAccessTarget as c, resolveDiscordReplyDeliveryPlan as d, resolveDiscordReplyTarget as f, sanitizeDiscordThreadName as g, resolveDiscordThreadStarter as h, setDiscordTranscriptsVoiceManager as i, resolveDiscordMessageChannelId as j, resolveDiscordReferencedReplyMessageId as k, resolveDiscordThreadLikeChannelContext as l, resolveDiscordThreadParentInfo as m, discordVoiceTranscriptsSourceProvider as n, authorizeDiscordVoiceIngress as o, resolveDiscordThreadChannel as p, resolveDiscordTranscriptsCapture as r, resolveDiscordVoiceAccess as s, bindDiscordCaptureReceipts as t, resolveFetchedDiscordThreadLikeChannelContext as u, resolveDiscordMessageHistoryText as v, resolveReferencedReplyMediaList as w, formatDiscordMediaText as x, resolveDiscordMessageMentionDocuments as y };
|