@openclaw/discord 2026.8.1-beta.3 → 2026.8.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/{account-inspect-D5xmUpnj.js → account-inspect-BDfKyuvL.js} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-DNl-oCEw.js → accounts-CfQ-vSyf.js} +5 -124
- package/dist/action-runtime-api.js +1 -1
- package/dist/{activities-api-KCBAmWxD.js → activities-api-Dl-TOyOX.js} +5 -4
- package/dist/activities-api.js +1 -1
- package/dist/api.js +16 -16
- package/dist/{approval-handler.runtime-B12RCYr8.js → approval-handler.runtime-q4Zqo44V.js} +28 -105
- package/dist/{audit-Yc7eZDd6.js → audit-DgrvFPGt.js} +5 -5
- package/dist/{channel-cXYzGc4L.js → channel-BsQUalPw.js} +18 -20
- package/dist/{channel-actions.runtime-CODTvo7c.js → channel-actions.runtime-UMGGIfSy.js} +59 -58
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/channel-type-CVLZyGYS.js +7 -0
- package/dist/{channel.setup-CSiwnMgs.js → channel.setup-rPs4dsk_.js} +5 -5
- package/dist/{components-ezGKo_Yh.js → components-Dk35LTf_.js} +33 -29
- package/dist/{config-schema-DC5kDtQ5.js → config-schema-CxPqtVI1.js} +16 -10
- package/dist/{conversation-binding-route-D6rCQ5S0.js → conversation-binding-route-BjvX4e35.js} +1 -1
- package/dist/{directory-config-XyCfoqLg.js → directory-config-B7DY_pNG.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-Df0NbFJB.js → directory-live-DuAXKkan.js} +2 -2
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{doctor-DYY31GrO.js → doctor-zQTtn6hm.js} +4 -4
- package/dist/{handle-action.guild-admin-6Tvvinsa.js → handle-action.guild-admin-DZewwLr1.js} +9 -5
- package/dist/index.js +1 -1
- package/dist/ingress-identity-CzZKcPK8.js +60 -0
- package/dist/{message-handler-B61q5MOF.js → message-handler-C5By3yl5.js} +5 -5
- package/dist/{message-handler.preflight-Bzg_Hawz.js → message-handler.preflight-DrszWuHw.js} +20 -84
- package/dist/{message-handler.process--4_712Ec.js → message-handler.process-DyFPDLCt.js} +60 -66
- package/dist/{message-utils-BXLLnFl6.js → message-text-Ca8M6TU8.js} +34 -32
- package/dist/{outbound-adapter-DxHTOqiN.js → outbound-adapter-Dif8p481.js} +58 -61
- package/dist/{outbound-components-B2PL0ooH.js → outbound-components-wjv7yyAj.js} +5 -4
- package/dist/outbound-session-route-Bn4uXaoE.js +665 -0
- package/dist/{owner-access-Bg41VzAf.js → owner-access-UlYi9t0M.js} +1 -1
- package/dist/{pluralkit-dUl4v1X3.js → pluralkit-9EuEN4UD.js} +1 -1
- package/dist/{probe-BTdtVRwU.js → probe-n6ZXxK8V.js} +1 -1
- package/dist/{probe.runtime-Dq5-PRKT.js → probe.runtime-CN4bdPfZ.js} +1 -1
- package/dist/{provider-DlK_ynqt.js → provider-LXiOcJrH.js} +443 -295
- package/dist/{provider-session.runtime-CvvphHvs.js → provider-session.runtime-DSNe7r2W.js} +3 -3
- package/dist/provider.runtime-DiInaDXO.js +2 -0
- package/dist/{realtime-session.runtime-ysbMG8v7.js → realtime-session.runtime-DOViOIjY.js} +106 -122
- package/dist/{resolve-allowlist-common-DIVXbD1P.js → resolve-allowlist-common-BLoYaxEG.js} +1 -1
- package/dist/{resolve-channels-CGeUoIqb.js → resolve-channels-D2yl_2CN.js} +4 -3
- package/dist/{resolve-users-BtKxLUZv.js → resolve-users-BLxfqajZ.js} +2 -2
- package/dist/{retry-DNsVTeTo.js → retry-DqHCW6PV.js} +220 -6
- package/dist/{runtime-D71_VFLr.js → runtime-BYamRVPN.js} +73 -56
- package/dist/{runtime-CQovMsH3.js → runtime-DrxVBTtp.js} +2 -2
- package/dist/runtime-api.js +16 -23
- package/dist/{sdk-runtime-37OU6_Yh.js → sdk-runtime-6tfgYDjY.js} +55 -86
- package/dist/{security-audit-BfJhAXZp.js → security-audit-DKfK-iPY.js} +10 -11
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/{security-audit.runtime-BVKF9VtY.js → security-audit.runtime-sKZyKgpx.js} +1 -1
- package/dist/{send-rQIffSYu.js → send-UJHiAm4C.js} +78 -15
- package/dist/{send.components-ChK1wS7w.js → send.components-CrBJpGT_.js} +15 -22
- package/dist/{send.outbound-HIkgji_7.js → send.outbound-D7JYmfm9.js} +58 -69
- package/dist/{send.shared-B3fpaLWJ.js → send.shared-DZJ1akvQ.js} +36 -21
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-CaAaoksy.js → shared-Dii2HTn7.js} +31 -9
- package/dist/{subagent-hooks-CNT2ZJTJ.js → subagent-hooks-JyGrtQIl.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -6
- package/dist/{system-events-Nuwoq_au.js → system-events-BEmcj4xJ.js} +1 -1
- package/dist/{target-resolver-DIXShHaZ.js → target-resolver-V-IYae6s.js} +3 -3
- package/dist/targets-CQp53cGj.js +3 -0
- package/dist/{thread-bindings-VlymUnbz.js → thread-bindings-DvYP79fy.js} +3 -4
- package/dist/{thread-bindings.manager-CngsgErq.js → thread-bindings.manager-Clm77DBM.js} +8 -12
- package/dist/{threading-DU6pgeGm.js → threading-CXuu_7o9.js} +47 -25
- package/dist/{transcripts-source-DeIMNbRh.js → transcripts-source-BLEMH_yi.js} +9 -4
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-oLiS5Z13.js → typing-B9snnwMe.js} +1 -1
- package/dist/{voice-runtime-CjNFaynA.js → voice-runtime-DY6_o73o.js} +76 -66
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/README.md +19 -19
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v1.js +7 -3
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist/v7.js +5 -2
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v1.js +7 -3
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/dist-node/v7.js +5 -2
- package/node_modules/@discord/embedded-app-sdk/node_modules/uuid/package.json +4 -3
- package/node_modules/@discordjs/voice/node_modules/@types/node/README.md +1 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/child_process.d.ts +0 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/crypto.d.ts +6 -6
- package/node_modules/@discordjs/voice/node_modules/@types/node/dns/promises.d.ts +5 -5
- package/node_modules/@discordjs/voice/node_modules/@types/node/dns.d.ts +5 -5
- package/node_modules/@discordjs/voice/node_modules/@types/node/fs.d.ts +7 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/http.d.ts +30 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/http2.d.ts +4 -4
- package/node_modules/@discordjs/voice/node_modules/@types/node/os.d.ts +30 -30
- package/node_modules/@discordjs/voice/node_modules/@types/node/package.json +2 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/perf_hooks.d.ts +2 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/process.d.ts +42 -43
- package/node_modules/@discordjs/voice/node_modules/@types/node/quic.d.ts +1049 -84
- package/node_modules/@discordjs/voice/node_modules/@types/node/sqlite.d.ts +14 -1
- package/node_modules/@discordjs/voice/node_modules/@types/node/stream/iter.d.ts +3 -2
- package/node_modules/@discordjs/voice/node_modules/@types/node/test.d.ts +61 -0
- package/node_modules/@discordjs/voice/node_modules/@types/node/v8.d.ts +20 -23
- package/node_modules/discord-api-types/CHANGELOG.md +8 -0
- package/node_modules/discord-api-types/package.json +4 -4
- package/node_modules/discord-api-types/payloads/v10/channel.d.ts +2 -2
- package/node_modules/discord-api-types/payloads/v10/channel.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/gateway.d.ts +4 -0
- package/node_modules/discord-api-types/payloads/v10/gateway.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/gateway.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/message.d.ts +4 -1
- package/node_modules/discord-api-types/payloads/v10/message.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/message.js +1 -0
- package/node_modules/discord-api-types/payloads/v10/message.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/channel.d.ts +2 -2
- package/node_modules/discord-api-types/payloads/v9/channel.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/gateway.d.ts +4 -0
- package/node_modules/discord-api-types/payloads/v9/gateway.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/gateway.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/message.d.ts +4 -1
- package/node_modules/discord-api-types/payloads/v9/message.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/message.js +1 -0
- package/node_modules/discord-api-types/payloads/v9/message.js.map +1 -1
- package/node_modules/typebox/build/format/date.d.mts +1 -1
- package/node_modules/typebox/build/format/date.mjs +1 -1
- package/node_modules/typebox/build/format/date_time.d.mts +2 -2
- package/node_modules/typebox/build/format/date_time.mjs +3 -3
- package/node_modules/typebox/build/format/email.d.mts +1 -1
- package/node_modules/typebox/build/format/email.mjs +2 -2
- package/node_modules/typebox/build/format/hostname.mjs +2 -10
- package/node_modules/typebox/build/format/idn_email.d.mts +1 -1
- package/node_modules/typebox/build/format/idn_email.mjs +3 -3
- package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idn_hostname.mjs +3 -11
- package/node_modules/typebox/build/format/idna/format/bidi.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/bidi.mjs +98 -0
- package/node_modules/typebox/build/format/idna/format/puny.d.mts +3 -0
- package/node_modules/typebox/build/format/idna/format/puny.mjs +144 -0
- package/node_modules/typebox/build/format/idna/hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/hostname.mjs +16 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/idn-hostname.mjs +23 -0
- package/node_modules/typebox/build/format/idna/index.d.mts +2 -0
- package/node_modules/typebox/build/format/idna/index.mjs +2 -0
- package/node_modules/typebox/build/format/idna/label/ascii.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/ascii.mjs +9 -0
- package/node_modules/typebox/build/format/idna/label/puny.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/puny.mjs +28 -0
- package/node_modules/typebox/build/format/idna/label/unicode.d.mts +1 -0
- package/node_modules/typebox/build/format/idna/label/unicode.mjs +106 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.d.mts +30 -0
- package/node_modules/typebox/build/format/idna/pattern/pattern.mjs +70 -0
- package/node_modules/typebox/build/format/ipv4.d.mts +0 -1
- package/node_modules/typebox/build/format/ipv4.mjs +2 -32
- package/node_modules/typebox/build/format/ipv6.mjs +2 -61
- package/node_modules/typebox/build/format/iri.d.mts +2 -2
- package/node_modules/typebox/build/format/iri.mjs +26 -8
- package/node_modules/typebox/build/format/iri_reference.d.mts +2 -2
- package/node_modules/typebox/build/format/iri_reference.mjs +9 -55
- package/node_modules/typebox/build/format/regex.d.mts +1 -2
- package/node_modules/typebox/build/format/regex.mjs +2 -6
- package/node_modules/typebox/build/format/time.d.mts +2 -2
- package/node_modules/typebox/build/format/time.mjs +19 -14
- package/node_modules/typebox/build/format/uri.d.mts +1 -1
- package/node_modules/typebox/build/format/uri.mjs +3 -130
- package/node_modules/typebox/build/format/uri_reference.d.mts +1 -1
- package/node_modules/typebox/build/format/uri_reference.mjs +2 -3
- package/node_modules/typebox/build/format/uri_template.d.mts +2 -3
- package/node_modules/typebox/build/format/uri_template.mjs +4 -5
- package/node_modules/typebox/build/format/url.d.mts +3 -3
- package/node_modules/typebox/build/format/url.mjs +4 -5
- package/node_modules/typebox/build/guard/emit.d.mts +3 -1
- package/node_modules/typebox/build/guard/emit.mjs +12 -5
- package/node_modules/typebox/build/guard/guard.d.mts +8 -2
- package/node_modules/typebox/build/guard/guard.mjs +25 -4
- package/node_modules/typebox/build/guard/string.d.mts +2 -2
- package/node_modules/typebox/build/guard/string.mjs +7 -7
- package/node_modules/typebox/build/schema/engine/_context.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/_functions.mjs +1 -2
- package/node_modules/typebox/build/schema/engine/_regexp.d.mts +2 -0
- package/node_modules/typebox/build/schema/engine/_regexp.mjs +4 -0
- package/node_modules/typebox/build/schema/engine/_stack.mjs +12 -13
- package/node_modules/typebox/build/schema/engine/additionalItems.mjs +17 -7
- package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/contains.mjs +18 -6
- package/node_modules/typebox/build/schema/engine/enum.mjs +1 -1
- package/node_modules/typebox/build/schema/engine/items.mjs +26 -6
- package/node_modules/typebox/build/schema/engine/maxContains.mjs +3 -3
- package/node_modules/typebox/build/schema/engine/minContains.mjs +14 -4
- package/node_modules/typebox/build/schema/engine/not.mjs +4 -2
- package/node_modules/typebox/build/schema/engine/oneOf.mjs +7 -6
- package/node_modules/typebox/build/schema/engine/pattern.mjs +3 -2
- package/node_modules/typebox/build/schema/engine/patternProperties.mjs +4 -3
- package/node_modules/typebox/build/schema/engine/ref.mjs +1 -7
- package/node_modules/typebox/build/schema/engine/schema.mjs +13 -4
- package/node_modules/typebox/build/schema/engine/type.mjs +1 -1
- package/node_modules/typebox/build/schema/resolve/resolve.d.mts +4 -1
- package/node_modules/typebox/build/schema/resolve/resolve.mjs +202 -1
- package/node_modules/typebox/build/schema/static/propertyNames.d.mts +5 -0
- package/node_modules/typebox/build/schema/static/propertyNames.mjs +3 -0
- package/node_modules/typebox/build/schema/static/schema.d.mts +3 -0
- package/node_modules/typebox/build/schema/types/index.d.mts +0 -2
- package/node_modules/typebox/build/schema/types/index.mjs +0 -2
- package/node_modules/typebox/build/system/memory/clone.mjs +14 -11
- package/node_modules/typebox/build/system/memory/discard.mjs +6 -5
- package/node_modules/typebox/build/system/settings/settings.d.mts +9 -0
- package/node_modules/typebox/build/system/settings/settings.mjs +2 -0
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.d.mts +6 -1
- package/node_modules/typebox/build/type/engine/call/distribute_arguments.mjs +16 -3
- package/node_modules/typebox/build/type/engine/call/instantiate.mjs +34 -4
- package/node_modules/typebox/build/type/engine/evaluate/broaden.d.mts +5 -5
- package/node_modules/typebox/build/type/engine/evaluate/broaden.mjs +20 -26
- package/node_modules/typebox/build/type/engine/evaluate/compare.d.mts +6 -10
- package/node_modules/typebox/build/type/engine/evaluate/compare.mjs +9 -13
- package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +7 -4
- package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +12 -19
- package/node_modules/typebox/build/type/engine/evaluate/distribute.d.mts +4 -20
- package/node_modules/typebox/build/type/engine/evaluate/distribute.mjs +8 -20
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.d.mts +4 -4
- package/node_modules/typebox/build/type/engine/evaluate/evaluate.mjs +11 -8
- package/node_modules/typebox/build/type/engine/evaluate/flatten.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/evaluate/flatten.mjs +3 -4
- package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +17 -2
- package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +26 -6
- package/node_modules/typebox/build/type/engine/exclude/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/extract/operation.d.mts +1 -1
- package/node_modules/typebox/build/type/engine/extract/operation.mjs +3 -4
- package/node_modules/typebox/build/type/engine/priority/priority.d.mts +2 -2
- package/node_modules/typebox/build/type/engine/priority/priority.mjs +3 -4
- package/node_modules/typebox/build/type/script/mapping.d.mts +32 -29
- package/node_modules/typebox/build/type/script/mapping.mjs +18 -25
- package/node_modules/typebox/build/type/script/parser.d.mts +19 -25
- package/node_modules/typebox/build/type/script/parser.mjs +27 -23
- package/node_modules/typebox/build/value/errors/errors.d.mts +2 -2
- package/node_modules/typebox/build/value/errors/errors.mjs +1 -1
- package/node_modules/typebox/package.json +27 -27
- package/node_modules/typebox/readme.md +79 -82
- package/node_modules/undici/docs/docs/api/Client.md +21 -8
- package/node_modules/undici/lib/api/readable.js +33 -43
- package/node_modules/undici/lib/core/connect.js +16 -2
- package/node_modules/undici/lib/core/symbols.js +1 -0
- package/node_modules/undici/lib/dispatcher/client-h1.js +3 -3
- package/node_modules/undici/lib/dispatcher/client-h2.js +179 -10
- package/node_modules/undici/lib/dispatcher/client.js +74 -29
- package/node_modules/undici/lib/dispatcher/env-http-proxy-agent.js +28 -6
- package/node_modules/undici/lib/dispatcher/socks5-proxy-agent.js +15 -1
- package/node_modules/undici/lib/handler/retry-handler.js +7 -2
- package/node_modules/undici/lib/interceptor/cache.js +5 -2
- package/node_modules/undici/lib/interceptor/deduplicate.js +1 -1
- package/node_modules/undici/lib/mock/mock-utils.js +213 -24
- package/node_modules/undici/lib/util/cache.js +2 -4
- package/node_modules/undici/lib/web/websocket/websocket.js +22 -0
- package/node_modules/undici/package.json +1 -1
- package/node_modules/undici/types/client.d.ts +40 -0
- package/node_modules/ws/lib/permessage-deflate.js +3 -1
- package/node_modules/ws/package.json +1 -1
- package/openclaw.plugin.json +12 -4
- package/package.json +8 -8
- package/skills/discord/SKILL.md +1 -1
- package/dist/approval-message-safety-XGFPbDoI.js +0 -226
- package/dist/audit-core-BCX8UeFH.js +0 -105
- package/dist/channel-actions-Dr2QI8Bf.js +0 -212
- package/dist/inbound-event-delivery-De2qxTrP.js +0 -39
- package/dist/provider.runtime-CzKGRiAF.js +0 -2
- package/dist/runtime-api.actions.js +0 -3
- package/dist/runtime-api.lookup.js +0 -7
- package/dist/runtime-api.monitor-CzeTYF32.js +0 -6
- package/dist/runtime-api.monitor.js +0 -9
- package/dist/runtime-api.send.js +0 -7
- package/dist/runtime-api.threads.js +0 -5
- package/dist/send.reactions-gmJ6yFPo.js +0 -78
- package/dist/send.receipt-Cnhoautb.js +0 -76
- package/dist/subagent-progress-FPLqBY1s.js +0 -110
- package/dist/targets-B2pf49zc.js +0 -3
- package/node_modules/typebox/build/format/_idna.d.mts +0 -2
- package/node_modules/typebox/build/format/_idna.mjs +0 -246
- package/node_modules/typebox/build/format/_puny.d.mts +0 -1
- package/node_modules/typebox/build/format/_puny.mjs +0 -77
- package/node_modules/typebox/build/schema/resolve/ref.d.mts +0 -3
- package/node_modules/typebox/build/schema/resolve/ref.mjs +0 -146
- package/node_modules/typebox/build/schema/types/contentEncoding.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentEncoding.mjs +0 -13
- package/node_modules/typebox/build/schema/types/contentMediaType.d.mts +0 -9
- package/node_modules/typebox/build/schema/types/contentMediaType.mjs +0 -13
|
@@ -1,23 +1,25 @@
|
|
|
1
1
|
import { t as parseDiscordRetryAfterBodySeconds } from "./retry-after-DdLPmPoa.js";
|
|
2
|
-
import { k as parseDiscordTarget } from "./accounts-DNl-oCEw.js";
|
|
3
2
|
import "node:module";
|
|
4
3
|
import { redactIdentifier, redactSensitiveFieldValue } from "openclaw/plugin-sdk/logging-core";
|
|
5
4
|
import { ApplicationCommandOptionType, ApplicationCommandType, ButtonStyle, ComponentType, GatewayDispatchEvents, InteractionContextType, InteractionResponseType, InteractionType, MessageFlags, Routes, TextInputStyle } from "discord-api-types/v10";
|
|
5
|
+
import { Type } from "typebox";
|
|
6
|
+
import { Check } from "typebox/value";
|
|
6
7
|
import { createHash } from "node:crypto";
|
|
7
8
|
import { asDateTimestampMs, clampTimerTimeoutMs, parseStrictNonNegativeInteger, resolveExpiresAtMsFromDurationMs, resolveIntegerOption, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
8
9
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
9
|
-
import { Type } from "typebox";
|
|
10
|
-
import { Check } from "typebox/value";
|
|
11
10
|
import { inspect } from "node:util";
|
|
12
11
|
import { gunzipSync } from "node:zlib";
|
|
13
12
|
import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
|
|
14
13
|
import { collectErrorGraphCandidates, extractErrorCode, formatErrorMessage, readErrorName } from "openclaw/plugin-sdk/error-runtime";
|
|
15
14
|
import { classifyTransientNetworkErrorCode, createChannelApiRetryRunner, parseRetryAfterHeaderSeconds, resolveRetryConfig, retryAsync } from "openclaw/plugin-sdk/retry-runtime";
|
|
15
|
+
import { buildMessagingTarget, parseMentionPrefixOrAtUserTarget, requireTargetKind } from "openclaw/plugin-sdk/channel-targets";
|
|
16
16
|
import { sleepWithAbort } from "openclaw/plugin-sdk/runtime-env";
|
|
17
17
|
import { resolveAllowlistMatchByCandidates } from "openclaw/plugin-sdk/allow-from";
|
|
18
18
|
import { chunkMarkdownTextWithMode } from "openclaw/plugin-sdk/reply-chunking";
|
|
19
19
|
import { chunkTextForOutbound } from "openclaw/plugin-sdk/text-chunking";
|
|
20
20
|
import { isSingleUseReplyToMode } from "openclaw/plugin-sdk/reply-reference";
|
|
21
|
+
import { createMessageReceiptFromOutboundResults } from "openclaw/plugin-sdk/channel-outbound";
|
|
22
|
+
import { attachChannelToResults } from "openclaw/plugin-sdk/channel-send-result";
|
|
21
23
|
//#region \0rolldown/runtime.js
|
|
22
24
|
var __defProp = Object.defineProperty;
|
|
23
25
|
var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
|
|
@@ -65,6 +67,11 @@ async function overwriteGuildApplicationCommands(rest, clientId, guildId, body)
|
|
|
65
67
|
}
|
|
66
68
|
//#endregion
|
|
67
69
|
//#region extensions/discord/src/internal/api.guild.ts
|
|
70
|
+
const discordGuildEmojiListSchema = Type.Array(Type.Object({
|
|
71
|
+
id: Type.Union([Type.String(), Type.Null()]),
|
|
72
|
+
name: Type.Union([Type.String(), Type.Null()]),
|
|
73
|
+
animated: Type.Optional(Type.Boolean())
|
|
74
|
+
}, { additionalProperties: true }));
|
|
68
75
|
async function getGuild(rest, guildId) {
|
|
69
76
|
return await rest.get(Routes.guild(guildId));
|
|
70
77
|
}
|
|
@@ -117,7 +124,9 @@ async function createGuildBan(rest, guildId, userId, data) {
|
|
|
117
124
|
await rest.put(Routes.guildBan(guildId, userId), data);
|
|
118
125
|
}
|
|
119
126
|
async function listGuildEmojis(rest, guildId) {
|
|
120
|
-
|
|
127
|
+
const emojis = await rest.get(Routes.guildEmojis(guildId));
|
|
128
|
+
if (!Check(discordGuildEmojiListSchema, emojis)) throw new Error("Invalid Discord guild emoji response.");
|
|
129
|
+
return emojis;
|
|
121
130
|
}
|
|
122
131
|
async function createGuildEmoji(rest, guildId, data) {
|
|
123
132
|
return await rest.post(Routes.guildEmojis(guildId), data);
|
|
@@ -1166,6 +1175,9 @@ var DiscordEntityCache = class {
|
|
|
1166
1175
|
return new GuildMember(this.params.client, raw);
|
|
1167
1176
|
});
|
|
1168
1177
|
}
|
|
1178
|
+
async fetchGuildEmojis(guildId, fetcher) {
|
|
1179
|
+
return await this.fetchCached(`guild-emojis:${guildId}`, fetcher);
|
|
1180
|
+
}
|
|
1169
1181
|
invalidateForGatewayEvent(type, data) {
|
|
1170
1182
|
const raw = data && typeof data === "object" ? data : {};
|
|
1171
1183
|
const channelUpdate = GatewayDispatchEvents.ChannelUpdate;
|
|
@@ -1173,11 +1185,13 @@ var DiscordEntityCache = class {
|
|
|
1173
1185
|
const threadUpdate = GatewayDispatchEvents.ThreadUpdate;
|
|
1174
1186
|
const threadDelete = GatewayDispatchEvents.ThreadDelete;
|
|
1175
1187
|
const guildUpdate = GatewayDispatchEvents.GuildUpdate;
|
|
1188
|
+
const guildEmojisUpdate = GatewayDispatchEvents.GuildEmojisUpdate;
|
|
1176
1189
|
const guildMemberAdd = GatewayDispatchEvents.GuildMemberAdd;
|
|
1177
1190
|
const guildMemberRemove = GatewayDispatchEvents.GuildMemberRemove;
|
|
1178
1191
|
const guildMemberUpdate = GatewayDispatchEvents.GuildMemberUpdate;
|
|
1179
1192
|
if (type === channelUpdate || type === channelDelete || type === threadUpdate || type === threadDelete) this.deleteId("channel", raw.id);
|
|
1180
1193
|
if (type === guildUpdate) this.deleteId("guild", raw.id);
|
|
1194
|
+
if (type === guildEmojisUpdate) this.deleteId("guild-emojis", raw.guild_id);
|
|
1181
1195
|
if (type === guildMemberAdd || type === guildMemberRemove || type === guildMemberUpdate) {
|
|
1182
1196
|
const guildId = raw.guild_id;
|
|
1183
1197
|
const user = raw.user && typeof raw.user === "object" ? raw.user : {};
|
|
@@ -1662,6 +1676,7 @@ var BaseInteraction = class {
|
|
|
1662
1676
|
this.message = null;
|
|
1663
1677
|
this.response = new InteractionResponseController();
|
|
1664
1678
|
this.pendingResponse = Promise.resolve();
|
|
1679
|
+
this.sentFollowUp = false;
|
|
1665
1680
|
this.id = rawData.id;
|
|
1666
1681
|
this.token = rawData.token;
|
|
1667
1682
|
this.user = readInteractionUser(rawData, client);
|
|
@@ -1678,6 +1693,14 @@ var BaseInteraction = class {
|
|
|
1678
1693
|
set responseState(nextState) {
|
|
1679
1694
|
this.response.state = nextState;
|
|
1680
1695
|
}
|
|
1696
|
+
/**
|
|
1697
|
+
* True once a follow-up message has been delivered. Follow-ups are visible to
|
|
1698
|
+
* the user but never advance `responseState`, so this is the only record that
|
|
1699
|
+
* the interaction has already produced output.
|
|
1700
|
+
*/
|
|
1701
|
+
get hasSentFollowUp() {
|
|
1702
|
+
return this.sentFollowUp;
|
|
1703
|
+
}
|
|
1681
1704
|
enqueueResponse(operation) {
|
|
1682
1705
|
const result = this.pendingResponse.then(operation);
|
|
1683
1706
|
this.pendingResponse = result.then(() => void 0, () => void 0);
|
|
@@ -1712,6 +1735,24 @@ var BaseInteraction = class {
|
|
|
1712
1735
|
async editReply(payload) {
|
|
1713
1736
|
return await this.enqueueResponse(() => this.performReplyEdit(payload));
|
|
1714
1737
|
}
|
|
1738
|
+
/**
|
|
1739
|
+
* Edits the deferred placeholder only if this interaction is still an
|
|
1740
|
+
* unanswered spinner when the queue reaches this operation.
|
|
1741
|
+
*
|
|
1742
|
+
* Both conditions are re-read inside the queue. A follow-up that was still in
|
|
1743
|
+
* flight when the caller decided to report will have settled — and recorded
|
|
1744
|
+
* itself in `sentFollowUp` — by the time this runs, so the decision cannot be
|
|
1745
|
+
* made against state that is about to change.
|
|
1746
|
+
*
|
|
1747
|
+
* Resolves true when the edit was sent.
|
|
1748
|
+
*/
|
|
1749
|
+
async editDeferredPlaceholderIfUnanswered(payload) {
|
|
1750
|
+
return await this.enqueueResponse(async () => {
|
|
1751
|
+
if (this.responseState !== "deferred" || this.sentFollowUp) return false;
|
|
1752
|
+
await this.performReplyEdit(payload);
|
|
1753
|
+
return true;
|
|
1754
|
+
});
|
|
1755
|
+
}
|
|
1715
1756
|
async performReplyEdit(payload) {
|
|
1716
1757
|
const body = serializePayload(payload);
|
|
1717
1758
|
const query = needsComponentsV2Query(body) ? { with_components: true } : void 0;
|
|
@@ -1741,7 +1782,9 @@ var BaseInteraction = class {
|
|
|
1741
1782
|
}
|
|
1742
1783
|
async performFollowUp(payload) {
|
|
1743
1784
|
const body = serializePayload(payload);
|
|
1744
|
-
|
|
1785
|
+
const result = await createWebhookMessage(this.client.rest, this.client.options.clientId, this.token, { body }, needsComponentsV2Query(body) ? { with_components: true } : void 0);
|
|
1786
|
+
this.sentFollowUp = true;
|
|
1787
|
+
return result;
|
|
1745
1788
|
}
|
|
1746
1789
|
};
|
|
1747
1790
|
var CommandInteraction = class extends BaseInteraction {
|
|
@@ -1830,6 +1873,14 @@ async function dispatchInteraction(client, rawData) {
|
|
|
1830
1873
|
if (command.commandKind === "leaf") await command.autocomplete(autocompleteInteraction);
|
|
1831
1874
|
return;
|
|
1832
1875
|
}
|
|
1876
|
+
try {
|
|
1877
|
+
await dispatchAcknowledgeableInteraction(client, rawData, interaction);
|
|
1878
|
+
} catch (error) {
|
|
1879
|
+
await reportInteractionFailure(interaction);
|
|
1880
|
+
throw error;
|
|
1881
|
+
}
|
|
1882
|
+
}
|
|
1883
|
+
async function dispatchAcknowledgeableInteraction(client, rawData, interaction) {
|
|
1833
1884
|
if (rawData.type === InteractionType.ApplicationCommand) {
|
|
1834
1885
|
const command = client.commands.find((entry) => entry.name === readInteractionName(rawData));
|
|
1835
1886
|
if (command) {
|
|
@@ -1865,6 +1916,44 @@ async function dispatchInteraction(client, rawData) {
|
|
|
1865
1916
|
if (modal) await modal.run(interaction, modal.customIdParser(customId).data);
|
|
1866
1917
|
}
|
|
1867
1918
|
}
|
|
1919
|
+
/**
|
|
1920
|
+
* Fixed text. The thrown error is deliberately not echoed here: an interaction
|
|
1921
|
+
* response is visible to the whole channel, and handler exceptions routinely
|
|
1922
|
+
* carry absolute paths, config keys, and provider responses. The rethrow keeps
|
|
1923
|
+
* the detail in the Gateway log where operators already look for it.
|
|
1924
|
+
*/
|
|
1925
|
+
const INTERACTION_FAILURE_NOTICE = "Command failed. Check the Gateway logs for details.";
|
|
1926
|
+
/**
|
|
1927
|
+
* Best-effort user-visible notice for a failed interaction. Never throws: a
|
|
1928
|
+
* reporting failure must not mask the original error.
|
|
1929
|
+
*
|
|
1930
|
+
* Deliberately narrow. It reports only for `deferred`, where a spinner is known
|
|
1931
|
+
* to exist and the original response is a placeholder this dispatch created:
|
|
1932
|
+
*
|
|
1933
|
+
* - `deferred` the deferring callback succeeded (state advances only
|
|
1934
|
+
* after a REST success), so editing the original response
|
|
1935
|
+
* resolves a spinner that would otherwise hang forever.
|
|
1936
|
+
* - `deferred-update` a component acknowledgement. Discord leaves no spinner,
|
|
1937
|
+
* and the original response is the message the component is
|
|
1938
|
+
* attached to, so editing it would overwrite content the
|
|
1939
|
+
* user is still reading.
|
|
1940
|
+
* - `unacknowledged` nothing is known to have reached Discord. A second
|
|
1941
|
+
* initial callback risks "already acknowledged" if the
|
|
1942
|
+
* first one landed after all, and Discord already shows its
|
|
1943
|
+
* own "did not respond" notice.
|
|
1944
|
+
* - `replied` the user has seen a message, and nextReplyAction() would
|
|
1945
|
+
* turn this into a contradictory follow-up beside it.
|
|
1946
|
+
*/
|
|
1947
|
+
async function reportInteractionFailure(interaction) {
|
|
1948
|
+
if (interaction.responseState !== "deferred") return;
|
|
1949
|
+
if (interaction.hasSentFollowUp) return;
|
|
1950
|
+
try {
|
|
1951
|
+
await interaction.editDeferredPlaceholderIfUnanswered({
|
|
1952
|
+
content: INTERACTION_FAILURE_NOTICE,
|
|
1953
|
+
allowed_mentions: { parse: [] }
|
|
1954
|
+
});
|
|
1955
|
+
} catch {}
|
|
1956
|
+
}
|
|
1868
1957
|
function resolveConditionalComponentOption(value, interaction) {
|
|
1869
1958
|
return typeof value === "function" ? value(interaction) : value;
|
|
1870
1959
|
}
|
|
@@ -2774,6 +2863,9 @@ var Client = class {
|
|
|
2774
2863
|
async fetchMember(guildId, userId) {
|
|
2775
2864
|
return await this.entityCache.fetchMember(guildId, userId);
|
|
2776
2865
|
}
|
|
2866
|
+
async fetchGuildEmojis(guildId, fetcher) {
|
|
2867
|
+
return await this.entityCache.fetchGuildEmojis(guildId, fetcher);
|
|
2868
|
+
}
|
|
2777
2869
|
async deployCommands(options = {}) {
|
|
2778
2870
|
return await this.commandDeployer.deploy(options);
|
|
2779
2871
|
}
|
|
@@ -2998,6 +3090,55 @@ var discord_exports = /* @__PURE__ */ __exportAll({
|
|
|
2998
3090
|
import * as import_discord_api_types_v10 from "discord-api-types/v10";
|
|
2999
3091
|
__reExport(discord_exports, import_discord_api_types_v10);
|
|
3000
3092
|
//#endregion
|
|
3093
|
+
//#region extensions/discord/src/target-parsing.ts
|
|
3094
|
+
function parseDiscordTarget(raw, options = {}) {
|
|
3095
|
+
const trimmed = raw.trim();
|
|
3096
|
+
if (!trimmed) return;
|
|
3097
|
+
const providerPrefixedTarget = parseDiscordProviderPrefixedTarget(trimmed);
|
|
3098
|
+
if (providerPrefixedTarget) return providerPrefixedTarget;
|
|
3099
|
+
const userTarget = parseMentionPrefixOrAtUserTarget({
|
|
3100
|
+
raw: trimmed,
|
|
3101
|
+
mentionPattern: /^<@!?(\d+)>$/,
|
|
3102
|
+
prefixes: [
|
|
3103
|
+
{
|
|
3104
|
+
prefix: "user:",
|
|
3105
|
+
kind: "user"
|
|
3106
|
+
},
|
|
3107
|
+
{
|
|
3108
|
+
prefix: "channel:",
|
|
3109
|
+
kind: "channel"
|
|
3110
|
+
},
|
|
3111
|
+
{
|
|
3112
|
+
prefix: "discord:",
|
|
3113
|
+
kind: "user"
|
|
3114
|
+
}
|
|
3115
|
+
],
|
|
3116
|
+
atUserPattern: /^\d+$/,
|
|
3117
|
+
atUserErrorMessage: "Discord DMs require a user id (use user:<id> or a <@id> mention)"
|
|
3118
|
+
});
|
|
3119
|
+
if (userTarget) return userTarget;
|
|
3120
|
+
if (/^\d+$/.test(trimmed)) {
|
|
3121
|
+
if (options.defaultKind) return buildMessagingTarget(options.defaultKind, trimmed, trimmed);
|
|
3122
|
+
throw new Error(options.ambiguousMessage ?? `Ambiguous Discord recipient "${trimmed}". For DMs use "user:${trimmed}" or "<@${trimmed}>"; for channels use "channel:${trimmed}".`);
|
|
3123
|
+
}
|
|
3124
|
+
return buildMessagingTarget("channel", trimmed, trimmed);
|
|
3125
|
+
}
|
|
3126
|
+
function parseDiscordProviderPrefixedTarget(raw) {
|
|
3127
|
+
const match = /^discord:(channel|user):(.+)$/i.exec(raw);
|
|
3128
|
+
if (!match) return;
|
|
3129
|
+
const kind = match[1]?.toLowerCase();
|
|
3130
|
+
const id = match[2]?.trim();
|
|
3131
|
+
if (!kind || !id) return;
|
|
3132
|
+
return buildMessagingTarget(kind, id, `${kind}:${id}`);
|
|
3133
|
+
}
|
|
3134
|
+
function resolveDiscordChannelId(raw) {
|
|
3135
|
+
return requireTargetKind({
|
|
3136
|
+
platform: "Discord",
|
|
3137
|
+
target: parseDiscordTarget(raw, { defaultKind: "channel" }),
|
|
3138
|
+
kind: "channel"
|
|
3139
|
+
});
|
|
3140
|
+
}
|
|
3141
|
+
//#endregion
|
|
3001
3142
|
//#region extensions/discord/src/normalize.ts
|
|
3002
3143
|
function normalizeDiscordMessagingTarget(raw) {
|
|
3003
3144
|
return parseDiscordTarget(raw, { defaultKind: "channel" })?.normalized;
|
|
@@ -3079,6 +3220,79 @@ function resolveDiscordReplyMessageId(reply, isFirst) {
|
|
|
3079
3220
|
return reply && (isFirst || reply.scope === "all") ? reply.messageId : void 0;
|
|
3080
3221
|
}
|
|
3081
3222
|
//#endregion
|
|
3223
|
+
//#region extensions/discord/src/send.receipt.ts
|
|
3224
|
+
function toDiscordOutboundDeliveryResult(result) {
|
|
3225
|
+
const { channelId, ...delivery } = result;
|
|
3226
|
+
return {
|
|
3227
|
+
...delivery,
|
|
3228
|
+
target: {
|
|
3229
|
+
kind: "channel",
|
|
3230
|
+
id: channelId
|
|
3231
|
+
}
|
|
3232
|
+
};
|
|
3233
|
+
}
|
|
3234
|
+
function createDiscordSendReceiptFromResults(params) {
|
|
3235
|
+
const receipt = createMessageReceiptFromOutboundResults({
|
|
3236
|
+
results: attachChannelToResults("discord", params.results),
|
|
3237
|
+
threadId: params.threadId
|
|
3238
|
+
});
|
|
3239
|
+
return {
|
|
3240
|
+
...receipt,
|
|
3241
|
+
parts: receipt.parts.map(({ platformMessageId, kind, threadId, replyToId, raw }, index) => ({
|
|
3242
|
+
platformMessageId,
|
|
3243
|
+
kind,
|
|
3244
|
+
index,
|
|
3245
|
+
threadId,
|
|
3246
|
+
replyToId,
|
|
3247
|
+
raw
|
|
3248
|
+
}))
|
|
3249
|
+
};
|
|
3250
|
+
}
|
|
3251
|
+
function createDiscordSendReceipt(params) {
|
|
3252
|
+
return createMessageReceiptFromOutboundResults({
|
|
3253
|
+
results: params.platformMessageIds.map((messageId) => messageId.trim()).filter((messageId) => messageId && messageId !== "unknown").map((messageId, index) => {
|
|
3254
|
+
const result = {
|
|
3255
|
+
channel: "discord",
|
|
3256
|
+
messageId
|
|
3257
|
+
};
|
|
3258
|
+
if (params.channelId) result.channelId = params.channelId;
|
|
3259
|
+
if (params.reply?.scope === "first" && index === 0) {
|
|
3260
|
+
const rawResult = {
|
|
3261
|
+
channel: "discord",
|
|
3262
|
+
messageId
|
|
3263
|
+
};
|
|
3264
|
+
if (params.channelId) rawResult.channelId = params.channelId;
|
|
3265
|
+
result.receipt = createMessageReceiptFromOutboundResults({
|
|
3266
|
+
results: [rawResult],
|
|
3267
|
+
kind: params.kind,
|
|
3268
|
+
threadId: params.threadId,
|
|
3269
|
+
replyToId: params.reply.messageId
|
|
3270
|
+
});
|
|
3271
|
+
}
|
|
3272
|
+
return result;
|
|
3273
|
+
}),
|
|
3274
|
+
kind: params.kind,
|
|
3275
|
+
threadId: params.threadId,
|
|
3276
|
+
replyToId: params.reply?.scope === "all" ? params.reply.messageId : void 0
|
|
3277
|
+
});
|
|
3278
|
+
}
|
|
3279
|
+
function createDiscordSendResult(params) {
|
|
3280
|
+
const messageId = params.result.id || "unknown";
|
|
3281
|
+
const channelId = params.result.channel_id ?? params.fallbackChannelId;
|
|
3282
|
+
const receiptParams = {
|
|
3283
|
+
platformMessageIds: params.result.platformMessageIds?.length ? params.result.platformMessageIds : [messageId],
|
|
3284
|
+
channelId,
|
|
3285
|
+
kind: params.kind
|
|
3286
|
+
};
|
|
3287
|
+
if (params.threadId != null) receiptParams.threadId = String(params.threadId);
|
|
3288
|
+
if (params.reply) receiptParams.reply = params.reply;
|
|
3289
|
+
return {
|
|
3290
|
+
messageId,
|
|
3291
|
+
channelId,
|
|
3292
|
+
receipt: createDiscordSendReceipt(receiptParams)
|
|
3293
|
+
};
|
|
3294
|
+
}
|
|
3295
|
+
//#endregion
|
|
3082
3296
|
//#region extensions/discord/src/chunk.ts
|
|
3083
3297
|
const DEFAULT_MAX_CHARS = 2e3;
|
|
3084
3298
|
const DEFAULT_MAX_LINES = 17;
|
|
@@ -3401,4 +3615,4 @@ function createDiscordRetryRunner(params) {
|
|
|
3401
3615
|
};
|
|
3402
3616
|
}
|
|
3403
3617
|
//#endregion
|
|
3404
|
-
export {
|
|
3618
|
+
export { TextInput as $, listGuildRoles as $t, ThreadUpdateListener as A, getChannel as At, readRetryAfter as B, addGuildMemberRole as Bt, MessageCreateListener as C, listMessageReactionUsers as Ct, ReadyListener as D, deleteChannelMessage as Dt, PresenceUpdateListener as E, deleteChannel as Et, DiscordError as F, listChannelPins as Ft, User as G, createGuildSticker as Gt, CommandWithSubcommands as H, createGuildChannel as Ht, RateLimitError as I, pinChannelMessage as It, Embed as J, getGuildMember as Jt, hasDiscordV2Components as K, deleteChannelPermission as Kt, isUnknownDiscordVoiceStateError as L, searchGuildMessages as Lt, Client as M, getThreadMember as Mt, Plugin as N, listChannelArchivedThreads as Nt, ResumedListener as O, editChannel as Ot, RequestClient as P, listChannelMessages as Pt, RadioGroup as Q, listGuildEmojis as Qt, readDiscordCode as R, sendChannelTyping as Rt, InteractionCreateListener as S, deleteOwnMessageReaction as St, MessageReactionRemoveListener as T, createThread as Tt, Guild as U, createGuildEmoji as Ut, Command as V, createGuildBan as Vt, Message as W, createGuildScheduledEvent as Wt, Label as X, listGuildActiveThreads as Xt, CheckboxGroup as Y, getGuildVoiceState as Yt, Modal as Z, listGuildChannels as Zt, parseDiscordTarget as _, stripUndefinedFields as _t, chunkDiscordTextWithMode as a, timeoutGuildMember as an, MediaGallery as at, GuildCreateListener as b, getCurrentUser as bt, createDiscordSendResult as c, Row as ct, resolveDiscordReplyMessageId as d, StringSelectMenu as dt, listGuildScheduledEvents as en, Button as et, resolveDiscordReplyReference as f, TextDisplay as ft, normalizeDiscordOutboundTarget as g, parseCustomId as gt, normalizeDiscordMessagingTarget as h, BaseMessageInteractiveComponent as ht, recordDiscordMessageCreateAmbiguity as i, removeGuildMemberRole as in, LinkButton as it, VoiceStateUpdateListener as j, getChannelMessage as jt, ThreadDeleteListener as k, editChannelMessage as kt, toDiscordOutboundDeliveryResult as l, Section as lt, looksLikeDiscordTargetId as m, UserSelectMenu as mt, createDiscordRetryRunner as n, putChannelPermission as nn, Container as nt, createDiscordSendReceipt as o, __exportAll as on, MentionableSelectMenu as ot, allowFromContainsDiscordUserId as p, Thumbnail as pt, serializePayload as q, getGuild as qt, hasDiscordMessageCreateAmbiguity as r, removeGuildMember as rn, File as rt, createDiscordSendReceiptFromResults as s, RoleSelectMenu as st, classifyDiscordDeliveryFailure as t, moveGuildChannels as tn, ChannelSelectMenu as tt, createReusableDiscordReplyReference as u, Separator as ut, resolveDiscordChannelId as v, createChannelWebhook as vt, MessageReactionAddListener as w, createChannelMessage as wt, GuildDeleteListener as x, createOwnMessageReaction as xt, discord_exports as y, createUserDmChannel as yt, readDiscordMessage as z, unpinChannelMessage as zt };
|
|
@@ -1,19 +1,21 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { r as sendDiscordComponentMessage } from "./send.components-
|
|
1
|
+
import { f as resolveDiscordReplyReference, u as createReusableDiscordReplyReference, v as resolveDiscordChannelId } from "./retry-DqHCW6PV.js";
|
|
2
|
+
import { h as readDiscordComponentSpec, m as coerceDiscordComponentParam } from "./components-Dk35LTf_.js";
|
|
3
|
+
import { o as mergeDiscordAccountConfig, s as resolveDefaultDiscordAccountId, t as createDiscordActionGate } from "./accounts-CfQ-vSyf.js";
|
|
4
|
+
import { r as sendDiscordComponentMessage } from "./send.components-CrBJpGT_.js";
|
|
5
5
|
import { a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, n as isDiscordGroupAllowedByPolicy, v as resolveGroupDmAllow } from "./allow-list-BDMimASD.js";
|
|
6
|
-
import {
|
|
7
|
-
import { r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-
|
|
6
|
+
import { F as createDiscordRuntimeAccountContext, T as hasAnyGuildPermissionDiscord, U as getGateway, d as resolveDiscordTargetChannelId, v as canManageGuildMemberRoleDiscord, w as hasAnyChannelPermissionDiscord, x as fetchChannelPermissionsDiscord, y as canManageGuildRoleDiscord } from "./send.shared-DZJ1akvQ.js";
|
|
7
|
+
import { r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-D7JYmfm9.js";
|
|
8
|
+
import { t as isDiscordThreadChannelType } from "./channel-type-CVLZyGYS.js";
|
|
8
9
|
import { n as getPresence } from "./presence-cache-z1N8MbJ3.js";
|
|
9
|
-
import { A as
|
|
10
|
-
import
|
|
11
|
-
import "./targets-B2pf49zc.js";
|
|
10
|
+
import { A as listScheduledEventsDiscord, B as moveChannelDiscord, C as fetchChannelInfoDiscord, D as fetchVoiceStatusDiscord, E as fetchRoleInfoDiscord, F as uploadEmojiDiscord, H as setChannelPermissionDiscord, I as uploadStickerDiscord, L as createChannelDiscord, M as resolveEventCoverImage, N as timeoutMemberDiscord, O as kickMemberDiscord, P as listGuildEmojisDiscord, R as deleteChannelDiscord, S as createScheduledEventDiscord, T as fetchMemberInfoDiscord, V as removeChannelPermissionDiscord, _ as readMessagesDiscord, a as removeReactionDiscord, b as addRoleDiscord, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, l as DiscordThreadInitialMessageError, m as listPinsDiscord, n as fetchReactionsDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, w as fetchGuildInfoDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-UJHiAm4C.js";
|
|
11
|
+
import "./targets-CQp53cGj.js";
|
|
12
12
|
import { ChannelType, PermissionFlagsBits } from "discord-api-types/v10";
|
|
13
13
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
14
14
|
import { asBoolean, isRecord, normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
15
15
|
import { resolveOpenProviderRuntimeGroupPolicy } from "openclaw/plugin-sdk/runtime-group-policy";
|
|
16
|
+
import { assertMediaNotDataUrl, jsonResult, parseAvailableTags, readNonNegativeIntegerParam, readPositiveIntegerParam, readReactionParams, readStringArrayParam, readStringParam, withNormalizedTimestamp } from "openclaw/plugin-sdk/channel-actions";
|
|
16
17
|
import { normalizeAccountId } from "openclaw/plugin-sdk/account-resolution";
|
|
18
|
+
import { readBooleanParam } from "openclaw/plugin-sdk/boolean-param";
|
|
17
19
|
//#region extensions/discord/src/actions/runtime-deps.ts
|
|
18
20
|
const discordGuildActionRuntime = {
|
|
19
21
|
addRoleDiscord,
|
|
@@ -241,8 +243,7 @@ function readDiscordChannelType(value) {
|
|
|
241
243
|
return typeof type === "number" ? type : void 0;
|
|
242
244
|
}
|
|
243
245
|
function isDiscordThreadChannel(value) {
|
|
244
|
-
|
|
245
|
-
return type === 10 || type === 11 || type === 12;
|
|
246
|
+
return isDiscordThreadChannelType(readDiscordChannelType(value));
|
|
246
247
|
}
|
|
247
248
|
function isDiscordReadAncestryAllowed(params) {
|
|
248
249
|
for (const ancestor of params.target.ancestors) {
|
|
@@ -623,9 +624,6 @@ const guildAdminActionGuards = {
|
|
|
623
624
|
channelPermissionSet: channelPermissionGuard,
|
|
624
625
|
channelPermissionRemove: channelPermissionGuard
|
|
625
626
|
};
|
|
626
|
-
function isThreadChannelType(channelType) {
|
|
627
|
-
return channelType === ChannelType.GuildNewsThread || channelType === ChannelType.GuildPublicThread || channelType === ChannelType.GuildPrivateThread;
|
|
628
|
-
}
|
|
629
627
|
function isLockedThreadChannel(channel) {
|
|
630
628
|
if (!channel || typeof channel !== "object") return false;
|
|
631
629
|
return channel.thread_metadata?.locked === true;
|
|
@@ -658,7 +656,7 @@ async function resolveGuildAdminActionPermissions(params) {
|
|
|
658
656
|
cfg: params.cfg,
|
|
659
657
|
accountId: params.accountId
|
|
660
658
|
}));
|
|
661
|
-
if (!
|
|
659
|
+
if (!isDiscordThreadChannelType("type" in channel ? channel.type : void 0)) return params.guard.permissions;
|
|
662
660
|
return params.values.archived === false && !("name" in params.values) && !("topic" in params.values) && !("position" in params.values) && !("parentId" in params.values) && !("clearParent" in params.values) && !("nsfw" in params.values) && !("rateLimitPerUser" in params.values) && !("locked" in params.values) && !("autoArchiveDuration" in params.values) && !isLockedThreadChannel(channel) ? [PermissionFlagsBits.ManageThreads, PermissionFlagsBits.SendMessagesInThreads] : [PermissionFlagsBits.ManageThreads];
|
|
663
661
|
}
|
|
664
662
|
async function verifySenderGuildAdminPermission(params) {
|
|
@@ -772,11 +770,23 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
|
|
|
772
770
|
}
|
|
773
771
|
case "emojiList": {
|
|
774
772
|
if (!isActionEnabled("reactions")) throw new Error("Discord reactions are disabled.");
|
|
775
|
-
const guildId =
|
|
773
|
+
const guildId = await resolveGuildIdForGuildAdminAction({
|
|
774
|
+
values: params,
|
|
775
|
+
accountId,
|
|
776
|
+
cfg
|
|
777
|
+
});
|
|
778
|
+
if (!guildId) throw new Error("Discord emoji listing requires guildId or a server channel.");
|
|
776
779
|
await assertGuildMetadataReadAllowed(guildId);
|
|
780
|
+
const limit = Math.min(readPositiveIntegerParam(params, "limit") ?? 100, 100);
|
|
781
|
+
const fetchEmojis = async () => (await discordGuildActionRuntime.listGuildEmojisDiscord(guildId, withOpts())).flatMap(({ name, id, animated }) => name && id ? [{
|
|
782
|
+
name,
|
|
783
|
+
identifier: `${name}:${id}`,
|
|
784
|
+
...animated ? { animated } : {}
|
|
785
|
+
}] : []).toSorted((left, right) => left.name.localeCompare(right.name) || left.identifier.localeCompare(right.identifier));
|
|
786
|
+
const gateway = getGateway(accountId ?? resolveDefaultDiscordAccountId(cfg));
|
|
777
787
|
return jsonResult({
|
|
778
788
|
ok: true,
|
|
779
|
-
emojis: await
|
|
789
|
+
emojis: (gateway ? await gateway.fetchGuildEmojis(guildId, fetchEmojis) : await fetchEmojis()).slice(0, limit)
|
|
780
790
|
});
|
|
781
791
|
}
|
|
782
792
|
case "emojiUpload": {
|
|
@@ -1259,7 +1269,7 @@ async function appendDiscordThreadRenameResult(ctx, params) {
|
|
|
1259
1269
|
};
|
|
1260
1270
|
}
|
|
1261
1271
|
try {
|
|
1262
|
-
if (!
|
|
1272
|
+
if (!isDiscordThreadChannelType((await discordMessagingActionRuntime.fetchChannelInfoDiscord(channelId, ctx.withOpts())).type)) return {
|
|
1263
1273
|
...params.payload,
|
|
1264
1274
|
warning: "Discord threadName was ignored because the send target is not a thread."
|
|
1265
1275
|
};
|
|
@@ -1292,8 +1302,13 @@ async function handleDiscordMessageSendAction(ctx) {
|
|
|
1292
1302
|
required: true,
|
|
1293
1303
|
label: "stickerIds"
|
|
1294
1304
|
});
|
|
1295
|
-
|
|
1296
|
-
|
|
1305
|
+
return jsonResult({
|
|
1306
|
+
ok: true,
|
|
1307
|
+
result: await discordMessagingActionRuntime.sendStickerDiscord(to, stickerIds, ctx.withOpts({
|
|
1308
|
+
content,
|
|
1309
|
+
...ctx.params.silent === true ? { silent: true } : {}
|
|
1310
|
+
}))
|
|
1311
|
+
});
|
|
1297
1312
|
}
|
|
1298
1313
|
case "sendMessage": {
|
|
1299
1314
|
if (!ctx.isActionEnabled("messages")) throw new Error("Discord message sends are disabled.");
|
|
@@ -1301,7 +1316,7 @@ async function handleDiscordMessageSendAction(ctx) {
|
|
|
1301
1316
|
const asVoice = ctx.params.asVoice === true;
|
|
1302
1317
|
const silent = ctx.params.silent === true;
|
|
1303
1318
|
const suppressEmbeds = ctx.params.suppressEmbeds === void 0 ? void 0 : ctx.params.suppressEmbeds === true;
|
|
1304
|
-
const rawComponents = ctx.params.components;
|
|
1319
|
+
const rawComponents = coerceDiscordComponentParam(ctx.params.components);
|
|
1305
1320
|
const componentSpec = hasDiscordComponentObjectKeys(rawComponents) ? discordMessagingActionRuntime.readDiscordComponentSpec(rawComponents) : null;
|
|
1306
1321
|
const components = Array.isArray(rawComponents) || typeof rawComponents === "function" ? rawComponents : void 0;
|
|
1307
1322
|
const mediaUrl = readStringParam(ctx.params, "mediaUrl", { trim: false }) ?? readStringParam(ctx.params, "path", { trim: false }) ?? readStringParam(ctx.params, "filePath", { trim: false });
|
|
@@ -1324,25 +1339,26 @@ async function handleDiscordMessageSendAction(ctx) {
|
|
|
1324
1339
|
...componentSpec,
|
|
1325
1340
|
text: normalizedContent
|
|
1326
1341
|
};
|
|
1342
|
+
const result = await discordMessagingActionRuntime.sendDiscordComponentMessage(to, payload, {
|
|
1343
|
+
...ctx.withOpts(),
|
|
1344
|
+
silent,
|
|
1345
|
+
reply: resolveActionReplyReference(ctx, replyTo),
|
|
1346
|
+
sessionKey: sessionKey ?? void 0,
|
|
1347
|
+
agentId: agentId ?? void 0,
|
|
1348
|
+
mediaUrl: mediaUrl ?? void 0,
|
|
1349
|
+
filename: filename ?? void 0,
|
|
1350
|
+
mediaAccess: ctx.options?.mediaAccess,
|
|
1351
|
+
mediaLocalRoots: ctx.options?.mediaLocalRoots,
|
|
1352
|
+
mediaReadFile: ctx.options?.mediaReadFile,
|
|
1353
|
+
...suppressEmbeds === void 0 ? {} : { suppressEmbeds }
|
|
1354
|
+
});
|
|
1327
1355
|
return jsonResult(await appendDiscordThreadRenameResult(ctx, {
|
|
1328
1356
|
payload: {
|
|
1329
1357
|
ok: true,
|
|
1330
|
-
result
|
|
1331
|
-
...ctx.withOpts(),
|
|
1332
|
-
silent,
|
|
1333
|
-
reply: resolveActionReplyReference(ctx, replyTo),
|
|
1334
|
-
sessionKey: sessionKey ?? void 0,
|
|
1335
|
-
agentId: agentId ?? void 0,
|
|
1336
|
-
mediaUrl: mediaUrl ?? void 0,
|
|
1337
|
-
filename: filename ?? void 0,
|
|
1338
|
-
mediaAccess: ctx.options?.mediaAccess,
|
|
1339
|
-
mediaLocalRoots: ctx.options?.mediaLocalRoots,
|
|
1340
|
-
mediaReadFile: ctx.options?.mediaReadFile,
|
|
1341
|
-
...suppressEmbeds === void 0 ? {} : { suppressEmbeds }
|
|
1342
|
-
}),
|
|
1358
|
+
result,
|
|
1343
1359
|
components: true
|
|
1344
1360
|
},
|
|
1345
|
-
target: to,
|
|
1361
|
+
target: result.receipt?.threadId ?? to,
|
|
1346
1362
|
threadName
|
|
1347
1363
|
}));
|
|
1348
1364
|
}
|
|
@@ -1367,24 +1383,25 @@ async function handleDiscordMessageSendAction(ctx) {
|
|
|
1367
1383
|
threadName
|
|
1368
1384
|
}));
|
|
1369
1385
|
}
|
|
1386
|
+
const result = await discordMessagingActionRuntime.sendMessageDiscord(to, content ?? "", {
|
|
1387
|
+
...ctx.withOpts(),
|
|
1388
|
+
mediaAccess: ctx.options?.mediaAccess,
|
|
1389
|
+
mediaUrl,
|
|
1390
|
+
filename: filename ?? void 0,
|
|
1391
|
+
mediaLocalRoots: ctx.options?.mediaLocalRoots,
|
|
1392
|
+
mediaReadFile: ctx.options?.mediaReadFile,
|
|
1393
|
+
reply: resolveActionReplyReference(ctx, replyTo),
|
|
1394
|
+
components,
|
|
1395
|
+
embeds,
|
|
1396
|
+
silent,
|
|
1397
|
+
...suppressEmbeds === void 0 ? {} : { suppressEmbeds }
|
|
1398
|
+
});
|
|
1370
1399
|
return jsonResult(await appendDiscordThreadRenameResult(ctx, {
|
|
1371
1400
|
payload: {
|
|
1372
1401
|
ok: true,
|
|
1373
|
-
result
|
|
1374
|
-
...ctx.withOpts(),
|
|
1375
|
-
mediaAccess: ctx.options?.mediaAccess,
|
|
1376
|
-
mediaUrl,
|
|
1377
|
-
filename: filename ?? void 0,
|
|
1378
|
-
mediaLocalRoots: ctx.options?.mediaLocalRoots,
|
|
1379
|
-
mediaReadFile: ctx.options?.mediaReadFile,
|
|
1380
|
-
reply: resolveActionReplyReference(ctx, replyTo),
|
|
1381
|
-
components,
|
|
1382
|
-
embeds,
|
|
1383
|
-
silent,
|
|
1384
|
-
...suppressEmbeds === void 0 ? {} : { suppressEmbeds }
|
|
1385
|
-
})
|
|
1402
|
+
result
|
|
1386
1403
|
},
|
|
1387
|
-
target: to,
|
|
1404
|
+
target: result.receipt?.threadId ?? to,
|
|
1388
1405
|
threadName
|
|
1389
1406
|
}));
|
|
1390
1407
|
}
|
|
@@ -1465,7 +1482,8 @@ async function handleDiscordMessageSendAction(ctx) {
|
|
|
1465
1482
|
mediaAccess: ctx.options?.mediaAccess,
|
|
1466
1483
|
mediaLocalRoots: ctx.options?.mediaLocalRoots,
|
|
1467
1484
|
mediaReadFile: ctx.options?.mediaReadFile,
|
|
1468
|
-
reply: resolveActionReplyReference(ctx, replyTo)
|
|
1485
|
+
reply: resolveActionReplyReference(ctx, replyTo),
|
|
1486
|
+
...ctx.params.silent === true ? { silent: true } : {}
|
|
1469
1487
|
})
|
|
1470
1488
|
});
|
|
1471
1489
|
}
|
|
@@ -1587,13 +1605,13 @@ const VALID_STATUSES = /* @__PURE__ */ new Set([
|
|
|
1587
1605
|
"idle",
|
|
1588
1606
|
"invisible"
|
|
1589
1607
|
]);
|
|
1590
|
-
async function handleDiscordPresenceAction(action, params, isActionEnabled) {
|
|
1608
|
+
async function handleDiscordPresenceAction(action, params, isActionEnabled, cfg) {
|
|
1591
1609
|
if (action !== "setPresence") throw new Error(`Unknown presence action: ${action}`);
|
|
1592
1610
|
if (!isActionEnabled("presence", false)) throw new Error("Discord presence changes are disabled.");
|
|
1593
|
-
const accountId = readStringParam(params, "accountId");
|
|
1611
|
+
const accountId = readStringParam(params, "accountId") ?? resolveDefaultDiscordAccountId(cfg);
|
|
1594
1612
|
const gateway = getGateway(accountId);
|
|
1595
|
-
if (!gateway) throw new Error(`Discord gateway not available
|
|
1596
|
-
if (!gateway.isConnected) throw new Error(`Discord gateway is not connected
|
|
1613
|
+
if (!gateway) throw new Error(`Discord gateway not available for account "${accountId}". The bot may not be connected.`);
|
|
1614
|
+
if (!gateway.isConnected) throw new Error(`Discord gateway is not connected for account "${accountId}".`);
|
|
1597
1615
|
const statusRaw = readStringParam(params, "status") ?? "online";
|
|
1598
1616
|
if (!VALID_STATUSES.has(statusRaw)) throw new Error(`Invalid status "${statusRaw}". Must be one of: ${[...VALID_STATUSES].join(", ")}`);
|
|
1599
1617
|
const status = statusRaw;
|
|
@@ -1681,7 +1699,6 @@ const moderationActions = /* @__PURE__ */ new Set([
|
|
|
1681
1699
|
"kick",
|
|
1682
1700
|
"ban"
|
|
1683
1701
|
]);
|
|
1684
|
-
const presenceActions = /* @__PURE__ */ new Set(["setPresence"]);
|
|
1685
1702
|
async function handleDiscordAction(params, cfg, options) {
|
|
1686
1703
|
const action = readStringParam(params, "action", { required: true });
|
|
1687
1704
|
const isActionEnabled = createDiscordActionGate({
|
|
@@ -1691,7 +1708,7 @@ async function handleDiscordAction(params, cfg, options) {
|
|
|
1691
1708
|
if (messagingActions.has(action)) return await handleDiscordMessagingAction(action, params, isActionEnabled, cfg, options);
|
|
1692
1709
|
if (guildActions.has(action)) return await handleDiscordGuildAction(action, params, isActionEnabled, cfg, options);
|
|
1693
1710
|
if (moderationActions.has(action)) return await handleDiscordModerationAction(action, params, isActionEnabled, cfg);
|
|
1694
|
-
if (
|
|
1711
|
+
if (action === "setPresence") return await handleDiscordPresenceAction(action, params, isActionEnabled, cfg);
|
|
1695
1712
|
throw new Error(`Unknown action: ${action}`);
|
|
1696
1713
|
}
|
|
1697
1714
|
//#endregion
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { c as resolveDiscordAccount, g as selectDiscordActivitiesRuntimeConfig, n as isDiscordAccountEnabledForRuntime, r as listDiscordAccountIds } from "./accounts-
|
|
2
|
-
import {
|
|
1
|
+
import { c as resolveDiscordAccount, g as selectDiscordActivitiesRuntimeConfig, n as isDiscordAccountEnabledForRuntime, r as listDiscordAccountIds } from "./accounts-CfQ-vSyf.js";
|
|
2
|
+
import { z as resolveDiscordProxyFetchForAccount } from "./send.shared-DZJ1akvQ.js";
|
|
3
3
|
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
4
|
//#region extensions/discord/src/activities/config.ts
|
|
5
5
|
function resolveDiscordActivitiesConfig(account, env = process.env) {
|