@openclaw/discord 2026.10.2 → 2026.10.5-beta.2
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/.setup/account-inspect-8cCu6uPG.mjs +31 -0
- package/dist/.setup/{accounts-HE9-mj1L.mjs → accounts-ljrzXBJi.mjs} +47 -45
- package/dist/.setup/{allow-list-vxkG9_JD.mjs → allow-list-B_ToXtew.mjs} +34 -101
- package/dist/.setup/{api-DlNUkDqj.mjs → api-CtmE1OUN.mjs} +25 -31
- package/dist/.setup/{approval-handler.runtime-DmnEa54W.mjs → approval-handler.runtime-D7FoZSn0.mjs} +30 -53
- package/dist/.setup/{approval-message-updates-B0jdSqOj.mjs → approval-message-updates-CIGByUcE.mjs} +2 -2
- package/dist/.setup/{audit-BpikUwN_.mjs → audit-zSawfbsN.mjs} +5 -8
- package/dist/.setup/{channel-Dr-AUnGt.mjs → channel-DI7DMzu0.mjs} +136 -215
- package/dist/.setup/{channel-access-BRp3Y-rF.mjs → channel-access-DasWY_OV.mjs} +6 -7
- package/dist/.setup/{channel.setup-BmNvkidb.mjs → channel.setup-DdFVN1mr.mjs} +35 -64
- package/dist/.setup/{components-DLJR0xU-.mjs → components-HN9052L1.mjs} +123 -146
- package/dist/.setup/{config-schema-BQWfnSCx.mjs → config-schema-_uBILpQf.mjs} +7 -3
- package/dist/.setup/{conversation-binding-route-DicJC1Lj.mjs → conversation-binding-route-DTjCBx-O.mjs} +1 -1
- package/dist/.setup/{directory-config-gqsdcplU.mjs → directory-config-3iVub-3m.mjs} +1 -1
- package/dist/.setup/{directory-live-Bipr0eUJ.mjs → directory-live-DLygQVtW.mjs} +18 -22
- package/dist/.setup/{discord-9gysrhzp.mjs → discord-BGqgx-yd.mjs} +686 -854
- package/dist/.setup/{doctor-B2bskDcF.mjs → doctor-DSrNJ7m2.mjs} +36 -47
- package/dist/.setup/{doctor-contract-Bg3NPAMw.mjs → doctor-contract-Bwv8EuQ_.mjs} +7 -16
- package/dist/.setup/{handle-action-UmkjXBfo.mjs → handle-action-CXH1h1tq.mjs} +25 -38
- package/dist/.setup/{handle-action.guild-admin-CB4sc9VV.mjs → handle-action.guild-admin-CHKW6PIs.mjs} +25 -31
- package/dist/.setup/{live-policy-config-VxexfRKo.mjs → live-policy-config-BPoB3eQi.mjs} +1 -1
- package/dist/.setup/{message-handler-BK69A-NB.mjs → message-handler-Ii_etru1.mjs} +9 -14
- package/dist/.setup/{message-handler.preflight-DFpsh90H.mjs → message-handler.preflight-C7YuSRl_.mjs} +79 -128
- package/dist/.setup/{message-handler.preflight-pluralkit-BXGGVmpe.mjs → message-handler.preflight-pluralkit-C3iAG--b.mjs} +6 -6
- package/dist/.setup/{message-handler.process-TKoqcqIP.mjs → message-handler.process-ClgWYH6o.mjs} +234 -206
- package/dist/.setup/{outbound-adapter-D4wRAb5S.mjs → outbound-adapter-D8OOIuKn.mjs} +73 -112
- package/dist/.setup/{outbound-session-route-BvBH4LC6.mjs → outbound-session-route-B0Hpwn3Q.mjs} +57 -115
- package/dist/.setup/output-activity-uBpMSX75.mjs +11 -0
- package/dist/.setup/{pluralkit-a6_NLfH9.mjs → pluralkit-B64dfq_j.mjs} +3 -1
- package/dist/.setup/{preflight-audio-DHGIHEpv.mjs → preflight-audio-wWgsZG5F.mjs} +1 -5
- package/dist/.setup/{presence-cache-Dg3_dADn.mjs → presence-cache-DCeTsL73.mjs} +3 -6
- package/dist/.setup/{probe-BwSKpnZf.mjs → probe-D3P1x4aN.mjs} +10 -18
- package/dist/.setup/{provider-YP8gN9_o.mjs → provider-D9EzOfG8.mjs} +2990 -3903
- package/dist/.setup/{provider-session.runtime-D1gkPxHT.mjs → provider-session.runtime-CsnRvddI.mjs} +5 -5
- package/dist/.setup/provider.runtime-BQVcM7Pg.mjs +2 -0
- package/dist/.setup/{realtime-session.runtime-BKUQBy1u.mjs → realtime-session.runtime-CxGBk8H-.mjs} +69 -98
- package/dist/.setup/{receive-recovery-DgkX7Qvi.mjs → receive-recovery-eVmK2_hl.mjs} +2 -12
- package/dist/.setup/resolve-allowlist-common-DNSsUQRF.mjs +66 -0
- package/dist/.setup/resolve-channels-UdT38DzU.mjs +173 -0
- package/dist/.setup/{resolve-users-DNrwvunm.mjs → resolve-users-DnCsrXZ_.mjs} +12 -41
- package/dist/.setup/{runtime-CESTexGn.mjs → runtime-CRTkKU1G.mjs} +202 -313
- package/dist/.setup/{runtime-DPcmPST9.mjs → runtime-DPm3gZXk.mjs} +2 -2
- package/dist/.setup/{secret-config-contract-uOE2J7yM.mjs → secret-config-contract-CIsH7R3B.mjs} +9 -18
- package/dist/.setup/{security-audit-D42cp5N7.mjs → security-audit-BFT84Uny.mjs} +1 -2
- package/dist/.setup/security-contract-DNyyjTZZ.mjs +19 -0
- package/dist/.setup/{send-CJk3VP5q.mjs → send-DbILKgcm.mjs} +184 -241
- package/dist/.setup/{send.components-dPljuV24.mjs → send.components-FxOS3CeP.mjs} +47 -63
- package/dist/.setup/{send.outbound-rOboMO_6.mjs → send.outbound-_jx4Xpd3.mjs} +178 -202
- package/dist/.setup/{send.receipt-DVOg2Oaw.mjs → send.receipt-BAlzXd8e.mjs} +33 -109
- package/dist/.setup/{send.shared-C4CN24D9.mjs → send.shared-CjQ4jbMA.mjs} +97 -153
- package/dist/.setup/{sender-identity-AHpUNr72.mjs → sender-identity-BNBvGt1l.mjs} +1 -1
- package/dist/.setup/setup-plugin-api-xfOFmxHP.mjs +3 -0
- package/dist/.setup/{shared-BoBnM5kM.mjs → shared-CestGDpq.mjs} +30 -20
- package/dist/.setup/{subagent-hooks-HH8Uy9cx.mjs → subagent-hooks-CME7dSGf.mjs} +5 -10
- package/dist/.setup/{system-events-Cwxaww8i.mjs → system-events-BwwSDCw4.mjs} +2 -2
- package/dist/.setup/target-parsing-C-HyNxcE.mjs +48 -0
- package/dist/.setup/{target-resolver-CSFoPQ12.mjs → target-resolver-Bse8fuTi.mjs} +11 -27
- package/dist/.setup/targets-DZJjkzwv.mjs +3 -0
- package/dist/.setup/{thread-bindings-DjQCkmsd.mjs → thread-bindings-0hPTSK14.mjs} +61 -52
- package/dist/.setup/{thread-bindings.manager-D2-GYZ5s.mjs → thread-bindings.manager-CdNa6UIs.mjs} +138 -211
- package/dist/.setup/{thread-bindings.session-updates-Bu_CGr_O.mjs → thread-bindings.session-updates-DGSljVf6.mjs} +60 -99
- package/dist/.setup/threading-BKe3E3tp.mjs +246 -0
- package/dist/.setup/{timeouts-pun7VJ02.mjs → timeouts-CuNARfyw.mjs} +10 -18
- package/dist/.setup/{transcripts-source-CaZQnGRH.mjs → transcripts-source-0qQYVu2H.mjs} +50 -368
- package/dist/.setup/{voice-runtime-DDymtIw8.mjs → voice-runtime-QlZJ4sHv.mjs} +166 -322
- package/dist/account-inspect-api.js +1 -1
- package/dist/action-runtime-api.js +1 -1
- package/dist/activities-api.js +77 -120
- package/dist/api.js +19 -18
- package/dist/channel-config-api.js +1 -1
- package/dist/channel-plugin-api.js +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/doctor-contract-api.js +1 -1
- package/dist/runtime-api.js +21 -20
- package/dist/secret-contract-api.js +1 -1
- package/dist/security-audit-contract-api.js +1 -1
- package/dist/security-contract-api.js +1 -1
- package/dist/setup-entry.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/src/voice/audio-worker.runtime.js +38 -57
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/node_modules/@types/node/README.md +1 -1
- package/node_modules/@types/node/crypto.d.ts +2 -2
- package/node_modules/@types/node/dgram.d.ts +1 -1
- package/node_modules/@types/node/package.json +2 -2
- package/node_modules/@types/node/zlib.d.ts +6 -0
- package/node_modules/@types/ws/README.md +1 -1
- package/node_modules/@types/ws/index.d.mts +4 -0
- package/node_modules/@types/ws/index.d.ts +4 -0
- package/node_modules/@types/ws/package.json +3 -3
- package/node_modules/discord-api-types/_generated_/rest/v10/interfaces.d.ts +21 -0
- package/node_modules/discord-api-types/_generated_/rest/v10/interfaces.d.ts.map +1 -1
- package/node_modules/discord-api-types/_generated_/rest/v9/interfaces.d.ts +21 -0
- package/node_modules/discord-api-types/_generated_/rest/v9/interfaces.d.ts.map +1 -1
- package/node_modules/discord-api-types/globals.d.ts +6 -0
- package/node_modules/discord-api-types/globals.d.ts.map +1 -1
- package/node_modules/discord-api-types/globals.js +6 -0
- package/node_modules/discord-api-types/globals.js.map +1 -1
- package/node_modules/discord-api-types/package.json +3 -3
- package/node_modules/discord-api-types/payloads/index.mjs +1 -0
- package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.d.ts +207 -0
- package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.d.ts.map +1 -0
- package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.js +25 -0
- package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.js.map +1 -0
- package/node_modules/discord-api-types/payloads/v10/autoModeration.d.ts +1 -1
- package/node_modules/discord-api-types/payloads/v10/autoModeration.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/guild.d.ts +27 -23
- package/node_modules/discord-api-types/payloads/v10/guild.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/guild.js +26 -22
- package/node_modules/discord-api-types/payloads/v10/guild.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/index.d.ts +1 -0
- package/node_modules/discord-api-types/payloads/v10/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/index.js +1 -0
- package/node_modules/discord-api-types/payloads/v10/index.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v10/index.mjs +1 -0
- package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.d.ts +207 -0
- package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.d.ts.map +1 -0
- package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.js +25 -0
- package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.js.map +1 -0
- package/node_modules/discord-api-types/payloads/v9/autoModeration.d.ts +1 -1
- package/node_modules/discord-api-types/payloads/v9/autoModeration.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/guild.d.ts +27 -23
- package/node_modules/discord-api-types/payloads/v9/guild.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/guild.js +26 -22
- package/node_modules/discord-api-types/payloads/v9/guild.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/index.d.ts +1 -0
- package/node_modules/discord-api-types/payloads/v9/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/index.js +1 -0
- package/node_modules/discord-api-types/payloads/v9/index.js.map +1 -1
- package/node_modules/discord-api-types/payloads/v9/index.mjs +1 -0
- package/node_modules/discord-api-types/rest/common.d.ts +2 -0
- package/node_modules/discord-api-types/rest/common.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/common.js +2 -0
- package/node_modules/discord-api-types/rest/common.js.map +1 -1
- package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.d.ts +70 -0
- package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.d.ts.map +1 -0
- package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.js +3 -0
- package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.js.map +1 -0
- package/node_modules/discord-api-types/rest/v10/index.d.ts +1 -0
- package/node_modules/discord-api-types/rest/v10/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v10/index.js +29 -0
- package/node_modules/discord-api-types/rest/v10/index.js.map +1 -1
- package/node_modules/discord-api-types/rest/v10/interactions.d.ts +4 -2
- package/node_modules/discord-api-types/rest/v10/interactions.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v10/user.d.ts +2 -2
- package/node_modules/discord-api-types/rest/v10/user.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.d.ts +70 -0
- package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.d.ts.map +1 -0
- package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.js +3 -0
- package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.js.map +1 -0
- package/node_modules/discord-api-types/rest/v9/index.d.ts +1 -0
- package/node_modules/discord-api-types/rest/v9/index.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/index.js +29 -0
- package/node_modules/discord-api-types/rest/v9/index.js.map +1 -1
- package/node_modules/discord-api-types/rest/v9/interactions.d.ts +4 -2
- package/node_modules/discord-api-types/rest/v9/interactions.d.ts.map +1 -1
- package/node_modules/discord-api-types/rest/v9/user.d.ts +2 -2
- package/node_modules/discord-api-types/rest/v9/user.d.ts.map +1 -1
- package/node_modules/discord-api-types/v10.mjs +1 -0
- package/node_modules/discord-api-types/v9.mjs +1 -0
- package/node_modules/micromark/dev/lib/compile.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/compile.js +14 -4
- package/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/create-tokenizer.js +7 -6
- package/node_modules/micromark/dev/lib/initialize/document.js +25 -21
- package/node_modules/micromark/dev/lib/initialize/text.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/initialize/text.js +10 -6
- package/node_modules/micromark/dev/lib/preprocess.d.ts.map +1 -1
- package/node_modules/micromark/dev/lib/preprocess.js +19 -21
- package/node_modules/micromark/lib/compile.d.ts.map +1 -1
- package/node_modules/micromark/lib/compile.js +37 -29
- package/node_modules/micromark/lib/create-tokenizer.d.ts.map +1 -1
- package/node_modules/micromark/lib/create-tokenizer.js +37 -35
- package/node_modules/micromark/lib/initialize/document.js +21 -13
- package/node_modules/micromark/lib/initialize/text.d.ts.map +1 -1
- package/node_modules/micromark/lib/initialize/text.js +7 -3
- package/node_modules/micromark/lib/preprocess.d.ts.map +1 -1
- package/node_modules/micromark/lib/preprocess.js +16 -19
- package/node_modules/micromark/package.json +2 -15
- package/node_modules/micromark-core-commonmark/dev/lib/attention.js +18 -24
- package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js +1 -43
- package/node_modules/micromark-core-commonmark/dev/lib/code-indented.js +19 -43
- package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js +2 -6
- package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/html-flow.js +2 -53
- package/node_modules/micromark-core-commonmark/dev/lib/label-end.js +14 -12
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js +14 -5
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js +14 -5
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts +4 -0
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts.map +1 -0
- package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js +67 -0
- package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js +8 -5
- package/node_modules/micromark-core-commonmark/lib/attention.js +14 -24
- package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/code-fenced.js +1 -39
- package/node_modules/micromark-core-commonmark/lib/code-indented.js +11 -29
- package/node_modules/micromark-core-commonmark/lib/heading-atx.js +2 -6
- package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/html-flow.js +2 -51
- package/node_modules/micromark-core-commonmark/lib/label-end.js +11 -10
- package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/label-start-image.js +11 -3
- package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/label-start-link.js +11 -3
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts +4 -0
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts.map +1 -0
- package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js +61 -0
- package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map +1 -1
- package/node_modules/micromark-core-commonmark/lib/setext-underline.js +7 -5
- package/node_modules/micromark-core-commonmark/package.json +4 -16
- package/node_modules/micromark-factory-space/dev/index.d.ts +24 -1
- package/node_modules/micromark-factory-space/dev/index.d.ts.map +1 -1
- package/node_modules/micromark-factory-space/dev/index.js +58 -3
- package/node_modules/micromark-factory-space/index.d.ts +24 -1
- package/node_modules/micromark-factory-space/index.d.ts.map +1 -1
- package/node_modules/micromark-factory-space/index.js +55 -3
- package/node_modules/micromark-factory-space/package.json +1 -10
- package/node_modules/micromark-factory-space/readme.md +25 -25
- package/node_modules/micromark-util-edit-map/dev/index.d.ts +78 -0
- package/node_modules/micromark-util-edit-map/dev/index.d.ts.map +1 -0
- package/node_modules/micromark-util-edit-map/dev/index.js +237 -0
- package/node_modules/micromark-util-edit-map/index.d.ts +78 -0
- package/node_modules/micromark-util-edit-map/index.d.ts.map +1 -0
- package/node_modules/micromark-util-edit-map/index.js +225 -0
- package/node_modules/micromark-util-edit-map/license +22 -0
- package/node_modules/micromark-util-edit-map/package.json +48 -0
- package/node_modules/micromark-util-edit-map/readme.md +234 -0
- package/node_modules/micromark-util-types/index.d.ts +6 -3
- package/node_modules/micromark-util-types/package.json +2 -36
- package/node_modules/ws/lib/websocket.js +17 -3
- package/node_modules/ws/package.json +1 -1
- package/openclaw.plugin.json +3 -6
- package/package.json +7 -12
- package/dist/.setup/account-inspect-DsER5ILV.mjs +0 -45
- package/dist/.setup/provider.runtime-CZ51OIgD.mjs +0 -2
- package/dist/.setup/resolve-allowlist-common-BUyU3C-T.mjs +0 -27
- package/dist/.setup/resolve-channels-DA6QlhZN.mjs +0 -246
- package/dist/.setup/security-contract-DSHk7I2w.mjs +0 -26
- package/dist/.setup/setup-plugin-api-BVlCz3fm.mjs +0 -3
- package/dist/.setup/targets-bqXQENmX.mjs +0 -3
- package/dist/control-ui/2afbdab1d3aa65a789d8a3eba666f4b1ec5df07073538fe30d6cf32093a1fb2d/index.js +0 -1
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
import { A as resolveDiscordSendEmbeds, D as createDiscordMessageNonce, E as buildDiscordMessageRequest, M as parseAndResolveChannelRecipient, N as createDiscordClient, O as resolveDiscordMessageFlags, c as resolveChannelId, d as
|
|
2
|
-
import {
|
|
3
|
-
import { a as createReusableDiscordReplyReference, n as createDiscordSendReceiptFromResults, r as createDiscordSendResult } from "./send.receipt-
|
|
4
|
-
import { a as normalizeDiscordSnowflake, i as normalizeDiscordHandleKey, s as resolveDiscordDirectoryUserId } from "./directory-live-
|
|
5
|
-
import {
|
|
6
|
-
import { ChannelType
|
|
1
|
+
import { A as resolveDiscordSendEmbeds, D as createDiscordMessageNonce, E as buildDiscordMessageRequest, M as parseAndResolveChannelRecipient, N as createDiscordClient, O as resolveDiscordMessageFlags, c as resolveChannelId, d as sendDiscordChunks, f as sendDiscordMedia, i as normalizeDiscordPollInput, j as resolveDiscordSuppressEmbeds, k as resolveDiscordSendComponents, l as resolveDiscordChannel, n as buildDiscordTextChunks, s as normalizeStickerIds, t as buildDiscordSendError } from "./send.shared-CjQ4jbMA.mjs";
|
|
2
|
+
import { W as withDiscordRequestAuthority, ct as createThread, st as createChannelMessage } from "./discord-BGqgx-yd.mjs";
|
|
3
|
+
import { a as createReusableDiscordReplyReference, n as createDiscordSendReceiptFromResults, r as createDiscordSendResult } from "./send.receipt-BAlzXd8e.mjs";
|
|
4
|
+
import { a as normalizeDiscordSnowflake, i as normalizeDiscordHandleKey, s as resolveDiscordDirectoryUserId } from "./directory-live-DLygQVtW.mjs";
|
|
5
|
+
import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
|
+
import { ChannelType } from "discord-api-types/v10";
|
|
7
7
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
8
8
|
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
9
9
|
import { resolveChunkMode } from "openclaw/plugin-sdk/reply-chunking";
|
|
@@ -37,25 +37,22 @@ function resolveConfiguredMentionAlias(handle, mentionAliases) {
|
|
|
37
37
|
const alias = normalizeDiscordHandleKey(rawAlias);
|
|
38
38
|
if (!alias) continue;
|
|
39
39
|
const aliasWithoutDiscriminator = alias.replace(DISCORD_DISCRIMINATOR_SUFFIX, "");
|
|
40
|
-
if (alias === key ||
|
|
40
|
+
if (alias === key || alias === withoutDiscriminator || aliasWithoutDiscriminator === key) {
|
|
41
41
|
const userId = normalizeDiscordSnowflake(rawUserId);
|
|
42
42
|
if (userId) return userId;
|
|
43
43
|
}
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
function rewritePlainTextMentions(text, params) {
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
const handle = normalizeOptionalString(rawHandle) ?? "";
|
|
50
|
-
if (!handle) return match;
|
|
51
|
-
const lookup = normalizeLowercaseStringOrEmpty(handle);
|
|
47
|
+
return text.replace(MENTION_CANDIDATE_PATTERN, (match, prefix, handle) => {
|
|
48
|
+
const lookup = handle.toLowerCase();
|
|
52
49
|
if (DISCORD_RESERVED_MENTIONS.has(lookup)) return match;
|
|
53
50
|
const userId = resolveConfiguredMentionAlias(handle, params.mentionAliases) ?? resolveDiscordDirectoryUserId({
|
|
54
51
|
accountId: params.accountId,
|
|
55
52
|
handle
|
|
56
53
|
});
|
|
57
54
|
if (!userId) return match;
|
|
58
|
-
return `${
|
|
55
|
+
return `${prefix}${formatMention({ userId })}`;
|
|
59
56
|
});
|
|
60
57
|
}
|
|
61
58
|
function countBacktickRun(text, index) {
|
|
@@ -118,7 +115,6 @@ function findDiscordUrlRanges(markdown) {
|
|
|
118
115
|
const ranges = [];
|
|
119
116
|
for (const match of markdown.matchAll(DISCORD_URL_START_RE)) {
|
|
120
117
|
const start = match.index;
|
|
121
|
-
if (start === void 0) continue;
|
|
122
118
|
const preceding = markdown[start - 1] ?? "";
|
|
123
119
|
if (/[\p{L}\p{N}]/u.test(preceding) || preceding === "_" && markdown[start - 2] !== "_") continue;
|
|
124
120
|
let end = start + match[0].length;
|
|
@@ -146,17 +142,15 @@ function markdownSemanticSignature(root) {
|
|
|
146
142
|
node: root,
|
|
147
143
|
parentStrong: false
|
|
148
144
|
}];
|
|
149
|
-
|
|
150
|
-
const event = pending.pop();
|
|
151
|
-
if (!event) continue;
|
|
145
|
+
for (let event = pending.pop(); event; event = pending.pop()) {
|
|
152
146
|
if (event.exiting) {
|
|
153
147
|
parts.push(")");
|
|
154
148
|
continue;
|
|
155
149
|
}
|
|
156
150
|
const { node } = event;
|
|
157
151
|
const redundantStrong = event.parentStrong && node.type === "strong";
|
|
158
|
-
const
|
|
159
|
-
const children =
|
|
152
|
+
const { children: childNodes, position: _position, ...fields } = node;
|
|
153
|
+
const children = childNodes ?? [];
|
|
160
154
|
if (!redundantStrong) {
|
|
161
155
|
parts.push(`(${JSON.stringify(fields)}`);
|
|
162
156
|
pending.push({
|
|
@@ -185,9 +179,7 @@ function normalizeDiscordBold(markdown) {
|
|
|
185
179
|
const sourceTree = fromMarkdown(markdown);
|
|
186
180
|
const activeSpanIds = [];
|
|
187
181
|
const pending = [{ node: sourceTree }];
|
|
188
|
-
|
|
189
|
-
const event = pending.pop();
|
|
190
|
-
if (!event) continue;
|
|
182
|
+
for (let event = pending.pop(); event; event = pending.pop()) {
|
|
191
183
|
if (event.exiting !== void 0) {
|
|
192
184
|
activeSpanIds.pop();
|
|
193
185
|
continue;
|
|
@@ -268,10 +260,10 @@ function normalizeDiscordBold(markdown) {
|
|
|
268
260
|
const interiorStart = span.start + 2;
|
|
269
261
|
strongInteriorStartByEnd.set(span.end, Math.min(strongInteriorStartByEnd.get(span.end) ?? interiorStart, interiorStart));
|
|
270
262
|
}
|
|
271
|
-
const nativeTokenRanges = [...markdown.matchAll(DISCORD_NATIVE_TOKEN_RE)].
|
|
263
|
+
const nativeTokenRanges = [...markdown.matchAll(DISCORD_NATIVE_TOKEN_RE)].map((match) => ({
|
|
272
264
|
start: match.index,
|
|
273
265
|
end: match.index + match[0].length
|
|
274
|
-
}
|
|
266
|
+
}));
|
|
275
267
|
const protectedRanges = [
|
|
276
268
|
...findDiscordUrlRanges(markdown),
|
|
277
269
|
...astLinkRanges,
|
|
@@ -303,9 +295,9 @@ function normalizeDiscordBold(markdown) {
|
|
|
303
295
|
}))), ...contentEdits].toSorted((left, right) => left.start - right.start);
|
|
304
296
|
const editsBySpan = /* @__PURE__ */ new Map();
|
|
305
297
|
for (const edit of edits) {
|
|
306
|
-
const spanEdits = editsBySpan.get(edit.spanId);
|
|
307
|
-
|
|
308
|
-
|
|
298
|
+
const spanEdits = editsBySpan.get(edit.spanId) ?? [];
|
|
299
|
+
spanEdits.push(edit);
|
|
300
|
+
editsBySpan.set(edit.spanId, spanEdits);
|
|
309
301
|
}
|
|
310
302
|
const renderEdits = (selectedEdits, start = 0, end = markdown.length) => {
|
|
311
303
|
let cursor = start;
|
|
@@ -388,96 +380,105 @@ function isForumLikeChannel(channel) {
|
|
|
388
380
|
return channel?.type === ChannelType.GuildForum || channel?.type === ChannelType.GuildMedia;
|
|
389
381
|
}
|
|
390
382
|
async function sendMessageDiscord(to, text, opts) {
|
|
391
|
-
return await withDiscordRequestAuthority(opts.assertPlatformSendAuthorized, () =>
|
|
392
|
-
|
|
393
|
-
|
|
394
|
-
|
|
395
|
-
|
|
396
|
-
...opts,
|
|
397
|
-
cfg
|
|
398
|
-
});
|
|
399
|
-
const chunkMode = opts.chunkMode ?? resolveChunkMode(cfg, "discord", accountInfo.accountId);
|
|
400
|
-
const maxLinesPerMessage = opts.maxLinesPerMessage ?? accountInfo.config.maxLinesPerMessage;
|
|
401
|
-
const suppressEmbeds = resolveDiscordSuppressEmbeds({
|
|
402
|
-
configured: accountInfo.config.suppressEmbeds,
|
|
403
|
-
override: opts.suppressEmbeds
|
|
404
|
-
});
|
|
405
|
-
const mediaMaxBytes = typeof accountInfo.config.mediaMaxMb === "number" ? accountInfo.config.mediaMaxMb * 1024 * 1024 : DEFAULT_DISCORD_MEDIA_MAX_MB * 1024 * 1024;
|
|
406
|
-
const { renderedText, textWithMentions, textLimit } = prepareDiscordOutboundText(text ?? "", {
|
|
407
|
-
cfg,
|
|
408
|
-
account: accountInfo,
|
|
409
|
-
tableMode: opts.tableMode,
|
|
410
|
-
textLimit: opts.textLimit
|
|
411
|
-
});
|
|
412
|
-
const recipient = await parseAndResolveChannelRecipient(to, cfg, accountInfo.accountId);
|
|
413
|
-
const { channelId } = await resolveChannelId(rest, recipient, request);
|
|
414
|
-
const channel = await resolveDiscordChannel(rest, channelId);
|
|
415
|
-
const deliveredResults = [];
|
|
416
|
-
let deliveryThreadId;
|
|
417
|
-
const reportResult = async (progressResult, kind, replyToId) => {
|
|
418
|
-
const deliveredResult = createDiscordSendResult({
|
|
419
|
-
result: progressResult,
|
|
420
|
-
fallbackChannelId: deliveryThreadId ?? channelId,
|
|
421
|
-
kind,
|
|
422
|
-
threadId: deliveryThreadId,
|
|
423
|
-
reply: createReusableDiscordReplyReference(replyToId)
|
|
424
|
-
});
|
|
425
|
-
deliveredResults.push(deliveredResult);
|
|
426
|
-
await opts.onDeliveryResult?.(deliveredResult);
|
|
427
|
-
};
|
|
428
|
-
const textSendOptions = {
|
|
429
|
-
rest,
|
|
430
|
-
request,
|
|
431
|
-
maxLinesPerMessage,
|
|
432
|
-
chunkMode,
|
|
433
|
-
silent: opts.silent,
|
|
434
|
-
suppressEmbeds,
|
|
435
|
-
allowedMentions: opts.allowedMentions,
|
|
436
|
-
maxChars: textLimit,
|
|
437
|
-
onResult: reportResult,
|
|
438
|
-
onPlatformSendDispatch: opts.onPlatformSendDispatch,
|
|
439
|
-
assertPlatformSendAuthorized: opts.assertPlatformSendAuthorized
|
|
440
|
-
};
|
|
441
|
-
const mediaSendOptions = {
|
|
442
|
-
filename: opts.filename,
|
|
443
|
-
mediaAccess: opts.mediaAccess,
|
|
444
|
-
mediaLocalRoots: opts.mediaLocalRoots,
|
|
445
|
-
mediaReadFile: opts.mediaReadFile,
|
|
446
|
-
maxBytes: mediaMaxBytes
|
|
447
|
-
};
|
|
448
|
-
if (isForumLikeChannel(channel)) {
|
|
449
|
-
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.`);
|
|
450
|
-
const threadName = deriveForumThreadName(renderedText);
|
|
451
|
-
const chunks = buildDiscordTextChunks(textWithMentions, {
|
|
452
|
-
maxLinesPerMessage,
|
|
453
|
-
chunkMode,
|
|
454
|
-
maxChars: textLimit
|
|
383
|
+
return await withDiscordRequestAuthority(opts.assertPlatformSendAuthorized, async () => {
|
|
384
|
+
const cfg = requireRuntimeConfig(opts.cfg, "Discord send");
|
|
385
|
+
const { token, rest, request, account: accountInfo } = createDiscordClient({
|
|
386
|
+
...opts,
|
|
387
|
+
cfg
|
|
455
388
|
});
|
|
456
|
-
const
|
|
457
|
-
const
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
389
|
+
const chunkMode = opts.chunkMode ?? resolveChunkMode(cfg, "discord", accountInfo.accountId);
|
|
390
|
+
const maxLinesPerMessage = opts.maxLinesPerMessage ?? accountInfo.config.maxLinesPerMessage;
|
|
391
|
+
const suppressEmbeds = resolveDiscordSuppressEmbeds({
|
|
392
|
+
configured: accountInfo.config.suppressEmbeds,
|
|
393
|
+
override: opts.suppressEmbeds
|
|
461
394
|
});
|
|
462
|
-
const
|
|
463
|
-
|
|
464
|
-
|
|
395
|
+
const mediaMaxBytes = typeof accountInfo.config.mediaMaxMb === "number" ? accountInfo.config.mediaMaxMb * 1024 * 1024 : DEFAULT_DISCORD_MEDIA_MAX_MB * 1024 * 1024;
|
|
396
|
+
const { renderedText, textWithMentions, textLimit } = prepareDiscordOutboundText(text ?? "", {
|
|
397
|
+
cfg,
|
|
398
|
+
account: accountInfo,
|
|
399
|
+
tableMode: opts.tableMode,
|
|
400
|
+
textLimit: opts.textLimit
|
|
465
401
|
});
|
|
466
|
-
const
|
|
402
|
+
const recipient = await parseAndResolveChannelRecipient(to, cfg, accountInfo.accountId);
|
|
403
|
+
const { channelId } = await resolveChannelId(rest, recipient, request);
|
|
404
|
+
const channel = await resolveDiscordChannel(rest, channelId);
|
|
405
|
+
const deliveredResults = [];
|
|
406
|
+
let deliveryThreadId;
|
|
407
|
+
const reportResult = async (progressResult, kind, replyToId) => {
|
|
408
|
+
const deliveredResult = createDiscordSendResult({
|
|
409
|
+
result: progressResult,
|
|
410
|
+
fallbackChannelId: deliveryThreadId ?? channelId,
|
|
411
|
+
kind,
|
|
412
|
+
threadId: deliveryThreadId,
|
|
413
|
+
reply: createReusableDiscordReplyReference(replyToId)
|
|
414
|
+
});
|
|
415
|
+
deliveredResults.push(deliveredResult);
|
|
416
|
+
await opts.onDeliveryResult?.(deliveredResult);
|
|
417
|
+
};
|
|
418
|
+
const textSendOptions = {
|
|
419
|
+
rest,
|
|
420
|
+
request,
|
|
421
|
+
maxLinesPerMessage,
|
|
422
|
+
chunkMode,
|
|
467
423
|
silent: opts.silent,
|
|
468
|
-
suppressEmbeds
|
|
469
|
-
|
|
470
|
-
|
|
471
|
-
|
|
472
|
-
|
|
473
|
-
|
|
474
|
-
|
|
475
|
-
|
|
476
|
-
|
|
477
|
-
|
|
478
|
-
|
|
479
|
-
|
|
480
|
-
|
|
424
|
+
suppressEmbeds,
|
|
425
|
+
allowedMentions: opts.allowedMentions,
|
|
426
|
+
maxChars: textLimit,
|
|
427
|
+
onResult: reportResult,
|
|
428
|
+
onPlatformSendDispatch: opts.onPlatformSendDispatch,
|
|
429
|
+
assertPlatformSendAuthorized: opts.assertPlatformSendAuthorized
|
|
430
|
+
};
|
|
431
|
+
const mediaSendOptions = {
|
|
432
|
+
filename: opts.filename,
|
|
433
|
+
mediaAccess: opts.mediaAccess,
|
|
434
|
+
mediaLocalRoots: opts.mediaLocalRoots,
|
|
435
|
+
mediaReadFile: opts.mediaReadFile,
|
|
436
|
+
maxBytes: mediaMaxBytes
|
|
437
|
+
};
|
|
438
|
+
async function sendWithError(targetChannelId, send) {
|
|
439
|
+
try {
|
|
440
|
+
return await send();
|
|
441
|
+
} catch (err) {
|
|
442
|
+
throw await buildDiscordSendError(err, {
|
|
443
|
+
channelId: targetChannelId,
|
|
444
|
+
cfg,
|
|
445
|
+
rest,
|
|
446
|
+
token,
|
|
447
|
+
hasMedia: Boolean(opts.mediaUrl)
|
|
448
|
+
});
|
|
449
|
+
}
|
|
450
|
+
}
|
|
451
|
+
if (isForumLikeChannel(channel)) {
|
|
452
|
+
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.`);
|
|
453
|
+
const threadName = deriveForumThreadName(renderedText);
|
|
454
|
+
const chunks = buildDiscordTextChunks(textWithMentions, {
|
|
455
|
+
maxLinesPerMessage,
|
|
456
|
+
chunkMode,
|
|
457
|
+
maxChars: textLimit
|
|
458
|
+
});
|
|
459
|
+
const starterContent = chunks[0]?.trim() ? chunks[0] : threadName;
|
|
460
|
+
const starterComponents = resolveDiscordSendComponents({
|
|
461
|
+
components: opts.components,
|
|
462
|
+
text: starterContent,
|
|
463
|
+
isFirst: true
|
|
464
|
+
});
|
|
465
|
+
const starterEmbeds = resolveDiscordSendEmbeds({
|
|
466
|
+
embeds: opts.embeds,
|
|
467
|
+
isFirst: true
|
|
468
|
+
});
|
|
469
|
+
const starterFlags = resolveDiscordMessageFlags({
|
|
470
|
+
silent: opts.silent,
|
|
471
|
+
suppressEmbeds: suppressEmbeds && !starterEmbeds?.length
|
|
472
|
+
});
|
|
473
|
+
const starterBody = buildDiscordMessageRequest({
|
|
474
|
+
endpoint: "forum-thread",
|
|
475
|
+
text: starterContent,
|
|
476
|
+
components: starterComponents,
|
|
477
|
+
embeds: starterEmbeds,
|
|
478
|
+
flags: starterFlags,
|
|
479
|
+
allowedMentions: opts.allowedMentions
|
|
480
|
+
});
|
|
481
|
+
const threadRes = await sendWithError(channelId, () => request(async () => {
|
|
481
482
|
await opts.onPlatformSendDispatch?.();
|
|
482
483
|
opts.assertPlatformSendAuthorized?.();
|
|
483
484
|
return createThread(rest, channelId, { body: {
|
|
@@ -485,109 +486,84 @@ async function sendMessageDiscordInternal(to, text, opts) {
|
|
|
485
486
|
...channel.default_auto_archive_duration === void 0 ? {} : { auto_archive_duration: channel.default_auto_archive_duration },
|
|
486
487
|
message: starterBody
|
|
487
488
|
} });
|
|
488
|
-
}, "forum-thread", { safety: "non-idempotent-create" });
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
492
|
-
|
|
493
|
-
|
|
494
|
-
|
|
495
|
-
|
|
489
|
+
}, "forum-thread", { safety: "non-idempotent-create" }));
|
|
490
|
+
const threadId = threadRes.id;
|
|
491
|
+
deliveryThreadId = threadId;
|
|
492
|
+
const messageId = threadRes.message?.id ?? threadId;
|
|
493
|
+
const resultChannelId = threadRes.message?.channel_id ?? threadId;
|
|
494
|
+
const remainingChunks = chunks.slice(1);
|
|
495
|
+
const starterResult = createDiscordSendResult({
|
|
496
|
+
result: {
|
|
497
|
+
id: messageId,
|
|
498
|
+
channel_id: resultChannelId
|
|
499
|
+
},
|
|
500
|
+
fallbackChannelId: channelId,
|
|
501
|
+
kind: "text",
|
|
502
|
+
threadId
|
|
496
503
|
});
|
|
497
|
-
|
|
498
|
-
|
|
499
|
-
|
|
500
|
-
|
|
501
|
-
|
|
502
|
-
|
|
503
|
-
|
|
504
|
-
|
|
505
|
-
|
|
506
|
-
|
|
507
|
-
|
|
508
|
-
|
|
509
|
-
|
|
510
|
-
|
|
511
|
-
|
|
512
|
-
|
|
513
|
-
await opts.onDeliveryResult?.(starterResult);
|
|
514
|
-
try {
|
|
515
|
-
let textChunks = remainingChunks;
|
|
516
|
-
if (opts.mediaUrl) {
|
|
517
|
-
const [mediaCaption, ...afterMediaChunks] = remainingChunks;
|
|
518
|
-
await sendDiscordMedia({
|
|
504
|
+
deliveredResults.push(starterResult);
|
|
505
|
+
await opts.onDeliveryResult?.(starterResult);
|
|
506
|
+
await sendWithError(threadId, async () => {
|
|
507
|
+
let textChunks = remainingChunks;
|
|
508
|
+
if (opts.mediaUrl) {
|
|
509
|
+
const [mediaCaption, ...afterMediaChunks] = remainingChunks;
|
|
510
|
+
await sendDiscordMedia({
|
|
511
|
+
...textSendOptions,
|
|
512
|
+
...mediaSendOptions,
|
|
513
|
+
channelId: threadId,
|
|
514
|
+
text: mediaCaption ?? "",
|
|
515
|
+
mediaUrl: opts.mediaUrl
|
|
516
|
+
});
|
|
517
|
+
textChunks = afterMediaChunks;
|
|
518
|
+
}
|
|
519
|
+
for (const chunk of textChunks) await sendDiscordChunks({
|
|
519
520
|
...textSendOptions,
|
|
520
|
-
...mediaSendOptions,
|
|
521
521
|
channelId: threadId,
|
|
522
|
-
text:
|
|
523
|
-
mediaUrl: opts.mediaUrl
|
|
522
|
+
text: chunk
|
|
524
523
|
});
|
|
525
|
-
textChunks = afterMediaChunks;
|
|
526
|
-
}
|
|
527
|
-
for (const chunk of textChunks) await sendDiscordText({
|
|
528
|
-
...textSendOptions,
|
|
529
|
-
channelId: threadId,
|
|
530
|
-
text: chunk
|
|
531
524
|
});
|
|
532
|
-
|
|
533
|
-
|
|
534
|
-
|
|
535
|
-
|
|
536
|
-
rest,
|
|
537
|
-
token,
|
|
538
|
-
hasMedia: Boolean(opts.mediaUrl)
|
|
525
|
+
recordChannelActivity({
|
|
526
|
+
channel: "discord",
|
|
527
|
+
accountId: accountInfo.accountId,
|
|
528
|
+
direction: "outbound"
|
|
539
529
|
});
|
|
530
|
+
return {
|
|
531
|
+
...starterResult,
|
|
532
|
+
receipt: createDiscordSendReceiptFromResults({
|
|
533
|
+
results: deliveredResults,
|
|
534
|
+
threadId
|
|
535
|
+
})
|
|
536
|
+
};
|
|
540
537
|
}
|
|
538
|
+
const result = await sendWithError(channelId, async () => {
|
|
539
|
+
const message = {
|
|
540
|
+
...textSendOptions,
|
|
541
|
+
channelId,
|
|
542
|
+
text: textWithMentions,
|
|
543
|
+
reply: opts.reply,
|
|
544
|
+
components: opts.components,
|
|
545
|
+
embeds: opts.embeds
|
|
546
|
+
};
|
|
547
|
+
return opts.mediaUrl ? await sendDiscordMedia({
|
|
548
|
+
...message,
|
|
549
|
+
...mediaSendOptions,
|
|
550
|
+
mediaUrl: opts.mediaUrl
|
|
551
|
+
}) : await sendDiscordChunks(message);
|
|
552
|
+
});
|
|
541
553
|
recordChannelActivity({
|
|
542
554
|
channel: "discord",
|
|
543
555
|
accountId: accountInfo.accountId,
|
|
544
556
|
direction: "outbound"
|
|
545
557
|
});
|
|
546
558
|
return {
|
|
547
|
-
...
|
|
548
|
-
|
|
549
|
-
|
|
550
|
-
|
|
551
|
-
})
|
|
559
|
+
...createDiscordSendResult({
|
|
560
|
+
result,
|
|
561
|
+
fallbackChannelId: channelId,
|
|
562
|
+
kind: "text"
|
|
563
|
+
}),
|
|
564
|
+
receipt: createDiscordSendReceiptFromResults({ results: deliveredResults })
|
|
552
565
|
};
|
|
553
|
-
}
|
|
554
|
-
let result;
|
|
555
|
-
try {
|
|
556
|
-
const message = {
|
|
557
|
-
...textSendOptions,
|
|
558
|
-
channelId,
|
|
559
|
-
text: textWithMentions,
|
|
560
|
-
reply: opts.reply,
|
|
561
|
-
components: opts.components,
|
|
562
|
-
embeds: opts.embeds
|
|
563
|
-
};
|
|
564
|
-
result = opts.mediaUrl ? await sendDiscordMedia({
|
|
565
|
-
...message,
|
|
566
|
-
...mediaSendOptions,
|
|
567
|
-
mediaUrl: opts.mediaUrl
|
|
568
|
-
}) : await sendDiscordText(message);
|
|
569
|
-
} catch (err) {
|
|
570
|
-
throw await buildDiscordSendError(err, {
|
|
571
|
-
channelId,
|
|
572
|
-
cfg,
|
|
573
|
-
rest,
|
|
574
|
-
token,
|
|
575
|
-
hasMedia: Boolean(opts.mediaUrl)
|
|
576
|
-
});
|
|
577
|
-
}
|
|
578
|
-
recordChannelActivity({
|
|
579
|
-
channel: "discord",
|
|
580
|
-
accountId: accountInfo.accountId,
|
|
581
|
-
direction: "outbound"
|
|
582
566
|
});
|
|
583
|
-
return {
|
|
584
|
-
...createDiscordSendResult({
|
|
585
|
-
result,
|
|
586
|
-
fallbackChannelId: channelId,
|
|
587
|
-
kind: "text"
|
|
588
|
-
}),
|
|
589
|
-
receipt: createDiscordSendReceiptFromResults({ results: deliveredResults })
|
|
590
|
-
};
|
|
591
567
|
}
|
|
592
568
|
async function sendStickerDiscord(to, stickerIds, opts) {
|
|
593
569
|
return sendDiscordStructuredMessage(to, opts, "sticker", () => ({ sticker_ids: normalizeStickerIds(stickerIds) }));
|
|
@@ -630,7 +606,7 @@ async function sendDiscordStructuredMessage(to, opts, kind, buildPayload) {
|
|
|
630
606
|
const result = await request(async () => {
|
|
631
607
|
await opts.onPlatformSendDispatch?.();
|
|
632
608
|
opts.assertPlatformSendAuthorized?.();
|
|
633
|
-
return
|
|
609
|
+
return createChannelMessage(rest, channelId, { body });
|
|
634
610
|
}, kind, { safety: "nonce-protected-create" });
|
|
635
611
|
recordChannelActivity({
|
|
636
612
|
channel: "discord",
|