@openclaw/discord 2026.8.1-beta.2 → 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-CqzrH14k.js → account-inspect-BDfKyuvL.js} +1 -1
- package/dist/account-inspect-api.js +1 -1
- package/dist/{accounts-DJTf1LtA.js → accounts-CfQ-vSyf.js} +34 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/{activities-api-DS7vpdtp.js → activities-api-Dl-TOyOX.js} +134 -175
- package/dist/activities-api.js +1 -1
- package/dist/api.js +17 -17
- package/dist/{approval-handler.runtime-B6yEV79q.js → approval-handler.runtime-q4Zqo44V.js} +29 -106
- package/dist/{audit-Db-rlntl.js → audit-DgrvFPGt.js} +5 -5
- package/dist/{channel-CnnbJSt5.js → channel-BsQUalPw.js} +72 -50
- package/dist/{channel-actions.runtime-CLKrx6tr.js → channel-actions.runtime-UMGGIfSy.js} +31 -45
- 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-BFAO-V1P.js → channel.setup-rPs4dsk_.js} +5 -5
- package/dist/{outbound-session-route-DxLkrgKQ.js → components-Dk35LTf_.js} +34 -76
- package/dist/{config-schema-BgEskFAs.js → config-schema-CxPqtVI1.js} +46 -14
- package/dist/conversation-binding-route-BjvX4e35.js +43 -0
- package/dist/{directory-config-BVX7Cflc.js → directory-config-B7DY_pNG.js} +2 -2
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-DGIGxpIo.js → directory-live-DuAXKkan.js} +3 -3
- package/dist/doctor-contract-api.js +2 -2
- package/dist/{doctor-BzC-TLnB.js → doctor-zQTtn6hm.js} +33 -12
- package/dist/{handle-action.guild-admin-BNVTUISF.js → handle-action.guild-admin-DZewwLr1.js} +9 -5
- package/dist/index.js +3 -4
- package/dist/ingress-identity-CzZKcPK8.js +60 -0
- package/dist/{message-handler-Unk_f10F.js → message-handler-C5By3yl5.js} +82 -6
- package/dist/{message-handler.preflight-C9zecxR9.js → message-handler.preflight-DrszWuHw.js} +44 -118
- package/dist/{message-handler.process-DWQ6UHHu.js → message-handler.process-DyFPDLCt.js} +205 -235
- package/dist/{message-utils-BSCPVgy0.js → message-text-Ca8M6TU8.js} +43 -42
- package/dist/{outbound-adapter-D9nRivT1.js → outbound-adapter-Dif8p481.js} +118 -91
- package/dist/{outbound-components-cTzwBJ60.js → outbound-components-wjv7yyAj.js} +5 -4
- package/dist/outbound-session-route-Bn4uXaoE.js +665 -0
- package/dist/owner-access-UlYi9t0M.js +107 -0
- package/dist/{pluralkit-DdiJ9KMK.js → pluralkit-9EuEN4UD.js} +1 -1
- package/dist/{probe-Bl-k5_Ku.js → probe-n6ZXxK8V.js} +1 -1
- package/dist/{probe.runtime-M9fREKvp.js → probe.runtime-CN4bdPfZ.js} +1 -1
- package/dist/{provider-DvSNb-2v.js → provider-LXiOcJrH.js} +887 -1350
- package/dist/{provider-session.runtime-BUEqD0rA.js → provider-session.runtime-DSNe7r2W.js} +3 -3
- package/dist/provider.runtime-DiInaDXO.js +2 -0
- package/dist/{realtime-session.runtime-C7wen-aF.js → realtime-session.runtime-DOViOIjY.js} +129 -134
- package/dist/{resolve-allowlist-common-D04lpEzb.js → resolve-allowlist-common-BLoYaxEG.js} +2 -2
- package/dist/{resolve-channels-Dm7jEeg6.js → resolve-channels-D2yl_2CN.js} +5 -4
- package/dist/{resolve-users-bktrCUUU.js → resolve-users-BLxfqajZ.js} +2 -2
- package/dist/{retry-CLpJcXXf.js → retry-DqHCW6PV.js} +187 -19
- package/dist/{runtime-DGsSyDTS.js → runtime-BYamRVPN.js} +89 -86
- package/dist/{runtime-DoHjckYm.js → runtime-DrxVBTtp.js} +9 -10
- package/dist/runtime-api.js +19 -25
- package/dist/{sdk-runtime-QpY8PvCh.js → sdk-runtime-6tfgYDjY.js} +57 -89
- package/dist/{secret-config-contract-B1akrlyY.js → secret-config-contract-B3i6WxV5.js} +53 -25
- package/dist/secret-contract-api.js +1 -1
- package/dist/{security-audit-jGnJF__m.js → security-audit-DKfK-iPY.js} +11 -12
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/{security-audit.runtime-CPN0xFYz.js → security-audit.runtime-sKZyKgpx.js} +1 -1
- package/dist/{send-B7Q6Oc1I.js → send-UJHiAm4C.js} +82 -19
- package/dist/{send.components-iJyFXw9L.js → send.components-CrBJpGT_.js} +22 -39
- package/dist/{send.outbound-DS5tHwfR.js → send.outbound-D7JYmfm9.js} +77 -78
- package/dist/{send.shared-BmwFjW6T.js → send.shared-DZJ1akvQ.js} +136 -121
- package/dist/{sender-identity-QtalnCYv.js → sender-identity-BJtfyise.js} +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-BIXIX6uJ.js → shared-Dii2HTn7.js} +41 -14
- package/dist/subagent-hooks-JyGrtQIl.js +49 -0
- package/dist/subagent-hooks-api.js +1 -6
- package/dist/{system-events-CTqDf6_s.js → system-events-BEmcj4xJ.js} +2 -2
- package/dist/{target-resolver-maOKSqO0.js → target-resolver-V-IYae6s.js} +3 -3
- package/dist/targets-CQp53cGj.js +3 -0
- package/dist/{thread-bindings-3L8p82GV.js → thread-bindings-DvYP79fy.js} +28 -26
- package/dist/{thread-bindings.manager-DCIH6WDC.js → thread-bindings.manager-Clm77DBM.js} +11 -14
- package/dist/{thread-bindings.session-updates-bJ2KQFY6.js → thread-bindings.session-updates-CJb-BpPL.js} +1 -1
- package/dist/{thread-bindings.state-aeV8HNgV.js → thread-bindings.state-D8OMdk4O.js} +1 -1
- package/dist/threading-CXuu_7o9.js +478 -0
- package/dist/transcripts-source-BLEMH_yi.js +270 -0
- package/dist/transcripts-source-api.js +7 -2
- package/dist/{typing-CS-nNVoe.js → typing-B9snnwMe.js} +1 -1
- package/dist/{voice-runtime-BEdqNcST.js → voice-runtime-DY6_o73o.js} +250 -150
- 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 +24 -10
- package/package.json +8 -10
- package/skills/discord/SKILL.md +1 -1
- package/dist/approval-message-safety-AcIxvrf3.js +0 -140
- package/dist/audit-core-xwjIczO0.js +0 -105
- package/dist/channel-actions-5s_hjYKd.js +0 -208
- package/dist/channel-api-CAJ0wMoV.js +0 -21
- package/dist/inbound-event-delivery-De2qxTrP.js +0 -39
- package/dist/provider.runtime-C9PnJZbZ.js +0 -2
- package/dist/runtime-api.actions.js +0 -3
- package/dist/runtime-api.lookup.js +0 -7
- package/dist/runtime-api.monitor-CHxrFPnW.js +0 -5
- package/dist/runtime-api.monitor.js +0 -8
- package/dist/runtime-api.send.js +0 -7
- package/dist/runtime-api.threads.js +0 -5
- package/dist/send.reactions-BAn0iiVQ.js +0 -78
- package/dist/send.receipt-IPI1p-SP.js +0 -66
- package/dist/subagent-hooks-CTt5KCJr.js +0 -120
- package/dist/subagent-progress-DhaE_h8a.js +0 -109
- package/dist/targets-yUFTHoAx.js +0 -3
- package/dist/transcripts-source-CfFMexGt.js +0 -123
- package/node_modules/p-map/index.d.ts +0 -155
- package/node_modules/p-map/index.js +0 -285
- package/node_modules/p-map/license +0 -9
- package/node_modules/p-map/package.json +0 -57
- package/node_modules/p-map/readme.md +0 -190
- 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
- package/dist/{allow-list-DnxIlPP2.js → allow-list-BDMimASD.js} +1 -1
- package/dist/{doctor-contract-DLa-BTiU.js → doctor-contract-DsWvKIXF.js} +1 -1
|
@@ -1,140 +0,0 @@
|
|
|
1
|
-
import { p as parseDiscordTarget } from "./retry-CLpJcXXf.js";
|
|
2
|
-
import { s as resolveDiscordAccount } from "./accounts-DJTf1LtA.js";
|
|
3
|
-
import { normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
4
|
-
import { createChannelApproverDmTargetResolver, createChannelNativeOriginTargetResolver } from "openclaw/plugin-sdk/approval-native-runtime";
|
|
5
|
-
import { getExecApprovalReplyMetadata, isChannelExecApprovalClientEnabledFromConfig, matchesApprovalRequestFilters } from "openclaw/plugin-sdk/approval-client-runtime";
|
|
6
|
-
import { resolveApprovalApprovers } from "openclaw/plugin-sdk/approval-auth-runtime";
|
|
7
|
-
import { createApproverRestrictedNativeApprovalCapability } from "openclaw/plugin-sdk/approval-delivery-runtime";
|
|
8
|
-
//#region extensions/discord/src/exec-approvals.ts
|
|
9
|
-
function normalizeDiscordApproverId(value) {
|
|
10
|
-
const trimmed = value.trim();
|
|
11
|
-
if (!trimmed) return;
|
|
12
|
-
if (/^\d+$/.test(trimmed)) return trimmed;
|
|
13
|
-
try {
|
|
14
|
-
const target = parseDiscordTarget(trimmed);
|
|
15
|
-
return target?.kind === "user" ? target.id : void 0;
|
|
16
|
-
} catch {
|
|
17
|
-
return;
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
function resolveDiscordOwnerApprovers(cfg) {
|
|
21
|
-
const ownerAllowFrom = cfg.commands?.ownerAllowFrom;
|
|
22
|
-
if (!Array.isArray(ownerAllowFrom) || ownerAllowFrom.length === 0) return [];
|
|
23
|
-
return resolveApprovalApprovers({
|
|
24
|
-
explicit: ownerAllowFrom,
|
|
25
|
-
normalizeApprover: (value) => normalizeDiscordApproverId(String(value))
|
|
26
|
-
});
|
|
27
|
-
}
|
|
28
|
-
function getDiscordExecApprovalApprovers(params) {
|
|
29
|
-
return resolveApprovalApprovers({
|
|
30
|
-
explicit: params.configOverride?.approvers ?? resolveDiscordAccount(params).config.execApprovals?.approvers ?? resolveDiscordOwnerApprovers(params.cfg),
|
|
31
|
-
normalizeApprover: (value) => normalizeDiscordApproverId(String(value))
|
|
32
|
-
});
|
|
33
|
-
}
|
|
34
|
-
function isDiscordExecApprovalClientEnabled(params) {
|
|
35
|
-
return isChannelExecApprovalClientEnabledFromConfig({
|
|
36
|
-
enabled: (params.configOverride ?? resolveDiscordAccount(params).config.execApprovals)?.enabled,
|
|
37
|
-
approverCount: getDiscordExecApprovalApprovers({
|
|
38
|
-
cfg: params.cfg,
|
|
39
|
-
accountId: params.accountId,
|
|
40
|
-
configOverride: params.configOverride
|
|
41
|
-
}).length
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
function isDiscordExecApprovalApprover(params) {
|
|
45
|
-
const senderId = params.senderId?.trim();
|
|
46
|
-
if (!senderId) return false;
|
|
47
|
-
return getDiscordExecApprovalApprovers({
|
|
48
|
-
cfg: params.cfg,
|
|
49
|
-
accountId: params.accountId,
|
|
50
|
-
configOverride: params.configOverride
|
|
51
|
-
}).includes(senderId);
|
|
52
|
-
}
|
|
53
|
-
function shouldSuppressLocalDiscordExecApprovalPrompt(params) {
|
|
54
|
-
const metadata = getExecApprovalReplyMetadata(params.payload);
|
|
55
|
-
const config = resolveDiscordAccount(params).config.execApprovals;
|
|
56
|
-
return params.hint?.kind === "approval-pending" && params.hint.nativeRouteActive === true && isDiscordExecApprovalClientEnabled(params) && metadata !== null && matchesApprovalRequestFilters({
|
|
57
|
-
request: {
|
|
58
|
-
agentId: metadata.agentId,
|
|
59
|
-
sessionKey: metadata.sessionKey
|
|
60
|
-
},
|
|
61
|
-
agentFilter: config?.agentFilter,
|
|
62
|
-
sessionFilter: config?.sessionFilter
|
|
63
|
-
});
|
|
64
|
-
}
|
|
65
|
-
//#endregion
|
|
66
|
-
//#region extensions/discord/src/conversation-identity.ts
|
|
67
|
-
function normalizeDiscordTarget(raw, defaultKind) {
|
|
68
|
-
const trimmed = normalizeOptionalString(raw);
|
|
69
|
-
if (!trimmed) return;
|
|
70
|
-
return parseDiscordTarget(trimmed, { defaultKind })?.normalized;
|
|
71
|
-
}
|
|
72
|
-
function buildDiscordConversationIdentity(kind, rawId) {
|
|
73
|
-
const trimmed = normalizeOptionalString(rawId);
|
|
74
|
-
return trimmed ? `${kind}:${trimmed}` : void 0;
|
|
75
|
-
}
|
|
76
|
-
function resolveDiscordConversationIdentity(params) {
|
|
77
|
-
return params.isDirectMessage ? buildDiscordConversationIdentity("user", params.userId) : buildDiscordConversationIdentity("channel", params.channelId);
|
|
78
|
-
}
|
|
79
|
-
function resolveDiscordCurrentConversationIdentity(params) {
|
|
80
|
-
if (normalizeOptionalLowercaseString(params.chatType) === "direct") {
|
|
81
|
-
const senderTarget = normalizeDiscordTarget(params.from, "user");
|
|
82
|
-
if (senderTarget?.startsWith("user:")) return senderTarget;
|
|
83
|
-
}
|
|
84
|
-
for (const candidate of [
|
|
85
|
-
params.originatingTo,
|
|
86
|
-
params.commandTo,
|
|
87
|
-
params.fallbackTo
|
|
88
|
-
]) {
|
|
89
|
-
const target = normalizeDiscordTarget(candidate, "channel");
|
|
90
|
-
if (target) return target;
|
|
91
|
-
}
|
|
92
|
-
}
|
|
93
|
-
//#endregion
|
|
94
|
-
//#region extensions/discord/src/approval-message-safety.ts
|
|
95
|
-
const DISCORD_APPROVAL_ALLOWED_MENTIONS = { parse: [] };
|
|
96
|
-
const DISCORD_MARKDOWN_META_CHARACTERS = /* @__PURE__ */ new Set([
|
|
97
|
-
"\\",
|
|
98
|
-
"`",
|
|
99
|
-
"*",
|
|
100
|
-
"_",
|
|
101
|
-
"{",
|
|
102
|
-
"}",
|
|
103
|
-
"[",
|
|
104
|
-
"]",
|
|
105
|
-
"(",
|
|
106
|
-
")",
|
|
107
|
-
"<",
|
|
108
|
-
">",
|
|
109
|
-
"#",
|
|
110
|
-
"+",
|
|
111
|
-
"-",
|
|
112
|
-
".",
|
|
113
|
-
"!",
|
|
114
|
-
"|",
|
|
115
|
-
"~"
|
|
116
|
-
]);
|
|
117
|
-
function escapeDiscordApprovalDisplayCharacter(character) {
|
|
118
|
-
if (character === "\n") return "\\n";
|
|
119
|
-
if (character === "\r") return "\\r";
|
|
120
|
-
if (character === " ") return "\\t";
|
|
121
|
-
const codePoint = character.codePointAt(0) ?? 0;
|
|
122
|
-
if (codePoint <= 31 || codePoint >= 127 && codePoint <= 159 || codePoint === 8232 || codePoint === 8233) return `\\u{${codePoint.toString(16).padStart(4, "0")}}`;
|
|
123
|
-
return DISCORD_MARKDOWN_META_CHARACTERS.has(character) ? `\\${character}` : character;
|
|
124
|
-
}
|
|
125
|
-
/** Keep opaque approval metadata bounded, single-line, and inert in Discord Markdown. */
|
|
126
|
-
function formatDiscordApprovalDisplayValue(value, maxChars = 200) {
|
|
127
|
-
const limit = Number.isFinite(maxChars) ? Math.max(0, Math.trunc(maxChars)) : 200;
|
|
128
|
-
const escapedParts = Array.from(value, escapeDiscordApprovalDisplayCharacter);
|
|
129
|
-
const escaped = escapedParts.join("");
|
|
130
|
-
if (escaped.length <= limit) return escaped;
|
|
131
|
-
if (limit <= 3) return ".".repeat(limit);
|
|
132
|
-
let bounded = "";
|
|
133
|
-
for (const part of escapedParts) {
|
|
134
|
-
if (bounded.length + part.length > limit - 3) break;
|
|
135
|
-
bounded += part;
|
|
136
|
-
}
|
|
137
|
-
return `${bounded}...`;
|
|
138
|
-
}
|
|
139
|
-
//#endregion
|
|
140
|
-
export { getDiscordExecApprovalApprovers as a, shouldSuppressLocalDiscordExecApprovalPrompt as c, createChannelNativeOriginTargetResolver as d, isChannelExecApprovalClientEnabledFromConfig as f, resolveDiscordCurrentConversationIdentity as i, createApproverRestrictedNativeApprovalCapability as l, formatDiscordApprovalDisplayValue as n, isDiscordExecApprovalApprover as o, matchesApprovalRequestFilters as p, resolveDiscordConversationIdentity as r, isDiscordExecApprovalClientEnabled as s, DISCORD_APPROVAL_ALLOWED_MENTIONS as t, createChannelApproverDmTargetResolver as u };
|
|
@@ -1,105 +0,0 @@
|
|
|
1
|
-
import { isRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
-
import { ChannelType } from "discord-api-types/v10";
|
|
3
|
-
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
4
|
-
//#region extensions/discord/src/audit-core.ts
|
|
5
|
-
const REQUIRED_TEXT_CHANNEL_PERMISSIONS = ["ViewChannel", "SendMessages"];
|
|
6
|
-
const REQUIRED_VOICE_CHANNEL_PERMISSIONS = [
|
|
7
|
-
"ViewChannel",
|
|
8
|
-
"Connect",
|
|
9
|
-
"Speak",
|
|
10
|
-
"SendMessages",
|
|
11
|
-
"ReadMessageHistory"
|
|
12
|
-
];
|
|
13
|
-
function resolveRequiredDiscordChannelPermissions(channelType) {
|
|
14
|
-
if (channelType === ChannelType.GuildVoice || channelType === ChannelType.GuildStageVoice) return [...REQUIRED_VOICE_CHANNEL_PERMISSIONS];
|
|
15
|
-
return [...REQUIRED_TEXT_CHANNEL_PERMISSIONS];
|
|
16
|
-
}
|
|
17
|
-
function shouldAuditChannelConfig(config) {
|
|
18
|
-
if (!config) return true;
|
|
19
|
-
if (config.enabled === false) return false;
|
|
20
|
-
return true;
|
|
21
|
-
}
|
|
22
|
-
function listConfiguredGuildChannelKeys(guilds) {
|
|
23
|
-
if (!guilds) return [];
|
|
24
|
-
const ids = /* @__PURE__ */ new Set();
|
|
25
|
-
for (const entry of Object.values(guilds)) {
|
|
26
|
-
if (!entry || typeof entry !== "object") continue;
|
|
27
|
-
const channelsRaw = entry.channels;
|
|
28
|
-
if (!isRecord(channelsRaw)) continue;
|
|
29
|
-
for (const [key, value] of Object.entries(channelsRaw)) {
|
|
30
|
-
const channelId = normalizeOptionalString(key) ?? "";
|
|
31
|
-
if (!channelId) continue;
|
|
32
|
-
if (channelId === "*") continue;
|
|
33
|
-
if (!shouldAuditChannelConfig(value)) continue;
|
|
34
|
-
ids.add(channelId);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return [...ids].toSorted((a, b) => a.localeCompare(b));
|
|
38
|
-
}
|
|
39
|
-
function collectDiscordAuditChannelIdsForGuilds(guilds) {
|
|
40
|
-
const keys = listConfiguredGuildChannelKeys(guilds);
|
|
41
|
-
const channelIds = keys.filter((key) => /^\d+$/.test(key));
|
|
42
|
-
return {
|
|
43
|
-
channelIds,
|
|
44
|
-
unresolvedChannels: keys.length - channelIds.length
|
|
45
|
-
};
|
|
46
|
-
}
|
|
47
|
-
function collectDiscordAuditChannelIdsForAccount(config) {
|
|
48
|
-
const collected = collectDiscordAuditChannelIdsForGuilds(config.guilds);
|
|
49
|
-
const channelIds = new Set(collected.channelIds);
|
|
50
|
-
let unresolvedVoiceChannels = 0;
|
|
51
|
-
for (const entry of config.voice?.autoJoin ?? []) {
|
|
52
|
-
const channelId = normalizeOptionalString(entry?.channelId) ?? "";
|
|
53
|
-
if (/^\d+$/.test(channelId)) channelIds.add(channelId);
|
|
54
|
-
else if (channelId) unresolvedVoiceChannels++;
|
|
55
|
-
}
|
|
56
|
-
return {
|
|
57
|
-
channelIds: [...channelIds].toSorted((a, b) => a.localeCompare(b)),
|
|
58
|
-
unresolvedChannels: collected.unresolvedChannels + unresolvedVoiceChannels
|
|
59
|
-
};
|
|
60
|
-
}
|
|
61
|
-
async function auditDiscordChannelPermissionsWithFetcher(params) {
|
|
62
|
-
const started = Date.now();
|
|
63
|
-
const token = normalizeOptionalString(params.token) ?? "";
|
|
64
|
-
if (!token || params.channelIds.length === 0) return {
|
|
65
|
-
ok: true,
|
|
66
|
-
checkedChannels: 0,
|
|
67
|
-
unresolvedChannels: 0,
|
|
68
|
-
channels: [],
|
|
69
|
-
elapsedMs: Date.now() - started
|
|
70
|
-
};
|
|
71
|
-
const channels = [];
|
|
72
|
-
for (const channelId of params.channelIds) try {
|
|
73
|
-
const perms = await params.fetchChannelPermissions(channelId, {
|
|
74
|
-
cfg: params.cfg,
|
|
75
|
-
token,
|
|
76
|
-
accountId: params.accountId ?? void 0
|
|
77
|
-
});
|
|
78
|
-
const missing = resolveRequiredDiscordChannelPermissions(perms.channelType).filter((p) => !perms.permissions.includes(p));
|
|
79
|
-
channels.push({
|
|
80
|
-
channelId,
|
|
81
|
-
ok: missing.length === 0,
|
|
82
|
-
missing: missing.length ? missing : void 0,
|
|
83
|
-
error: null,
|
|
84
|
-
matchKey: channelId,
|
|
85
|
-
matchSource: "id"
|
|
86
|
-
});
|
|
87
|
-
} catch (err) {
|
|
88
|
-
channels.push({
|
|
89
|
-
channelId,
|
|
90
|
-
ok: false,
|
|
91
|
-
error: formatErrorMessage(err),
|
|
92
|
-
matchKey: channelId,
|
|
93
|
-
matchSource: "id"
|
|
94
|
-
});
|
|
95
|
-
}
|
|
96
|
-
return {
|
|
97
|
-
ok: channels.every((c) => c.ok),
|
|
98
|
-
checkedChannels: channels.length,
|
|
99
|
-
unresolvedChannels: 0,
|
|
100
|
-
channels,
|
|
101
|
-
elapsedMs: Date.now() - started
|
|
102
|
-
};
|
|
103
|
-
}
|
|
104
|
-
//#endregion
|
|
105
|
-
export { collectDiscordAuditChannelIdsForAccount as n, resolveRequiredDiscordChannelPermissions as r, auditDiscordChannelPermissionsWithFetcher as t };
|
|
@@ -1,208 +0,0 @@
|
|
|
1
|
-
import { r as listDiscordAccountIds, t as createDiscordActionGate } from "./accounts-DJTf1LtA.js";
|
|
2
|
-
import { h as readDiscordComponentSpec } from "./outbound-session-route-DxLkrgKQ.js";
|
|
3
|
-
import { t as inspectDiscordAccount } from "./account-inspect-CqzrH14k.js";
|
|
4
|
-
import { r as withDiscordInboundEventDeliveryMetadata } from "./inbound-event-delivery-De2qxTrP.js";
|
|
5
|
-
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
|
-
import { createUnionActionGate } from "openclaw/plugin-sdk/channel-actions";
|
|
7
|
-
import { createLazyRuntimeModule } from "openclaw/plugin-sdk/lazy-runtime";
|
|
8
|
-
import { extractToolSend } from "openclaw/plugin-sdk/tool-send";
|
|
9
|
-
//#region extensions/discord/src/trusted-requester-actions.ts
|
|
10
|
-
const trustedRequesterGuildAdminActions = /* @__PURE__ */ new Set([
|
|
11
|
-
"emoji-upload",
|
|
12
|
-
"sticker-upload",
|
|
13
|
-
"role-add",
|
|
14
|
-
"role-remove",
|
|
15
|
-
"channel-create",
|
|
16
|
-
"channel-edit",
|
|
17
|
-
"channel-delete",
|
|
18
|
-
"channel-move",
|
|
19
|
-
"category-create",
|
|
20
|
-
"category-edit",
|
|
21
|
-
"category-delete",
|
|
22
|
-
"event-create",
|
|
23
|
-
"timeout",
|
|
24
|
-
"kick",
|
|
25
|
-
"ban"
|
|
26
|
-
]);
|
|
27
|
-
function isTrustedRequesterGuildAdminAction(action) {
|
|
28
|
-
return trustedRequesterGuildAdminActions.has(action);
|
|
29
|
-
}
|
|
30
|
-
//#endregion
|
|
31
|
-
//#region extensions/discord/src/channel-actions.ts
|
|
32
|
-
const localExecutionActions = /* @__PURE__ */ new Set([
|
|
33
|
-
"send",
|
|
34
|
-
"upload-file",
|
|
35
|
-
"thread-reply",
|
|
36
|
-
"sticker",
|
|
37
|
-
"emoji-upload",
|
|
38
|
-
"sticker-upload",
|
|
39
|
-
"event-create"
|
|
40
|
-
]);
|
|
41
|
-
function resolveDiscordActionExecutionMode({ action }) {
|
|
42
|
-
return localExecutionActions.has(action) ? "local" : "gateway";
|
|
43
|
-
}
|
|
44
|
-
const loadDiscordChannelActionsRuntime = createLazyRuntimeModule(() => import("./channel-actions.runtime-CLKrx6tr.js"));
|
|
45
|
-
function listDiscoverableDiscordAccounts(cfg) {
|
|
46
|
-
return listDiscordAccountIds(cfg).map((accountId) => inspectDiscordAccount({
|
|
47
|
-
cfg,
|
|
48
|
-
accountId
|
|
49
|
-
})).filter((account) => account.enabled && account.configured);
|
|
50
|
-
}
|
|
51
|
-
function resolveDiscordActionDiscovery(cfg) {
|
|
52
|
-
const accounts = listDiscoverableDiscordAccounts(cfg);
|
|
53
|
-
if (accounts.length === 0) return null;
|
|
54
|
-
const unionGate = createUnionActionGate(accounts, (account) => createDiscordActionGate({
|
|
55
|
-
cfg,
|
|
56
|
-
accountId: account.accountId
|
|
57
|
-
}));
|
|
58
|
-
return { isEnabled: (key, defaultValue = true) => unionGate(key, defaultValue) };
|
|
59
|
-
}
|
|
60
|
-
function resolveScopedDiscordActionDiscovery(params) {
|
|
61
|
-
if (!params.accountId) return resolveDiscordActionDiscovery(params.cfg);
|
|
62
|
-
const account = inspectDiscordAccount({
|
|
63
|
-
cfg: params.cfg,
|
|
64
|
-
accountId: params.accountId
|
|
65
|
-
});
|
|
66
|
-
if (!account.enabled || !account.configured) return null;
|
|
67
|
-
const gate = createDiscordActionGate({
|
|
68
|
-
cfg: params.cfg,
|
|
69
|
-
accountId: account.accountId
|
|
70
|
-
});
|
|
71
|
-
return { isEnabled: (key, defaultValue = true) => gate(key, defaultValue) };
|
|
72
|
-
}
|
|
73
|
-
function describeDiscordMessageTool({ cfg, accountId }) {
|
|
74
|
-
const discovery = resolveScopedDiscordActionDiscovery({
|
|
75
|
-
cfg,
|
|
76
|
-
accountId
|
|
77
|
-
});
|
|
78
|
-
if (!discovery) return {
|
|
79
|
-
actions: [],
|
|
80
|
-
capabilities: [],
|
|
81
|
-
schema: null
|
|
82
|
-
};
|
|
83
|
-
const actions = /* @__PURE__ */ new Set(["send"]);
|
|
84
|
-
if (discovery.isEnabled("polls")) actions.add("poll");
|
|
85
|
-
if (discovery.isEnabled("reactions")) {
|
|
86
|
-
actions.add("react");
|
|
87
|
-
actions.add("reactions");
|
|
88
|
-
actions.add("emoji-list");
|
|
89
|
-
}
|
|
90
|
-
if (discovery.isEnabled("messages")) {
|
|
91
|
-
actions.add("upload-file");
|
|
92
|
-
actions.add("read");
|
|
93
|
-
actions.add("edit");
|
|
94
|
-
actions.add("delete");
|
|
95
|
-
}
|
|
96
|
-
if (discovery.isEnabled("pins")) {
|
|
97
|
-
actions.add("pin");
|
|
98
|
-
actions.add("unpin");
|
|
99
|
-
actions.add("list-pins");
|
|
100
|
-
}
|
|
101
|
-
if (discovery.isEnabled("permissions")) actions.add("permissions");
|
|
102
|
-
if (discovery.isEnabled("threads")) {
|
|
103
|
-
actions.add("thread-create");
|
|
104
|
-
actions.add("thread-list");
|
|
105
|
-
actions.add("thread-reply");
|
|
106
|
-
}
|
|
107
|
-
if (discovery.isEnabled("search")) actions.add("search");
|
|
108
|
-
if (discovery.isEnabled("stickers")) actions.add("sticker");
|
|
109
|
-
if (discovery.isEnabled("memberInfo")) actions.add("member-info");
|
|
110
|
-
if (discovery.isEnabled("roleInfo")) actions.add("role-info");
|
|
111
|
-
if (discovery.isEnabled("emojiUploads")) actions.add("emoji-upload");
|
|
112
|
-
if (discovery.isEnabled("stickerUploads")) actions.add("sticker-upload");
|
|
113
|
-
if (discovery.isEnabled("roles", false)) {
|
|
114
|
-
actions.add("role-add");
|
|
115
|
-
actions.add("role-remove");
|
|
116
|
-
}
|
|
117
|
-
if (discovery.isEnabled("channelInfo")) {
|
|
118
|
-
actions.add("channel-info");
|
|
119
|
-
actions.add("channel-list");
|
|
120
|
-
}
|
|
121
|
-
if (discovery.isEnabled("channels")) {
|
|
122
|
-
actions.add("channel-create");
|
|
123
|
-
actions.add("channel-edit");
|
|
124
|
-
actions.add("channel-delete");
|
|
125
|
-
actions.add("channel-move");
|
|
126
|
-
actions.add("category-create");
|
|
127
|
-
actions.add("category-edit");
|
|
128
|
-
actions.add("category-delete");
|
|
129
|
-
}
|
|
130
|
-
if (discovery.isEnabled("voiceStatus")) actions.add("voice-status");
|
|
131
|
-
if (discovery.isEnabled("events")) {
|
|
132
|
-
actions.add("event-list");
|
|
133
|
-
actions.add("event-create");
|
|
134
|
-
}
|
|
135
|
-
if (discovery.isEnabled("moderation", false)) {
|
|
136
|
-
actions.add("timeout");
|
|
137
|
-
actions.add("kick");
|
|
138
|
-
actions.add("ban");
|
|
139
|
-
}
|
|
140
|
-
if (discovery.isEnabled("presence", false)) actions.add("set-presence");
|
|
141
|
-
return {
|
|
142
|
-
actions: Array.from(actions),
|
|
143
|
-
capabilities: ["presentation"]
|
|
144
|
-
};
|
|
145
|
-
}
|
|
146
|
-
const discordMessageActions = {
|
|
147
|
-
resolveExecutionMode: resolveDiscordActionExecutionMode,
|
|
148
|
-
describeMessageTool: describeDiscordMessageTool,
|
|
149
|
-
requiresTrustedRequesterSender: ({ action, toolContext }) => Boolean(toolContext) && isTrustedRequesterGuildAdminAction(action),
|
|
150
|
-
extractToolSend: ({ args }) => {
|
|
151
|
-
const action = normalizeOptionalString(args.action) ?? "";
|
|
152
|
-
if (action === "sendMessage") return extractToolSend(args, "sendMessage");
|
|
153
|
-
if (action === "threadReply") {
|
|
154
|
-
const channelId = normalizeOptionalString(args.channelId) ?? "";
|
|
155
|
-
return channelId ? { to: `channel:${channelId}` } : null;
|
|
156
|
-
}
|
|
157
|
-
return null;
|
|
158
|
-
},
|
|
159
|
-
prepareSendPayload: ({ ctx, payload }) => {
|
|
160
|
-
if (ctx.action !== "send") return null;
|
|
161
|
-
const payloadWithDeliveryMetadata = withDiscordInboundEventDeliveryMetadata(payload, {
|
|
162
|
-
sessionKey: ctx.sessionKey,
|
|
163
|
-
inboundEventKind: ctx.inboundEventKind
|
|
164
|
-
});
|
|
165
|
-
const rawComponents = ctx.params.components;
|
|
166
|
-
if (typeof rawComponents === "function") return null;
|
|
167
|
-
const componentSpec = rawComponents && typeof rawComponents === "object" && !Array.isArray(rawComponents) ? readDiscordComponentSpec(rawComponents) : void 0;
|
|
168
|
-
const nativeComponents = Array.isArray(rawComponents) ? rawComponents : void 0;
|
|
169
|
-
const embeds = Array.isArray(ctx.params.embeds) ? ctx.params.embeds : void 0;
|
|
170
|
-
if ((componentSpec || nativeComponents) && embeds?.length) return null;
|
|
171
|
-
const filename = normalizeOptionalString(ctx.params.filename);
|
|
172
|
-
if (!componentSpec && !nativeComponents && !embeds?.length && !filename) return payloadWithDeliveryMetadata;
|
|
173
|
-
const discordData = payloadWithDeliveryMetadata.channelData?.discord && typeof payloadWithDeliveryMetadata.channelData.discord === "object" && !Array.isArray(payloadWithDeliveryMetadata.channelData.discord) ? payloadWithDeliveryMetadata.channelData.discord : {};
|
|
174
|
-
return {
|
|
175
|
-
...payloadWithDeliveryMetadata,
|
|
176
|
-
channelData: {
|
|
177
|
-
...payloadWithDeliveryMetadata.channelData,
|
|
178
|
-
discord: {
|
|
179
|
-
...discordData,
|
|
180
|
-
...componentSpec ? { components: componentSpec } : {},
|
|
181
|
-
...nativeComponents ? { components: nativeComponents } : {},
|
|
182
|
-
...embeds?.length ? { embeds } : {},
|
|
183
|
-
...filename ? { filename } : {}
|
|
184
|
-
}
|
|
185
|
-
}
|
|
186
|
-
};
|
|
187
|
-
},
|
|
188
|
-
handleAction: async ({ action, params, cfg, accountId, requesterAccountId, requesterSenderId, senderIsOwner, toolContext, mediaAccess, mediaLocalRoots, mediaReadFile, sessionKey, inboundEventKind, conversationReadOrigin }) => {
|
|
189
|
-
return await (await loadDiscordChannelActionsRuntime()).handleDiscordMessageAction({
|
|
190
|
-
action,
|
|
191
|
-
params,
|
|
192
|
-
cfg,
|
|
193
|
-
accountId,
|
|
194
|
-
requesterSenderId,
|
|
195
|
-
senderIsOwner,
|
|
196
|
-
toolContext,
|
|
197
|
-
mediaAccess,
|
|
198
|
-
mediaLocalRoots,
|
|
199
|
-
mediaReadFile,
|
|
200
|
-
...sessionKey ? { sessionKey } : {},
|
|
201
|
-
...inboundEventKind ? { inboundEventKind } : {},
|
|
202
|
-
...requesterAccountId ? { requesterAccountId } : {},
|
|
203
|
-
...conversationReadOrigin ? { conversationReadOrigin } : {}
|
|
204
|
-
});
|
|
205
|
-
}
|
|
206
|
-
};
|
|
207
|
-
//#endregion
|
|
208
|
-
export { isTrustedRequesterGuildAdminAction as n, discordMessageActions as t };
|
|
@@ -1,21 +0,0 @@
|
|
|
1
|
-
import { DEFAULT_ACCOUNT_ID as DEFAULT_ACCOUNT_ID$1 } from "openclaw/plugin-sdk/account-id";
|
|
2
|
-
import { PAIRING_APPROVED_MESSAGE, buildTokenChannelStatusSummary, projectCredentialSnapshotFields, resolveConfiguredFromCredentialStatuses } from "openclaw/plugin-sdk/channel-status";
|
|
3
|
-
//#region extensions/discord/src/channel-api.ts
|
|
4
|
-
const DISCORD_CHANNEL_META = {
|
|
5
|
-
id: "discord",
|
|
6
|
-
label: "Discord",
|
|
7
|
-
selectionLabel: "Discord (Bot API)",
|
|
8
|
-
detailLabel: "Discord Bot",
|
|
9
|
-
docsPath: "/channels/discord",
|
|
10
|
-
docsLabel: "discord",
|
|
11
|
-
blurb: "very well supported right now.",
|
|
12
|
-
systemImage: "bubble.left.and.bubble.right",
|
|
13
|
-
markdownCapable: true,
|
|
14
|
-
preferSessionLookupForAnnounceTarget: true
|
|
15
|
-
};
|
|
16
|
-
function getChatChannelMeta(id) {
|
|
17
|
-
if (id !== DISCORD_CHANNEL_META.id) throw new Error(`Unsupported Discord channel meta lookup: ${id}`);
|
|
18
|
-
return DISCORD_CHANNEL_META;
|
|
19
|
-
}
|
|
20
|
-
//#endregion
|
|
21
|
-
export { projectCredentialSnapshotFields as a, getChatChannelMeta as i, PAIRING_APPROVED_MESSAGE as n, resolveConfiguredFromCredentialStatuses as o, buildTokenChannelStatusSummary as r, DEFAULT_ACCOUNT_ID$1 as t };
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
import { asOptionalRecord, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
2
|
-
import { createInboundEventDeliveryCorrelation } from "openclaw/plugin-sdk/inbound-event-delivery";
|
|
3
|
-
//#region extensions/discord/src/inbound-event-delivery.ts
|
|
4
|
-
const DISCORD_INBOUND_EVENT_DELIVERY_KEY = "__openclawInboundEventDelivery";
|
|
5
|
-
function normalizeDiscordDeliveryTarget(value) {
|
|
6
|
-
return value.trim().replace(/^discord:/iu, "").replace(/^channel:/iu, "").toLowerCase();
|
|
7
|
-
}
|
|
8
|
-
const discordInboundEventDelivery = createInboundEventDeliveryCorrelation({ targetsMatch: (expected, actual) => normalizeDiscordDeliveryTarget(expected) === normalizeDiscordDeliveryTarget(actual) });
|
|
9
|
-
function withDiscordInboundEventDeliveryMetadata(payload, params) {
|
|
10
|
-
const sessionKey = params.sessionKey?.trim();
|
|
11
|
-
if (!sessionKey || params.inboundEventKind !== "room_event") return payload;
|
|
12
|
-
const channelData = asOptionalRecord(payload.channelData) ?? {};
|
|
13
|
-
const discordData = asOptionalRecord(channelData.discord) ?? {};
|
|
14
|
-
return {
|
|
15
|
-
...payload,
|
|
16
|
-
channelData: {
|
|
17
|
-
...channelData,
|
|
18
|
-
discord: {
|
|
19
|
-
...discordData,
|
|
20
|
-
[DISCORD_INBOUND_EVENT_DELIVERY_KEY]: {
|
|
21
|
-
sessionKey,
|
|
22
|
-
inboundEventKind: params.inboundEventKind
|
|
23
|
-
}
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
};
|
|
27
|
-
}
|
|
28
|
-
function notifyDiscordInboundEventOutboundPayloadSuccess(params) {
|
|
29
|
-
const metadata = asOptionalRecord(asOptionalRecord(asOptionalRecord(params.payload.channelData)?.discord)?.[DISCORD_INBOUND_EVENT_DELIVERY_KEY]);
|
|
30
|
-
if (!metadata) return;
|
|
31
|
-
discordInboundEventDelivery.notify({
|
|
32
|
-
sessionKey: normalizeOptionalString(metadata.sessionKey),
|
|
33
|
-
inboundEventKind: normalizeOptionalString(metadata.inboundEventKind),
|
|
34
|
-
to: params.to,
|
|
35
|
-
accountId: params.accountId
|
|
36
|
-
});
|
|
37
|
-
}
|
|
38
|
-
//#endregion
|
|
39
|
-
export { notifyDiscordInboundEventOutboundPayloadSuccess as n, withDiscordInboundEventDeliveryMetadata as r, discordInboundEventDelivery as t };
|
|
@@ -1,3 +0,0 @@
|
|
|
1
|
-
import { c as readDiscordChannelMoveParams, i as requiredGuildPermissionForModerationAction, l as readDiscordParentIdParam, n as isDiscordModerationAction, o as readDiscordChannelCreateParams, r as readDiscordModerationCommand, s as readDiscordChannelEditParams, t as handleDiscordAction } from "./runtime-DGsSyDTS.js";
|
|
2
|
-
import { t as discordMessageActions } from "./channel-actions-5s_hjYKd.js";
|
|
3
|
-
export { discordMessageActions, handleDiscordAction, isDiscordModerationAction, readDiscordChannelCreateParams, readDiscordChannelEditParams, readDiscordChannelMoveParams, readDiscordModerationCommand, readDiscordParentIdParam, requiredGuildPermissionForModerationAction };
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { r as setDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
2
|
-
import { n as listDiscordDirectoryGroupsLive, r as listDiscordDirectoryPeersLive } from "./directory-live-DGIGxpIo.js";
|
|
3
|
-
import { t as resolveDiscordChannelAllowlist } from "./resolve-channels-Dm7jEeg6.js";
|
|
4
|
-
import { t as resolveDiscordUserAllowlist } from "./resolve-users-bktrCUUU.js";
|
|
5
|
-
import { i as probeDiscord, n as fetchDiscordApplicationSummary, o as resolveDiscordPrivilegedIntentsFromFlags, r as parseApplicationIdFromToken, t as fetchDiscordApplicationId } from "./probe-Bl-k5_Ku.js";
|
|
6
|
-
import { r as collectDiscordAuditChannelIds, t as auditDiscordChannelPermissions } from "./audit-Db-rlntl.js";
|
|
7
|
-
export { auditDiscordChannelPermissions, collectDiscordAuditChannelIds, fetchDiscordApplicationId, fetchDiscordApplicationSummary, listDiscordDirectoryGroupsLive, listDiscordDirectoryPeersLive, parseApplicationIdFromToken, probeDiscord, resolveDiscordChannelAllowlist, resolveDiscordPrivilegedIntentsFromFlags, resolveDiscordUserAllowlist, setDiscordRuntime };
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
import { B as clearGateways, H as registerGateway, U as unregisterGateway, V as getGateway } from "./send.shared-BmwFjW6T.js";
|
|
2
|
-
import { _ as resolveDiscordShouldRequireMention, a as normalizeDiscordSlug, c as resolveDiscordChannelConfigWithFallback, f as resolveDiscordGuildEntry, n as isDiscordGroupAllowedByPolicy, r as normalizeDiscordAllowList, s as resolveDiscordChannelConfig, t as allowListMatches, u as resolveDiscordCommandAuthorized, v as resolveGroupDmAllow, y as shouldEmitDiscordReactionNotification } from "./allow-list-DnxIlPP2.js";
|
|
3
|
-
import { i as setPresence, n as getPresence, r as presenceCacheSize, t as clearPresences } from "./presence-cache-z1N8MbJ3.js";
|
|
4
|
-
import { a as isAbortError, i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, l as runDiscordTaskWithTimeout, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, o as normalizeDiscordInboundWorkerTimeoutMs, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, s as normalizeDiscordListenerTimeoutMs, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS } from "./timeouts-B9cy6RvQ.js";
|
|
5
|
-
import { A as sanitizeDiscordThreadName, O as resolveDiscordReplyTarget, T as registerDiscordListener, d as createDiscordGatewayPlugin, f as resolveDiscordGatewayIntents, h as createDiscordNativeCommand, p as waitForDiscordGatewayPluginRegistration, t as monitorDiscordProvider } from "./provider-DvSNb-2v.js";
|
|
6
|
-
import { t as createDiscordMessageHandler } from "./message-handler-Unk_f10F.js";
|
|
7
|
-
import "./runtime-api.monitor-CHxrFPnW.js";
|
|
8
|
-
export { DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS, DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, allowListMatches, clearGateways, clearPresences, createDiscordGatewayPlugin, createDiscordMessageHandler, createDiscordNativeCommand, getGateway, getPresence, isAbortError, isDiscordGroupAllowedByPolicy, monitorDiscordProvider, normalizeDiscordAllowList, normalizeDiscordInboundWorkerTimeoutMs, normalizeDiscordListenerTimeoutMs, normalizeDiscordSlug, presenceCacheSize, registerDiscordListener, registerGateway, resolveDiscordChannelConfig, resolveDiscordChannelConfigWithFallback, resolveDiscordCommandAuthorized, resolveDiscordGatewayIntents, resolveDiscordGuildEntry, resolveDiscordReplyTarget, resolveDiscordShouldRequireMention, resolveGroupDmAllow, runDiscordTaskWithTimeout, sanitizeDiscordThreadName, setPresence, shouldEmitDiscordReactionNotification, unregisterGateway, waitForDiscordGatewayPluginRegistration };
|
package/dist/runtime-api.send.js
DELETED
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { t as resolveDiscordOutboundSessionRoute } from "./outbound-session-route-DxLkrgKQ.js";
|
|
2
|
-
import { A as hasAllGuildPermissionsDiscord, M as hasAnyGuildPermissionDiscord, O as fetchChannelPermissionsDiscord, k as fetchMemberGuildPermissionsDiscord, w as DiscordSendError } from "./send.shared-BmwFjW6T.js";
|
|
3
|
-
import { n as registerBuiltDiscordComponentMessage, r as sendDiscordComponentMessage, t as editDiscordComponentMessage } from "./send.components-iJyFXw9L.js";
|
|
4
|
-
import { n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-DS5tHwfR.js";
|
|
5
|
-
import { A as listGuildEmojisDiscord, C as fetchVoiceStatusDiscord, D as removeRoleDiscord, E as listScheduledEventsDiscord, F as editChannelDiscord, I as moveChannelDiscord, L as removeChannelPermissionDiscord, M as uploadStickerDiscord, N as createChannelDiscord, O as resolveEventCoverImage, P as deleteChannelDiscord, R as setChannelPermissionDiscord, S as fetchRoleInfoDiscord, T as listGuildChannelsDiscord, _ as banMemberDiscord, c as editMessageDiscord, d as listThreadsDiscord, f as pinMessageDiscord, g as addRoleDiscord, h as unpinMessageDiscord, i as sendWebhookMessageDiscord, j as uploadEmojiDiscord, k as timeoutMemberDiscord, l as fetchMessageDiscord, m as searchMessagesDiscord, n as sendTypingDiscord, o as createThreadDiscord, p as readMessagesDiscord, r as sendVoiceMessageDiscord, s as deleteMessageDiscord, u as listPinsDiscord, v as createScheduledEventDiscord, w as kickMemberDiscord, x as fetchMemberInfoDiscord, y as fetchChannelInfoDiscord } from "./send-B7Q6Oc1I.js";
|
|
6
|
-
import { i as removeReactionDiscord, n as reactMessageDiscord, r as removeOwnReactionsDiscord, t as fetchReactionsDiscord } from "./send.reactions-BAn0iiVQ.js";
|
|
7
|
-
export { DiscordSendError, addRoleDiscord, banMemberDiscord, createChannelDiscord, createScheduledEventDiscord, createThreadDiscord, deleteChannelDiscord, deleteMessageDiscord, editChannelDiscord, editDiscordComponentMessage, editMessageDiscord, fetchChannelInfoDiscord, fetchChannelPermissionsDiscord, fetchMemberGuildPermissionsDiscord, fetchMemberInfoDiscord, fetchMessageDiscord, fetchReactionsDiscord, fetchRoleInfoDiscord, fetchVoiceStatusDiscord, hasAllGuildPermissionsDiscord, hasAnyGuildPermissionDiscord, kickMemberDiscord, listGuildChannelsDiscord, listGuildEmojisDiscord, listPinsDiscord, listScheduledEventsDiscord, listThreadsDiscord, moveChannelDiscord, pinMessageDiscord, reactMessageDiscord, readMessagesDiscord, registerBuiltDiscordComponentMessage, removeChannelPermissionDiscord, removeOwnReactionsDiscord, removeReactionDiscord, removeRoleDiscord, resolveDiscordOutboundSessionRoute, resolveEventCoverImage, searchMessagesDiscord, sendDiscordComponentMessage, sendMessageDiscord, sendPollDiscord, sendStickerDiscord, sendTypingDiscord, sendVoiceMessageDiscord, sendWebhookMessageDiscord, setChannelPermissionDiscord, timeoutMemberDiscord, unpinMessageDiscord, uploadEmojiDiscord, uploadStickerDiscord };
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { C as resolveThreadBindingMaxAgeExpiresAt, S as resolveThreadBindingInactivityExpiresAt, w as resolveThreadBindingMaxAgeMs, x as resolveThreadBindingIdleTimeoutMs } from "./thread-bindings.state-aeV8HNgV.js";
|
|
2
|
-
import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-bJ2KQFY6.js";
|
|
3
|
-
import { _ as resolveThreadBindingThreadName, g as resolveThreadBindingIntroText, h as formatThreadBindingDurationLabel, m as resolveThreadBindingPersonaFromRecord, n as createThreadBindingManager, p as resolveThreadBindingPersona, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-DCIH6WDC.js";
|
|
4
|
-
import { a as reconcileAcpThreadBindingsOnStartup, c as resolveDiscordThreadBindingMaxAgeMs, i as listThreadBindingsForAccount, l as resolveThreadBindingsEnabled, n as autoBindSpawnedDiscordSubagent, o as unbindThreadBindingsBySessionKey, r as listThreadBindingsBySessionKey, s as resolveDiscordThreadBindingIdleTimeoutMs } from "./thread-bindings-3L8p82GV.js";
|
|
5
|
-
export { autoBindSpawnedDiscordSubagent, createNoopThreadBindingManager, createThreadBindingManager, formatThreadBindingDurationLabel, getThreadBindingManager, listThreadBindingsBySessionKey, listThreadBindingsForAccount, reconcileAcpThreadBindingsOnStartup, resolveDiscordThreadBindingIdleTimeoutMs, resolveDiscordThreadBindingMaxAgeMs, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingInactivityExpiresAt, resolveThreadBindingIntroText, resolveThreadBindingMaxAgeExpiresAt, resolveThreadBindingMaxAgeMs, resolveThreadBindingPersona, resolveThreadBindingPersonaFromRecord, resolveThreadBindingThreadName, resolveThreadBindingsEnabled, setThreadBindingIdleTimeoutBySessionKey, setThreadBindingMaxAgeBySessionKey, unbindThreadBindingsBySessionKey };
|
|
@@ -1,78 +0,0 @@
|
|
|
1
|
-
import { Et as getChannelMessage, _t as deleteOwnMessageReaction, gt as createOwnMessageReaction, vt as listMessageReactionUsers } from "./retry-CLpJcXXf.js";
|
|
2
|
-
import { P as createDiscordClient, i as formatReactionEmoji, r as buildReactionIdentifier, s as normalizeReactionEmoji } from "./send.shared-BmwFjW6T.js";
|
|
3
|
-
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
4
|
-
//#region extensions/discord/src/send.reactions.ts
|
|
5
|
-
function createDiscordReactionRuntimeClient(opts) {
|
|
6
|
-
return createDiscordClient(opts);
|
|
7
|
-
}
|
|
8
|
-
function resolveDiscordReactionClient(opts) {
|
|
9
|
-
if (!opts.cfg) throw new Error("Discord reactions requires a resolved runtime config. Load and resolve config at the command or gateway boundary, then pass cfg through the runtime path.");
|
|
10
|
-
const cfg = requireRuntimeConfig(opts.cfg, "Discord reactions");
|
|
11
|
-
return createDiscordClient({
|
|
12
|
-
...opts,
|
|
13
|
-
cfg
|
|
14
|
-
});
|
|
15
|
-
}
|
|
16
|
-
function isDiscordReactionRuntimeContext(opts) {
|
|
17
|
-
return Boolean(opts.rest && opts.cfg && opts.accountId);
|
|
18
|
-
}
|
|
19
|
-
async function reactMessageDiscord(channelId, messageId, emoji, opts) {
|
|
20
|
-
const { rest, request } = isDiscordReactionRuntimeContext(opts) ? createDiscordReactionRuntimeClient(opts) : resolveDiscordReactionClient(opts);
|
|
21
|
-
const encoded = normalizeReactionEmoji(emoji);
|
|
22
|
-
await request(() => createOwnMessageReaction(rest, channelId, messageId, encoded), "react");
|
|
23
|
-
return { ok: true };
|
|
24
|
-
}
|
|
25
|
-
async function removeReactionDiscord(channelId, messageId, emoji, opts) {
|
|
26
|
-
const { rest, request } = isDiscordReactionRuntimeContext(opts) ? createDiscordReactionRuntimeClient(opts) : resolveDiscordReactionClient(opts);
|
|
27
|
-
const encoded = normalizeReactionEmoji(emoji);
|
|
28
|
-
await request(() => deleteOwnMessageReaction(rest, channelId, messageId, encoded), "reaction-remove");
|
|
29
|
-
return { ok: true };
|
|
30
|
-
}
|
|
31
|
-
async function removeOwnReactionsDiscord(channelId, messageId, opts) {
|
|
32
|
-
const { rest, request } = isDiscordReactionRuntimeContext(opts) ? createDiscordReactionRuntimeClient(opts) : resolveDiscordReactionClient(opts);
|
|
33
|
-
const message = await request(() => getChannelMessage(rest, channelId, messageId), "reaction-list");
|
|
34
|
-
const identifiers = /* @__PURE__ */ new Set();
|
|
35
|
-
for (const reaction of message.reactions ?? []) {
|
|
36
|
-
const identifier = reaction.me ? buildReactionIdentifier(reaction.emoji) : void 0;
|
|
37
|
-
if (identifier) identifiers.add(identifier);
|
|
38
|
-
}
|
|
39
|
-
if (identifiers.size === 0) return {
|
|
40
|
-
ok: true,
|
|
41
|
-
removed: []
|
|
42
|
-
};
|
|
43
|
-
const removed = Array.from(identifiers);
|
|
44
|
-
await Promise.all(removed.map((identifier) => request(() => deleteOwnMessageReaction(rest, channelId, messageId, normalizeReactionEmoji(identifier)), "reaction-remove")));
|
|
45
|
-
return {
|
|
46
|
-
ok: true,
|
|
47
|
-
removed
|
|
48
|
-
};
|
|
49
|
-
}
|
|
50
|
-
async function fetchReactionsDiscord(channelId, messageId, opts) {
|
|
51
|
-
const { rest, request } = isDiscordReactionRuntimeContext(opts) ? createDiscordReactionRuntimeClient(opts) : resolveDiscordReactionClient(opts);
|
|
52
|
-
const reactions = (await request(() => getChannelMessage(rest, channelId, messageId), "reaction-list")).reactions ?? [];
|
|
53
|
-
if (reactions.length === 0) return [];
|
|
54
|
-
const limit = typeof opts.limit === "number" && Number.isFinite(opts.limit) ? Math.min(Math.max(Math.floor(opts.limit), 1), 100) : 100;
|
|
55
|
-
const summaries = [];
|
|
56
|
-
for (const reaction of reactions) {
|
|
57
|
-
const identifier = buildReactionIdentifier(reaction.emoji);
|
|
58
|
-
if (!identifier) continue;
|
|
59
|
-
const encoded = encodeURIComponent(identifier);
|
|
60
|
-
const users = await request(() => listMessageReactionUsers(rest, channelId, messageId, encoded, { limit }), "reaction-users");
|
|
61
|
-
summaries.push({
|
|
62
|
-
emoji: {
|
|
63
|
-
id: reaction.emoji.id ?? null,
|
|
64
|
-
name: reaction.emoji.name ?? null,
|
|
65
|
-
raw: formatReactionEmoji(reaction.emoji)
|
|
66
|
-
},
|
|
67
|
-
count: reaction.count,
|
|
68
|
-
users: users.map((user) => ({
|
|
69
|
-
id: user.id,
|
|
70
|
-
username: user.username,
|
|
71
|
-
tag: user.username && user.discriminator ? `${user.username}#${user.discriminator}` : user.username
|
|
72
|
-
}))
|
|
73
|
-
});
|
|
74
|
-
}
|
|
75
|
-
return summaries;
|
|
76
|
-
}
|
|
77
|
-
//#endregion
|
|
78
|
-
export { removeReactionDiscord as i, reactMessageDiscord as n, removeOwnReactionsDiscord as r, fetchReactionsDiscord as t };
|