@openclaw/discord 2026.8.1-beta.3 → 2026.8.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/account-inspect-BY-ve3yH.js +45 -0
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-DNl-oCEw.js → accounts-CwJQoLjM.js} +87 -162
- package/dist/action-runtime-api.js +1 -1
- package/dist/{activities-api-KCBAmWxD.js → activities-api-CkKcHUB6.js} +14 -12
- package/dist/activities-api.js +1 -1
- package/dist/{allow-list-BDMimASD.js → allow-list-C2JuH-R0.js} +10 -6
- package/dist/{api-DNVbJyEy.js → api-BfmEP6wp.js} +6 -5
- package/dist/api.js +18 -18
- package/dist/{approval-handler.runtime-B12RCYr8.js → approval-handler.runtime-DZM6Kt1Z.js} +30 -106
- package/dist/{audit-Yc7eZDd6.js → audit-DIbQA4VT.js} +8 -7
- package/dist/{channel-cXYzGc4L.js → channel-CarzU3bg.js} +25 -25
- package/dist/{channel-actions.runtime-CODTvo7c.js → channel-actions.runtime-B2wMqeVK.js} +60 -57
- 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-z_ewMVa9.js} +18 -18
- package/dist/{components-ezGKo_Yh.js → components-gvRA0oaI.js} +33 -29
- package/dist/{config-schema-DC5kDtQ5.js → config-schema-B797-Spt.js} +21 -14
- package/dist/{conversation-binding-route-D6rCQ5S0.js → conversation-binding-route-DPpBRpYI.js} +1 -1
- package/dist/{directory-config-XyCfoqLg.js → directory-config-AA8wQx0D.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-Df0NbFJB.js → directory-live-D_kFz_Fj.js} +4 -4
- package/dist/{doctor-DYY31GrO.js → doctor-QQTOkBfW.js} +5 -5
- package/dist/{doctor-contract-DsWvKIXF.js → doctor-contract-Co5vRCZ6.js} +9 -6
- package/dist/doctor-contract-api.js +4 -3
- package/dist/{handle-action.guild-admin-6Tvvinsa.js → handle-action.guild-admin-Cc88ZGon.js} +9 -5
- package/dist/index.js +1 -1
- package/dist/ingress-identity-BCzfPPYM.js +60 -0
- package/dist/{message-handler-B61q5MOF.js → message-handler-CAeEpqWo.js} +14 -10
- package/dist/{message-handler.preflight-Bzg_Hawz.js → message-handler.preflight-CoKoE3dY.js} +32 -91
- package/dist/{message-handler.process--4_712Ec.js → message-handler.process-cdIJ_fDT.js} +99 -123
- package/dist/{message-utils-BXLLnFl6.js → message-text-C0K4-fkg.js} +41 -34
- package/dist/{outbound-adapter-DxHTOqiN.js → outbound-adapter-Ch0At5Ra.js} +85 -78
- package/dist/{outbound-components-B2PL0ooH.js → outbound-components-Bnt_7x7r.js} +5 -4
- package/dist/outbound-session-route-CzzerX2K.js +668 -0
- package/dist/{owner-access-Bg41VzAf.js → owner-access-yc1sX7Gx.js} +7 -6
- package/dist/{pluralkit-dUl4v1X3.js → pluralkit-B3cUVI7i.js} +2 -2
- package/dist/{probe-BTdtVRwU.js → probe-3ovFAp3b.js} +3 -3
- package/dist/{probe.runtime-Dq5-PRKT.js → probe.runtime-BckHn3cJ.js} +1 -1
- package/dist/{provider-DlK_ynqt.js → provider-CjI8BSzS.js} +511 -342
- package/dist/{provider-session.runtime-CvvphHvs.js → provider-session.runtime-DdKRMcE9.js} +3 -3
- package/dist/provider.runtime-Bo1WbLLr.js +2 -0
- package/dist/{realtime-session.runtime-ysbMG8v7.js → realtime-session.runtime-37IC-p5K.js} +110 -126
- package/dist/{resolve-allowlist-common-DIVXbD1P.js → resolve-allowlist-common-BJ5UZNNT.js} +3 -3
- package/dist/{resolve-channels-CGeUoIqb.js → resolve-channels-BexR2eUn.js} +6 -5
- package/dist/{resolve-users-BtKxLUZv.js → resolve-users-BtXBCH5W.js} +5 -4
- package/dist/{retry-after-DdLPmPoa.js → retry-after-BrLjLUJi.js} +2 -1
- package/dist/{retry-DNsVTeTo.js → retry-t5RcEsPk.js} +237 -15
- package/dist/{runtime-CQovMsH3.js → runtime-BNlDfLwS.js} +2 -2
- package/dist/{runtime-D71_VFLr.js → runtime-DydyfxST.js} +182 -131
- package/dist/runtime-api.js +19 -26
- package/dist/{secret-config-contract-B3i6WxV5.js → secret-config-contract-DFu9hfU8.js} +14 -6
- package/dist/secret-contract-api.js +1 -1
- 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-mTKSBdmZ.js} +149 -58
- package/dist/{send.components-ChK1wS7w.js → send.components-nsPnc7kK.js} +29 -30
- package/dist/{send.outbound-HIkgji_7.js → send.outbound-CaOs9Zy1.js} +87 -84
- package/dist/{send.shared-B3fpaLWJ.js → send.shared-BJHt0Vyf.js} +55 -33
- package/dist/{sender-identity-BJtfyise.js → sender-identity-Dt0imZyY.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-CaAaoksy.js → shared-BNesVA4P.js} +43 -18
- package/dist/{subagent-hooks-CNT2ZJTJ.js → subagent-hooks-IeZVPLGj.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -6
- package/dist/{system-events-Nuwoq_au.js → system-events-Be5EJI3b.js} +2 -2
- package/dist/{target-resolver-DIXShHaZ.js → target-resolver-C0MnwEki.js} +6 -5
- package/dist/targets-DQSye1Rv.js +3 -0
- package/dist/{thread-bindings-VlymUnbz.js → thread-bindings-wECUSIIG.js} +6 -6
- package/dist/{thread-bindings.manager-CngsgErq.js → thread-bindings.manager-B-3UHCc1.js} +31 -32
- package/dist/{thread-bindings.session-updates-CJb-BpPL.js → thread-bindings.session-updates-CC7HoQvt.js} +2 -1
- package/dist/{threading-DU6pgeGm.js → threading-te5ADPQI.js} +51 -27
- package/dist/{timeouts-B9cy6RvQ.js → timeouts-D86uWLt_.js} +1 -1
- package/dist/{transcripts-source-DeIMNbRh.js → transcripts-source-DkUhR7YK.js} +9 -4
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-oLiS5Z13.js → typing-DAwJF5VT.js} +2 -2
- package/dist/{voice-runtime-CjNFaynA.js → voice-runtime-COyYYTDD.js} +418 -74
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/README.md +1 -1
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/conforms.d.ts +2 -0
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/package.json +3 -3
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubArray.d.ts +2 -0
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubObject.d.ts +2 -0
- package/node_modules/@discord/embedded-app-sdk/node_modules/@types/lodash/stubString.d.ts +2 -0
- 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 +41 -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 +14 -6
- package/package.json +8 -8
- package/skills/discord/SKILL.md +1 -1
- package/dist/account-inspect-D5xmUpnj.js +0 -89
- 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/sdk-runtime-37OU6_Yh.js +0 -369
- 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,15 +1,14 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { d as buildDiscordComponentMessage, f as buildDiscordComponentMessageFlags,
|
|
3
|
-
import { c as resolveDiscordAccount, y as loadOutboundMediaFromUrl } from "./accounts-DNl-oCEw.js";
|
|
1
|
+
import { c as createDiscordSendResult, kt as editChannelMessage, on as __exportAll, q as serializePayload, wt as createChannelMessage } from "./retry-t5RcEsPk.js";
|
|
2
|
+
import { d as buildDiscordComponentMessage, f as buildDiscordComponentMessageFlags, g as resolveDiscordComponentAttachmentName } from "./components-gvRA0oaI.js";
|
|
4
3
|
import { n as getOptionalDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
5
|
-
import {
|
|
6
|
-
import { t as sendMessageDiscord } from "./send.outbound-
|
|
7
|
-
import { r as createDiscordSendResult } from "./send.receipt-Cnhoautb.js";
|
|
4
|
+
import { E as SUPPRESS_NOTIFICATIONS_FLAG, K as parseAndResolveChannelRecipient, N as createDiscordClient, O as createDiscordMessageNonce, l as resolveChannelId, t as buildDiscordSendError, u as resolveDiscordChannel } from "./send.shared-BJHt0Vyf.js";
|
|
5
|
+
import { t as sendMessageDiscord } from "./send.outbound-CaOs9Zy1.js";
|
|
8
6
|
import { ChannelType } from "discord-api-types/v10";
|
|
9
7
|
import { asDateTimestampMs, isFutureDateTimestampMs, resolveDateTimestampMs, resolveExpiresAtMsFromDurationMs } from "openclaw/plugin-sdk/number-runtime";
|
|
10
8
|
import { uniqueStrings } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
11
9
|
import { recordChannelActivity } from "openclaw/plugin-sdk/channel-activity-runtime";
|
|
12
10
|
import { extensionForMime } from "openclaw/plugin-sdk/media-mime";
|
|
11
|
+
import { loadOutboundMediaFromUrl } from "openclaw/plugin-sdk/outbound-media";
|
|
13
12
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
14
13
|
import { createPluginStateErrorReporter } from "openclaw/plugin-sdk/plugin-state-runtime";
|
|
15
14
|
import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
|
|
@@ -29,7 +28,7 @@ const discordComponentRegistryState = resolveGlobalSingleton(Symbol.for("opencla
|
|
|
29
28
|
});
|
|
30
29
|
//#endregion
|
|
31
30
|
//#region extensions/discord/src/components-registry.ts
|
|
32
|
-
const DEFAULT_COMPONENT_TTL_MS =
|
|
31
|
+
const DEFAULT_COMPONENT_TTL_MS = 18e5;
|
|
33
32
|
const PERSISTENT_COMPONENT_NAMESPACE = "discord.components";
|
|
34
33
|
const PERSISTENT_MODAL_NAMESPACE = "discord.modals";
|
|
35
34
|
const PERSISTENT_COMPONENT_MAX_ENTRIES = 500;
|
|
@@ -364,7 +363,7 @@ async function buildDiscordComponentPayload(params) {
|
|
|
364
363
|
});
|
|
365
364
|
const filenameOverride = params.opts.filename?.trim();
|
|
366
365
|
const explicitAttachmentName = extractComponentAttachmentNames(spec)[0];
|
|
367
|
-
resolvedFileName = filenameOverride || media.fileName ||
|
|
366
|
+
resolvedFileName = filenameOverride || explicitAttachmentName || media.fileName || `upload${extensionForMime(media.contentType) ?? ""}`;
|
|
368
367
|
spec = withImplicitComponentAttachmentBlock(spec, resolvedFileName);
|
|
369
368
|
files = [{
|
|
370
369
|
data: media.buffer,
|
|
@@ -372,7 +371,8 @@ async function buildDiscordComponentPayload(params) {
|
|
|
372
371
|
contentType: media.contentType
|
|
373
372
|
}];
|
|
374
373
|
}
|
|
375
|
-
const
|
|
374
|
+
const attachmentNames = extractComponentAttachmentNames(spec);
|
|
375
|
+
const uniqueAttachmentNames = uniqueStrings(attachmentNames);
|
|
376
376
|
if (uniqueAttachmentNames.length > 1) throw new Error("Discord component attachments currently support a single file. Use media-gallery for multiple files.");
|
|
377
377
|
const expectedAttachmentName = uniqueAttachmentNames[0];
|
|
378
378
|
if (expectedAttachmentName && resolvedFileName && expectedAttachmentName !== resolvedFileName) throw new Error(`Component file block expects attachment "${expectedAttachmentName}", but the uploaded file is "${resolvedFileName}". Update components.blocks[].file or provide a matching filename.`);
|
|
@@ -385,14 +385,15 @@ async function buildDiscordComponentPayload(params) {
|
|
|
385
385
|
});
|
|
386
386
|
const flags = buildDiscordComponentMessageFlags(buildResult.components);
|
|
387
387
|
const finalFlags = params.opts.silent ? (flags ?? 0) | SUPPRESS_NOTIFICATIONS_FLAG : flags ?? void 0;
|
|
388
|
+
const payload = {
|
|
389
|
+
components: buildResult.components,
|
|
390
|
+
allowed_mentions: params.opts.allowedMentions,
|
|
391
|
+
...finalFlags ? { flags: finalFlags } : {},
|
|
392
|
+
...files ? { files } : {}
|
|
393
|
+
};
|
|
388
394
|
return {
|
|
389
395
|
body: {
|
|
390
|
-
...serializePayload(
|
|
391
|
-
components: buildResult.components,
|
|
392
|
-
allowed_mentions: params.opts.allowedMentions,
|
|
393
|
-
...finalFlags ? { flags: finalFlags } : {},
|
|
394
|
-
...files ? { files } : {}
|
|
395
|
-
}),
|
|
396
|
+
...serializePayload(payload),
|
|
396
397
|
...messageReference ? { message_reference: messageReference } : {}
|
|
397
398
|
},
|
|
398
399
|
buildResult
|
|
@@ -406,7 +407,7 @@ async function sendDiscordComponentMessage(to, spec, opts) {
|
|
|
406
407
|
token: opts.token,
|
|
407
408
|
rest: opts.rest,
|
|
408
409
|
mediaUrl: opts.mediaUrl,
|
|
409
|
-
filename: opts.filename,
|
|
410
|
+
filename: opts.filename?.trim() || extractComponentAttachmentNames(spec)[0],
|
|
410
411
|
mediaLocalRoots: opts.mediaLocalRoots,
|
|
411
412
|
mediaReadFile: opts.mediaReadFile,
|
|
412
413
|
mediaAccess: opts.mediaAccess,
|
|
@@ -418,18 +419,16 @@ async function sendDiscordComponentMessage(to, spec, opts) {
|
|
|
418
419
|
chunkMode: opts.chunkMode,
|
|
419
420
|
onDeliveryResult: opts.onDeliveryResult,
|
|
420
421
|
onPlatformSendDispatch: opts.onPlatformSendDispatch,
|
|
422
|
+
assertPlatformSendAuthorized: opts.assertPlatformSendAuthorized,
|
|
421
423
|
...opts.suppressEmbeds === void 0 ? {} : { suppressEmbeds: opts.suppressEmbeds }
|
|
422
424
|
});
|
|
423
425
|
const cfg = requireRuntimeConfig(opts.cfg, "Discord component send");
|
|
424
|
-
const accountInfo =
|
|
425
|
-
cfg,
|
|
426
|
-
accountId: opts.accountId
|
|
427
|
-
});
|
|
428
|
-
const { token, rest, request } = createDiscordClient({
|
|
426
|
+
const { token, rest, request, account: accountInfo } = createDiscordClient({
|
|
429
427
|
...opts,
|
|
430
428
|
cfg
|
|
431
429
|
});
|
|
432
|
-
const
|
|
430
|
+
const recipient = await parseAndResolveChannelRecipient(to, cfg, accountInfo.accountId);
|
|
431
|
+
const { channelId } = await resolveChannelId(rest, recipient, request);
|
|
433
432
|
const channel = await resolveDiscordChannel(rest, channelId);
|
|
434
433
|
if (channel && DISCORD_FORUM_LIKE_TYPES.has(channel.type)) throw new Error("Discord components are not supported in forum-style channels");
|
|
435
434
|
const { body: componentBody, buildResult } = await buildDiscordComponentPayload({
|
|
@@ -444,8 +443,11 @@ async function sendDiscordComponentMessage(to, spec, opts) {
|
|
|
444
443
|
};
|
|
445
444
|
let result;
|
|
446
445
|
try {
|
|
447
|
-
await
|
|
448
|
-
|
|
446
|
+
result = await request(async () => {
|
|
447
|
+
await opts.onPlatformSendDispatch?.();
|
|
448
|
+
opts.assertPlatformSendAuthorized?.();
|
|
449
|
+
return createChannelMessage(rest, channelId, { body });
|
|
450
|
+
}, "components", { safety: "nonce-protected-create" });
|
|
449
451
|
} catch (err) {
|
|
450
452
|
throw await buildDiscordSendError(err, {
|
|
451
453
|
channelId,
|
|
@@ -476,15 +478,12 @@ async function sendDiscordComponentMessage(to, spec, opts) {
|
|
|
476
478
|
}
|
|
477
479
|
async function editDiscordComponentMessage(to, messageId, spec, opts) {
|
|
478
480
|
const cfg = requireRuntimeConfig(opts.cfg, "Discord component edit");
|
|
479
|
-
const accountInfo =
|
|
480
|
-
cfg,
|
|
481
|
-
accountId: opts.accountId
|
|
482
|
-
});
|
|
483
|
-
const { token, rest, request } = createDiscordClient({
|
|
481
|
+
const { token, rest, request, account: accountInfo } = createDiscordClient({
|
|
484
482
|
...opts,
|
|
485
483
|
cfg
|
|
486
484
|
});
|
|
487
|
-
const
|
|
485
|
+
const recipient = await parseAndResolveChannelRecipient(to, cfg, accountInfo.accountId);
|
|
486
|
+
const { channelId } = await resolveChannelId(rest, recipient, request);
|
|
488
487
|
const { body, buildResult } = await buildDiscordComponentPayload({
|
|
489
488
|
spec,
|
|
490
489
|
opts,
|
|
@@ -1,8 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import { A as resolveDiscordMessageFlags, M as resolveDiscordSendEmbeds, N as resolveDiscordSuppressEmbeds, O as buildDiscordMessageRequest, P as createDiscordClient, a as normalizeDiscordPollInput, c as normalizeStickerIds, f as sendDiscordMedia, j as resolveDiscordSendComponents, k as createDiscordMessageNonce, l as resolveChannelId, n as buildDiscordTextChunks, p as sendDiscordText, q as parseAndResolveChannelRecipient, t as buildDiscordSendError, u as resolveDiscordChannel } from "./send.shared-B3fpaLWJ.js";
|
|
5
|
-
import { n as createDiscordSendReceiptFromResults, r as createDiscordSendResult } from "./send.receipt-Cnhoautb.js";
|
|
1
|
+
import { Tt as createThread, c as createDiscordSendResult, s as createDiscordSendReceiptFromResults, u as createReusableDiscordReplyReference, wt as createChannelMessage } from "./retry-t5RcEsPk.js";
|
|
2
|
+
import { i as normalizeDiscordHandleKey, o as resolveDiscordDirectoryUserId } from "./directory-live-D_kFz_Fj.js";
|
|
3
|
+
import { A as resolveDiscordSendComponents, D as buildDiscordMessageRequest, K as parseAndResolveChannelRecipient, M as resolveDiscordSuppressEmbeds, N as createDiscordClient, O as createDiscordMessageNonce, a as normalizeDiscordPollInput, c as normalizeStickerIds, f as sendDiscordMedia, j as resolveDiscordSendEmbeds, k as resolveDiscordMessageFlags, l as resolveChannelId, n as buildDiscordTextChunks, p as sendDiscordText, t as buildDiscordSendError, u as resolveDiscordChannel } from "./send.shared-BJHt0Vyf.js";
|
|
6
4
|
import { ChannelType } from "discord-api-types/v10";
|
|
7
5
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
8
6
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
@@ -249,10 +247,12 @@ function normalizeDiscordBold(markdown) {
|
|
|
249
247
|
for (const edit of edits) {
|
|
250
248
|
while ((protectedRanges[rangeIndex]?.end ?? Number.POSITIVE_INFINITY) <= edit.start) rangeIndex += 1;
|
|
251
249
|
const range = protectedRanges[rangeIndex];
|
|
252
|
-
if (range && (edit.consume === 0 ? edit.start >= range.start && edit.start < range.end : edit.start < range.end && edit.start + edit.consume > range.start))
|
|
253
|
-
|
|
254
|
-
|
|
255
|
-
|
|
250
|
+
if (range && (edit.consume === 0 ? edit.start >= range.start && edit.start < range.end : edit.start < range.end && edit.start + edit.consume > range.start)) {
|
|
251
|
+
if (edit.delimiter) protectedSpanIds.add(edit.spanId);
|
|
252
|
+
else {
|
|
253
|
+
protectedEditKeys.add(`${edit.start}:${edit.consume}:${edit.marker}`);
|
|
254
|
+
spansWithProtectedContent.add(edit.spanId);
|
|
255
|
+
}
|
|
256
256
|
}
|
|
257
257
|
}
|
|
258
258
|
for (const spanId of spansWithProtectedContent) {
|
|
@@ -377,23 +377,14 @@ function findFenceEnd(text, startIndex, runLength) {
|
|
|
377
377
|
return text.length;
|
|
378
378
|
}
|
|
379
379
|
function findNextMarkdownCodeSegment(text, startIndex) {
|
|
380
|
-
|
|
381
|
-
|
|
382
|
-
|
|
383
|
-
|
|
384
|
-
|
|
385
|
-
|
|
386
|
-
|
|
387
|
-
|
|
388
|
-
endIndex: inlineEndIndex
|
|
389
|
-
};
|
|
390
|
-
if (runLength >= 3) return {
|
|
391
|
-
startIndex: segmentStart,
|
|
392
|
-
endIndex: findFenceEnd(text, segmentStart, runLength)
|
|
393
|
-
};
|
|
394
|
-
searchIndex = segmentStart + runLength;
|
|
395
|
-
}
|
|
396
|
-
return null;
|
|
380
|
+
const segmentOffset = text.slice(startIndex).search(/(?<=(?:^|[^\\])(?:\\\\)*)`/);
|
|
381
|
+
if (segmentOffset === -1) return null;
|
|
382
|
+
const segmentStart = startIndex + segmentOffset;
|
|
383
|
+
const runLength = countBacktickRun(text, segmentStart);
|
|
384
|
+
return {
|
|
385
|
+
startIndex: segmentStart,
|
|
386
|
+
endIndex: findSameLineBacktickRun(text, segmentStart + runLength, runLength) ?? (runLength >= 3 ? findFenceEnd(text, segmentStart, runLength) : text.length)
|
|
387
|
+
};
|
|
397
388
|
}
|
|
398
389
|
function rewriteDiscordKnownMentions(text, params) {
|
|
399
390
|
if (!text.includes("@")) return text;
|
|
@@ -431,14 +422,16 @@ async function sendDiscordThreadTextChunks(params) {
|
|
|
431
422
|
allowedMentions: params.allowedMentions,
|
|
432
423
|
maxChars: params.maxChars,
|
|
433
424
|
onResult: params.onResult,
|
|
434
|
-
onPlatformSendDispatch: params.onPlatformSendDispatch
|
|
425
|
+
onPlatformSendDispatch: params.onPlatformSendDispatch,
|
|
426
|
+
assertPlatformSendAuthorized: params.assertPlatformSendAuthorized
|
|
435
427
|
});
|
|
436
428
|
}
|
|
437
429
|
/** Discord thread names are capped at 100 characters. */
|
|
438
430
|
const DISCORD_THREAD_NAME_LIMIT = 100;
|
|
439
431
|
/** Derive a thread title from the first non-empty line of the message text. */
|
|
440
432
|
function deriveForumThreadName(text) {
|
|
441
|
-
|
|
433
|
+
const firstLine = normalizeOptionalString(text.split("\n").find((line) => normalizeOptionalString(line))) ?? "";
|
|
434
|
+
return truncateUtf16Safe(firstLine, DISCORD_THREAD_NAME_LIMIT) || (/* @__PURE__ */ new Date()).toISOString().slice(0, 16);
|
|
442
435
|
}
|
|
443
436
|
/** Forum/Media channels cannot receive regular messages; detect them here. */
|
|
444
437
|
function isForumLikeChannel(channel) {
|
|
@@ -456,22 +449,24 @@ function toDiscordSendResult(result, fallbackChannelId, params = {}) {
|
|
|
456
449
|
}
|
|
457
450
|
async function resolveDiscordSendTarget(to, opts) {
|
|
458
451
|
const cfg = requireRuntimeConfig(opts.cfg, "Discord send target resolution");
|
|
459
|
-
const { rest, request } = createDiscordClient({
|
|
452
|
+
const { rest, request, account } = createDiscordClient({
|
|
460
453
|
...opts,
|
|
461
454
|
cfg
|
|
462
455
|
});
|
|
463
|
-
const
|
|
456
|
+
const recipient = await parseAndResolveChannelRecipient(to, cfg, account.accountId);
|
|
457
|
+
const { channelId } = await resolveChannelId(rest, recipient, request);
|
|
464
458
|
return {
|
|
465
459
|
rest,
|
|
466
460
|
request,
|
|
467
|
-
channelId
|
|
461
|
+
channelId,
|
|
462
|
+
account
|
|
468
463
|
};
|
|
469
464
|
}
|
|
470
465
|
async function sendMessageDiscord(to, text, opts) {
|
|
471
466
|
const cfg = requireRuntimeConfig(opts.cfg, "Discord send");
|
|
472
|
-
const accountInfo =
|
|
473
|
-
|
|
474
|
-
|
|
467
|
+
const { token, rest, request, account: accountInfo } = createDiscordClient({
|
|
468
|
+
...opts,
|
|
469
|
+
cfg
|
|
475
470
|
});
|
|
476
471
|
const tableMode = resolveMarkdownTableMode({
|
|
477
472
|
cfg,
|
|
@@ -492,12 +487,20 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
492
487
|
accountId: accountInfo.accountId,
|
|
493
488
|
mentionAliases: accountInfo.config.mentionAliases
|
|
494
489
|
});
|
|
495
|
-
const
|
|
496
|
-
|
|
497
|
-
cfg
|
|
498
|
-
});
|
|
499
|
-
const { channelId } = await resolveChannelId(rest, await parseAndResolveChannelRecipient(to, cfg, opts.accountId), request);
|
|
490
|
+
const recipient = await parseAndResolveChannelRecipient(to, cfg, accountInfo.accountId);
|
|
491
|
+
const { channelId } = await resolveChannelId(rest, recipient, request);
|
|
500
492
|
const channel = await resolveDiscordChannel(rest, channelId);
|
|
493
|
+
const deliveredResults = [];
|
|
494
|
+
let deliveryThreadId;
|
|
495
|
+
const reportResult = async (progressResult, kind, replyToId) => {
|
|
496
|
+
const deliveredResult = toDiscordSendResult(progressResult, deliveryThreadId ?? channelId, {
|
|
497
|
+
kind,
|
|
498
|
+
threadId: deliveryThreadId,
|
|
499
|
+
reply: createReusableDiscordReplyReference(replyToId)
|
|
500
|
+
});
|
|
501
|
+
deliveredResults.push(deliveredResult);
|
|
502
|
+
await opts.onDeliveryResult?.(deliveredResult);
|
|
503
|
+
};
|
|
501
504
|
if (isForumLikeChannel(channel)) {
|
|
502
505
|
if (((channel.flags ?? 0) & DISCORD_FORUM_REQUIRE_TAG_FLAG) !== 0) throw new Error(`Discord forum channel ${channelId} requires an applied tag; use thread-create with appliedTags, then send to the created thread.`);
|
|
503
506
|
const threadName = deriveForumThreadName(renderedText);
|
|
@@ -516,25 +519,29 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
516
519
|
embeds: opts.embeds,
|
|
517
520
|
isFirst: true
|
|
518
521
|
});
|
|
522
|
+
const starterFlags = resolveDiscordMessageFlags({
|
|
523
|
+
silent: opts.silent,
|
|
524
|
+
suppressEmbeds: suppressEmbeds && !starterEmbeds?.length
|
|
525
|
+
});
|
|
519
526
|
const starterBody = buildDiscordMessageRequest({
|
|
520
527
|
endpoint: "forum-thread",
|
|
521
528
|
text: starterContent,
|
|
522
529
|
components: starterComponents,
|
|
523
530
|
embeds: starterEmbeds,
|
|
524
|
-
flags:
|
|
525
|
-
silent: opts.silent,
|
|
526
|
-
suppressEmbeds: suppressEmbeds && !starterEmbeds?.length
|
|
527
|
-
}),
|
|
531
|
+
flags: starterFlags,
|
|
528
532
|
allowedMentions: opts.allowedMentions
|
|
529
533
|
});
|
|
530
534
|
let threadRes;
|
|
531
535
|
try {
|
|
532
|
-
await
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
|
|
537
|
-
|
|
536
|
+
threadRes = await request(async () => {
|
|
537
|
+
await opts.onPlatformSendDispatch?.();
|
|
538
|
+
opts.assertPlatformSendAuthorized?.();
|
|
539
|
+
return createThread(rest, channelId, { body: {
|
|
540
|
+
name: threadName,
|
|
541
|
+
...channel.default_auto_archive_duration === void 0 ? {} : { auto_archive_duration: channel.default_auto_archive_duration },
|
|
542
|
+
message: starterBody
|
|
543
|
+
} });
|
|
544
|
+
}, "forum-thread", { safety: "non-idempotent-create" });
|
|
538
545
|
} catch (err) {
|
|
539
546
|
throw await buildDiscordSendError(err, {
|
|
540
547
|
channelId,
|
|
@@ -545,6 +552,7 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
545
552
|
});
|
|
546
553
|
}
|
|
547
554
|
const threadId = threadRes.id;
|
|
555
|
+
deliveryThreadId = threadId;
|
|
548
556
|
const messageId = threadRes.message?.id ?? threadId;
|
|
549
557
|
const resultChannelId = threadRes.message?.channel_id ?? threadId;
|
|
550
558
|
const remainingChunks = chunks.slice(1);
|
|
@@ -555,16 +563,8 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
555
563
|
kind: "text",
|
|
556
564
|
threadId
|
|
557
565
|
});
|
|
558
|
-
|
|
566
|
+
deliveredResults.push(starterResult);
|
|
559
567
|
await opts.onDeliveryResult?.(starterResult);
|
|
560
|
-
const reportThreadResult = async (result, kind) => {
|
|
561
|
-
const deliveredResult = toDiscordSendResult(result, threadId, {
|
|
562
|
-
kind,
|
|
563
|
-
threadId
|
|
564
|
-
});
|
|
565
|
-
deliveredResults.push(deliveredResult);
|
|
566
|
-
await opts.onDeliveryResult?.(deliveredResult);
|
|
567
|
-
};
|
|
568
568
|
try {
|
|
569
569
|
if (opts.mediaUrl) {
|
|
570
570
|
const [mediaCaption, ...afterMediaChunks] = remainingChunks;
|
|
@@ -585,8 +585,9 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
585
585
|
suppressEmbeds,
|
|
586
586
|
allowedMentions: opts.allowedMentions,
|
|
587
587
|
maxChars: textLimit,
|
|
588
|
-
onResult:
|
|
589
|
-
onPlatformSendDispatch: opts.onPlatformSendDispatch
|
|
588
|
+
onResult: reportResult,
|
|
589
|
+
onPlatformSendDispatch: opts.onPlatformSendDispatch,
|
|
590
|
+
assertPlatformSendAuthorized: opts.assertPlatformSendAuthorized
|
|
590
591
|
});
|
|
591
592
|
await sendDiscordThreadTextChunks({
|
|
592
593
|
rest,
|
|
@@ -599,8 +600,9 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
599
600
|
silent: opts.silent,
|
|
600
601
|
suppressEmbeds,
|
|
601
602
|
allowedMentions: opts.allowedMentions,
|
|
602
|
-
onResult:
|
|
603
|
-
onPlatformSendDispatch: opts.onPlatformSendDispatch
|
|
603
|
+
onResult: reportResult,
|
|
604
|
+
onPlatformSendDispatch: opts.onPlatformSendDispatch,
|
|
605
|
+
assertPlatformSendAuthorized: opts.assertPlatformSendAuthorized
|
|
604
606
|
});
|
|
605
607
|
} else await sendDiscordThreadTextChunks({
|
|
606
608
|
rest,
|
|
@@ -613,8 +615,9 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
613
615
|
silent: opts.silent,
|
|
614
616
|
suppressEmbeds,
|
|
615
617
|
allowedMentions: opts.allowedMentions,
|
|
616
|
-
onResult:
|
|
617
|
-
onPlatformSendDispatch: opts.onPlatformSendDispatch
|
|
618
|
+
onResult: reportResult,
|
|
619
|
+
onPlatformSendDispatch: opts.onPlatformSendDispatch,
|
|
620
|
+
assertPlatformSendAuthorized: opts.assertPlatformSendAuthorized
|
|
618
621
|
});
|
|
619
622
|
} catch (err) {
|
|
620
623
|
throw await buildDiscordSendError(err, {
|
|
@@ -639,12 +642,6 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
639
642
|
};
|
|
640
643
|
}
|
|
641
644
|
let result;
|
|
642
|
-
const reportResult = async (progressResult, kind, replyToId) => {
|
|
643
|
-
await opts.onDeliveryResult?.(toDiscordSendResult(progressResult, channelId, {
|
|
644
|
-
kind,
|
|
645
|
-
reply: createReusableDiscordReplyReference(replyToId)
|
|
646
|
-
}));
|
|
647
|
-
};
|
|
648
645
|
try {
|
|
649
646
|
if (opts.mediaUrl) result = await sendDiscordMedia({
|
|
650
647
|
rest,
|
|
@@ -667,7 +664,8 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
667
664
|
allowedMentions: opts.allowedMentions,
|
|
668
665
|
maxChars: textLimit,
|
|
669
666
|
onResult: reportResult,
|
|
670
|
-
onPlatformSendDispatch: opts.onPlatformSendDispatch
|
|
667
|
+
onPlatformSendDispatch: opts.onPlatformSendDispatch,
|
|
668
|
+
assertPlatformSendAuthorized: opts.assertPlatformSendAuthorized
|
|
671
669
|
});
|
|
672
670
|
else result = await sendDiscordText({
|
|
673
671
|
rest,
|
|
@@ -684,7 +682,8 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
684
682
|
allowedMentions: opts.allowedMentions,
|
|
685
683
|
maxChars: textLimit,
|
|
686
684
|
onResult: reportResult,
|
|
687
|
-
onPlatformSendDispatch: opts.onPlatformSendDispatch
|
|
685
|
+
onPlatformSendDispatch: opts.onPlatformSendDispatch,
|
|
686
|
+
assertPlatformSendAuthorized: opts.assertPlatformSendAuthorized
|
|
688
687
|
});
|
|
689
688
|
} catch (err) {
|
|
690
689
|
throw await buildDiscordSendError(err, {
|
|
@@ -700,16 +699,20 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
700
699
|
accountId: accountInfo.accountId,
|
|
701
700
|
direction: "outbound"
|
|
702
701
|
});
|
|
703
|
-
return
|
|
704
|
-
|
|
705
|
-
|
|
706
|
-
|
|
702
|
+
return {
|
|
703
|
+
messageId: result.id || "unknown",
|
|
704
|
+
channelId: result.channel_id ?? channelId,
|
|
705
|
+
receipt: createDiscordSendReceiptFromResults({ results: deliveredResults })
|
|
706
|
+
};
|
|
707
707
|
}
|
|
708
708
|
async function sendStickerDiscord(to, stickerIds, opts) {
|
|
709
709
|
const context = await resolveDiscordStructuredSendContext(to, opts);
|
|
710
710
|
const { rewrittenContent, suppressEmbeds } = context;
|
|
711
711
|
const stickers = normalizeStickerIds(stickerIds);
|
|
712
|
-
const flags = resolveDiscordMessageFlags({
|
|
712
|
+
const flags = resolveDiscordMessageFlags({
|
|
713
|
+
silent: opts.silent,
|
|
714
|
+
suppressEmbeds
|
|
715
|
+
});
|
|
713
716
|
const body = {
|
|
714
717
|
content: rewrittenContent || void 0,
|
|
715
718
|
sticker_ids: stickers,
|
|
@@ -738,16 +741,16 @@ async function sendPollDiscord(to, poll, opts) {
|
|
|
738
741
|
return context.send("poll", body);
|
|
739
742
|
}
|
|
740
743
|
async function resolveDiscordStructuredSendContext(to, opts) {
|
|
741
|
-
|
|
742
|
-
|
|
743
|
-
accountId: opts.accountId
|
|
744
|
-
});
|
|
745
|
-
const { rest, request, channelId } = await resolveDiscordSendTarget(to, opts);
|
|
744
|
+
requireRuntimeConfig(opts.cfg, "Discord structured send");
|
|
745
|
+
const { rest, request, channelId, account: accountInfo } = await resolveDiscordSendTarget(to, opts);
|
|
746
746
|
const content = opts.content?.trim();
|
|
747
747
|
return {
|
|
748
748
|
send: async (kind, body) => {
|
|
749
|
-
await
|
|
750
|
-
|
|
749
|
+
const result = await request(async () => {
|
|
750
|
+
await opts.onPlatformSendDispatch?.();
|
|
751
|
+
opts.assertPlatformSendAuthorized?.();
|
|
752
|
+
return createChannelMessage(rest, channelId, { body });
|
|
753
|
+
}, kind, { safety: "nonce-protected-create" });
|
|
751
754
|
recordChannelActivity({
|
|
752
755
|
channel: "discord",
|
|
753
756
|
accountId: accountInfo.accountId,
|