@openclaw/discord 2026.7.1-beta.6 → 2026.7.2-beta.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/action-runtime-api.js +1 -1
- package/dist/{allow-list-C-MqM-B_.js → allow-list-B7qOH5xu.js} +22 -1
- package/dist/{api-DPRqYi4Z.js → api--f62GFaS.js} +38 -23
- package/dist/api.js +15 -15
- package/dist/approval-custom-id-NYPYj9Po.js +58 -0
- package/dist/{approval-handler.runtime-Bw2pZNk1.js → approval-handler.runtime-DeyIiw5I.js} +28 -23
- package/dist/approval-message-safety-C-8BL6Kv.js +47 -0
- package/dist/{audit-MLpDpN3Z.js → audit-Df2w046a.js} +3 -3
- package/dist/{channel-actions-D_fjVUZ_.js → channel-actions-ChpBSRcu.js} +6 -4
- package/dist/{channel-actions.runtime-CVHlFqQg.js → channel-actions.runtime-D8V8tyCq.js} +41 -12
- package/dist/channel-config-api.js +1 -1
- package/dist/{channel-DGWPH5u3.js → channel-nYmJ7FKQ.js} +275 -62
- package/dist/channel-plugin-api.js +1 -1
- package/dist/{channel.setup-tZcpIn4e.js → channel.setup-DyihrqHH.js} +3 -3
- package/dist/{components-BIBizbtZ.js → components-BVrfRS-F.js} +78 -52
- package/dist/config-api-B18fR8M5.js +3 -0
- package/dist/{config-schema-BgIhO3ko.js → config-schema-_bUKcWRm.js} +42 -82
- package/dist/conversation-identity-BpkAzklg.js +94 -0
- package/dist/{directory-config-ByaUKL1f.js → directory-config-BUe-qq_C.js} +1 -1
- package/dist/directory-contract-api.js +1 -1
- package/dist/{directory-live-BX79ImQA.js → directory-live-DZByMdPO.js} +6 -6
- package/dist/{doctor-Bgoxm5AN.js → doctor-bMaWXFKu.js} +5 -4
- package/dist/doctor-contract-api.js +1 -1
- package/dist/{doctor-contract-CU7lnZTF.js → doctor-contract-wId6pV41.js} +41 -37
- package/dist/{handle-action.guild-admin-CgJSNVui.js → handle-action.guild-admin-C_PQcBEV.js} +12 -12
- package/dist/index.js +1 -1
- package/dist/legacy-state-migrations-api.js +24 -2
- package/dist/{manager.runtime-DaB-CTrt.js → manager.runtime-3RVMVkyx.js} +546 -154
- package/dist/{message-handler-DcgvugZt.js → message-handler-CIxWq5Yh.js} +8 -9
- package/dist/{message-handler.preflight-DvLXiYVH.js → message-handler.preflight-BI86IbHz.js} +46 -22
- package/dist/{message-handler.process-Cjf30P_B.js → message-handler.process-bPS_9_tb.js} +241 -107
- package/dist/{message-utils-B_3yA5bN.js → message-utils-D4j07taS.js} +2 -3
- package/dist/{outbound-adapter-82RWi_SR.js → outbound-adapter-Czny0Fae.js} +16 -68
- package/dist/outbound-components-oJKLj62G.js +99 -0
- package/dist/pluralkit-UXq1OyUI.js +40 -0
- package/dist/{probe-D1ImJEo2.js → probe-DxjMBeVG.js} +1 -1
- package/dist/{probe.runtime-B1dsEeBD.js → probe.runtime-Bc8Oo6e8.js} +1 -1
- package/dist/{provider-BkfbC9FQ.js → provider-DWvDNb4J.js} +702 -236
- package/dist/{provider-session.runtime-BDjyFw6Y.js → provider-session.runtime-D5pCGibh.js} +3 -3
- package/dist/provider.runtime-C2iIfbTs.js +2 -0
- package/dist/{resolve-allowlist-common-CWbE8XlH.js → resolve-allowlist-common-B9S8LLBd.js} +5 -5
- package/dist/{resolve-channels-CcpvWoRa.js → resolve-channels-BrkWOKdG.js} +7 -7
- package/dist/{resolve-users-DJamun9s.js → resolve-users-OjrXXvJP.js} +5 -5
- package/dist/{runtime-C6rRmQ6l.js → runtime-C618lis9.js} +223 -33
- package/dist/runtime-api.actions.js +2 -2
- package/dist/runtime-api.js +23 -23
- package/dist/runtime-api.lookup.js +5 -5
- package/dist/runtime-api.monitor-DSbfGnzS.js +6 -0
- package/dist/runtime-api.monitor.js +7 -7
- package/dist/runtime-api.send.js +5 -5
- package/dist/runtime-api.threads.js +5 -5
- package/dist/{send-iJ0B4bAX.js → send-BFpa_DHn.js} +21 -12
- package/dist/{send.components-D0I39utR.js → send.components-BaXQJKWT.js} +15 -10
- package/dist/{send.outbound-Bj61Q3a0.js → send.outbound-BlA6VzSE.js} +22 -12
- package/dist/{send.receipt-BpBQED_5.js → send.receipt-aegk69an.js} +59 -75
- package/dist/{send.shared-wAwMhHDN.js → send.shared-Xz7IMVpu.js} +44 -20
- package/dist/{sender-identity-CEsfDF0L.js → sender-identity-C62lBe18.js} +1 -1
- package/dist/session-binding-contract-api.js +1 -1
- package/dist/setup-plugin-api.js +1 -1
- package/dist/{shared-BQVKfnev.js → shared-BLYBt5SA.js} +3 -3
- package/dist/{subagent-hooks-B-bJxxGg.js → subagent-hooks-DKJ4p-Oy.js} +2 -2
- package/dist/subagent-hooks-api.js +1 -1
- package/dist/{system-events-DVnqSyTt.js → system-events-DKwfE-2z.js} +2 -2
- package/dist/{target-resolver-CwHaSLt3.js → target-resolver-BQyEHyeS.js} +2 -2
- package/dist/targets-DvItNIvP.js +3 -0
- package/dist/thread-binding-api-BDZJD4na.js +4 -0
- package/dist/thread-binding-api.js +1 -3
- package/dist/{thread-bindings-DsTxqu3E.js → thread-bindings-BbzjUuNB.js} +26 -43
- package/dist/{thread-bindings.discord-api-BjIf9lGs.js → thread-bindings.discord-api-DJD3qwIN.js} +8 -10
- package/dist/{thread-bindings.manager-Bwmtqc3E.js → thread-bindings.manager-BIBm6bQd.js} +4 -4
- package/dist/{thread-bindings.session-updates-Chs3HgGa.js → thread-bindings.session-updates-eRcJlzIU.js} +1 -1
- package/dist/{thread-bindings.state-iSWjCYjB.js → thread-bindings.state-9VAxhVf6.js} +3 -14
- package/dist/{timeouts-C5TBc_9x.js → timeouts-ZRc9Lw4y.js} +3 -15
- package/dist/timeouts.js +1 -1
- package/dist/{transcripts-source-BvvM5Ns9.js → transcripts-source-CLZ5X8fh.js} +1 -1
- package/dist/transcripts-source-api.js +1 -1
- package/dist/{typing-BVcJgILg.js → typing-BnYT7Szq.js} +2 -2
- package/node_modules/p-map/index.d.ts +155 -0
- package/node_modules/p-map/index.js +284 -0
- package/node_modules/p-map/license +9 -0
- package/node_modules/p-map/package.json +57 -0
- package/node_modules/p-map/readme.md +190 -0
- package/npm-shrinkwrap.json +16 -3
- package/openclaw.plugin.json +70 -2
- package/package.json +6 -4
- package/dist/config-api-JiPdJeb0.js +0 -2
- package/dist/conversation-identity-DWC5d8Sy.js +0 -272
- package/dist/pluralkit-DcD-3EcL.js +0 -24
- package/dist/preview-streaming-DXT8oJdo.js +0 -8
- package/dist/provider.runtime-WrJXikSv.js +0 -2
- package/dist/runtime-api.monitor-C2_WVtJf.js +0 -6
- package/dist/targets-69w7c3vU.js +0 -3
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { i as setPresence, n as getPresence, r as presenceCacheSize, t as clearPresences } from "./presence-cache-z1N8MbJ3.js";
|
|
2
|
-
import { G as registerGateway, K as unregisterGateway, U as clearGateways, W as getGateway } from "./send.shared-
|
|
3
|
-
import { _ as
|
|
4
|
-
import { a as isAbortError, c as normalizeDiscordListenerTimeoutMs, i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, o as mergeAbortSignals, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, s as normalizeDiscordInboundWorkerTimeoutMs, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS, u as runDiscordTaskWithTimeout } from "./timeouts-
|
|
5
|
-
import {
|
|
6
|
-
import { i as buildDiscordMediaPayload } from "./message-utils-
|
|
7
|
-
import { t as createDiscordMessageHandler } from "./message-handler-
|
|
8
|
-
import "./runtime-api.monitor-
|
|
2
|
+
import { G as registerGateway, K as unregisterGateway, U as clearGateways, W as getGateway } from "./send.shared-Xz7IMVpu.js";
|
|
3
|
+
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-B7qOH5xu.js";
|
|
4
|
+
import { a as isAbortError, c as normalizeDiscordListenerTimeoutMs, i as DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, o as mergeAbortSignals, r as DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, s as normalizeDiscordInboundWorkerTimeoutMs, t as DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS, u as runDiscordTaskWithTimeout } from "./timeouts-ZRc9Lw4y.js";
|
|
5
|
+
import { C as registerDiscordListener, E as resolveDiscordReplyTarget, O as sanitizeDiscordThreadName, d as resolveDiscordGatewayIntents, f as waitForDiscordGatewayPluginRegistration, m as createDiscordNativeCommand, t as monitorDiscordProvider, u as createDiscordGatewayPlugin } from "./provider-DWvDNb4J.js";
|
|
6
|
+
import { i as buildDiscordMediaPayload } from "./message-utils-D4j07taS.js";
|
|
7
|
+
import { t as createDiscordMessageHandler } from "./message-handler-CIxWq5Yh.js";
|
|
8
|
+
import "./runtime-api.monitor-DSbfGnzS.js";
|
|
9
9
|
export { DISCORD_ATTACHMENT_IDLE_TIMEOUT_MS, DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS, DISCORD_DEFAULT_INBOUND_WORKER_TIMEOUT_MS, DISCORD_DEFAULT_LISTENER_TIMEOUT_MS, allowListMatches, buildDiscordMediaPayload, clearGateways, clearPresences, createDiscordGatewayPlugin, createDiscordMessageHandler, createDiscordNativeCommand, getGateway, getPresence, isAbortError, isDiscordGroupAllowedByPolicy, mergeAbortSignals, 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
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { n as registerBuiltDiscordComponentMessage, r as sendDiscordComponentMessage, t as editDiscordComponentMessage } from "./send.components-
|
|
3
|
-
import { A as hasAllGuildPermissionsDiscord, M as hasAnyGuildPermissionDiscord, O as fetchChannelPermissionsDiscord, k as fetchMemberGuildPermissionsDiscord, w as DiscordSendError } from "./send.shared-
|
|
4
|
-
import { A as listScheduledEventsDiscord, B as moveChannelDiscord, C as fetchChannelInfoDiscord, D as fetchVoiceStatusDiscord, E as fetchRoleInfoDiscord, F as uploadEmojiDiscord, H as setChannelPermissionDiscord, I as uploadStickerDiscord, L as createChannelDiscord, M as resolveEventCoverImage, N as timeoutMemberDiscord, O as kickMemberDiscord, P as listGuildEmojisDiscord, R as deleteChannelDiscord, S as createScheduledEventDiscord, T as fetchMemberInfoDiscord, V as removeChannelPermissionDiscord, _ as readMessagesDiscord, a as removeReactionDiscord, b as addRoleDiscord, c as sendWebhookMessageDiscord, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, m as listPinsDiscord, n as fetchReactionsDiscord, o as sendTypingDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-
|
|
5
|
-
import { n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-
|
|
1
|
+
import { C as resolveDiscordOutboundSessionRoute } from "./components-BVrfRS-F.js";
|
|
2
|
+
import { n as registerBuiltDiscordComponentMessage, r as sendDiscordComponentMessage, t as editDiscordComponentMessage } from "./send.components-BaXQJKWT.js";
|
|
3
|
+
import { A as hasAllGuildPermissionsDiscord, M as hasAnyGuildPermissionDiscord, O as fetchChannelPermissionsDiscord, k as fetchMemberGuildPermissionsDiscord, w as DiscordSendError } from "./send.shared-Xz7IMVpu.js";
|
|
4
|
+
import { A as listScheduledEventsDiscord, B as moveChannelDiscord, C as fetchChannelInfoDiscord, D as fetchVoiceStatusDiscord, E as fetchRoleInfoDiscord, F as uploadEmojiDiscord, H as setChannelPermissionDiscord, I as uploadStickerDiscord, L as createChannelDiscord, M as resolveEventCoverImage, N as timeoutMemberDiscord, O as kickMemberDiscord, P as listGuildEmojisDiscord, R as deleteChannelDiscord, S as createScheduledEventDiscord, T as fetchMemberInfoDiscord, V as removeChannelPermissionDiscord, _ as readMessagesDiscord, a as removeReactionDiscord, b as addRoleDiscord, c as sendWebhookMessageDiscord, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, m as listPinsDiscord, n as fetchReactionsDiscord, o as sendTypingDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-BFpa_DHn.js";
|
|
5
|
+
import { n as sendPollDiscord, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-BlA6VzSE.js";
|
|
6
6
|
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,6 +1,6 @@
|
|
|
1
|
-
import { C as resolveThreadBindingIdleTimeoutMs, E as resolveThreadBindingMaxAgeMs, T as resolveThreadBindingMaxAgeExpiresAt, d as isRecentlyUnboundThreadWebhookMessage, w as resolveThreadBindingInactivityExpiresAt } from "./thread-bindings.state-
|
|
2
|
-
import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-
|
|
3
|
-
import { _ as formatThreadBindingDurationLabel, b as resolveThreadBindingThreadName, g as resolveThreadBindingPersonaFromRecord, h as resolveThreadBindingPersona, y as resolveThreadBindingIntroText } from "./thread-bindings.discord-api-
|
|
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-
|
|
5
|
-
import { i as testing, n as createThreadBindingManager, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-
|
|
1
|
+
import { C as resolveThreadBindingIdleTimeoutMs, E as resolveThreadBindingMaxAgeMs, T as resolveThreadBindingMaxAgeExpiresAt, d as isRecentlyUnboundThreadWebhookMessage, w as resolveThreadBindingInactivityExpiresAt } from "./thread-bindings.state-9VAxhVf6.js";
|
|
2
|
+
import { n as setThreadBindingMaxAgeBySessionKey, t as setThreadBindingIdleTimeoutBySessionKey } from "./thread-bindings.session-updates-eRcJlzIU.js";
|
|
3
|
+
import { _ as formatThreadBindingDurationLabel, b as resolveThreadBindingThreadName, g as resolveThreadBindingPersonaFromRecord, h as resolveThreadBindingPersona, y as resolveThreadBindingIntroText } from "./thread-bindings.discord-api-DJD3qwIN.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-BbzjUuNB.js";
|
|
5
|
+
import { i as testing, n as createThreadBindingManager, r as getThreadBindingManager, t as createNoopThreadBindingManager } from "./thread-bindings.manager-BIBm6bQd.js";
|
|
6
6
|
export { testing as __testing, testing, autoBindSpawnedDiscordSubagent, createNoopThreadBindingManager, createThreadBindingManager, formatThreadBindingDurationLabel, getThreadBindingManager, isRecentlyUnboundThreadWebhookMessage, listThreadBindingsBySessionKey, listThreadBindingsForAccount, reconcileAcpThreadBindingsOnStartup, resolveDiscordThreadBindingIdleTimeoutMs, resolveDiscordThreadBindingMaxAgeMs, resolveThreadBindingIdleTimeoutMs, resolveThreadBindingInactivityExpiresAt, resolveThreadBindingIntroText, resolveThreadBindingMaxAgeExpiresAt, resolveThreadBindingMaxAgeMs, resolveThreadBindingPersona, resolveThreadBindingPersonaFromRecord, resolveThreadBindingThreadName, resolveThreadBindingsEnabled, setThreadBindingIdleTimeoutBySessionKey, setThreadBindingMaxAgeBySessionKey, unbindThreadBindingsBySessionKey };
|
|
@@ -1,13 +1,15 @@
|
|
|
1
|
-
import { At as
|
|
1
|
+
import { A as readDiscordMessage, At as createGuildChannel, Bt as listGuildEmojis, Ct as listChannelPins, D as RateLimitError, Dt as unpinChannelMessage, E as DiscordError, Et as sendChannelTyping, Ft as getGuild, Gt as removeGuildMember, Ht as listGuildScheduledEvents, It as getGuildMember, Kt as removeGuildMemberRole, Lt as getGuildVoiceState, Mt as createGuildScheduledEvent, Nt as createGuildSticker, O as isUnknownDiscordVoiceStateError, Ot as addGuildMemberRole, Pt as deleteChannelPermission, Rt as listGuildActiveThreads, St as listChannelMessages, Tt as searchGuildMessages, Ut as moveGuildChannels, Vt as listGuildRoles, Wt as putChannelPermission, Xt as __exportAll, _t as editChannel, bt as getChannelMessage, dt as deleteOwnMessageReaction, ft as listMessageReactionUsers, gt as deleteChannelMessage, ht as deleteChannel, j as readRetryAfter, jt as createGuildEmoji, k as readDiscordCode, kt as createGuildBan, mt as createThread, n as createDiscordSendResult, pt as createChannelMessage, qt as timeoutGuildMember, ut as createOwnMessageReaction, vt as editChannelMessage, wt as pinChannelMessage, xt as listChannelArchivedThreads, yt as getChannel, zt as listGuildChannels } from "./send.receipt-aegk69an.js";
|
|
2
2
|
import { s as resolveDiscordAccount } from "./accounts-P19jm1lf.js";
|
|
3
|
-
import { A as hasAllGuildPermissionsDiscord, C as DISCORD_MAX_STICKER_BYTES, D as canViewDiscordGuildChannel, E as canManageGuildRoleDiscord, F as createDiscordClient, M as hasAnyGuildPermissionDiscord, O as fetchChannelPermissionsDiscord, P as parseAndResolveChannelRecipient, R as resolveDiscordClientAccountContext, S as DISCORD_MAX_EVENT_COVER_BYTES, T as canManageGuildMemberRoleDiscord, i as formatReactionEmoji, j as hasAnyChannelPermissionDiscord, k as fetchMemberGuildPermissionsDiscord, l as resolveChannelId, o as normalizeEmojiName, r as buildReactionIdentifier, s as normalizeReactionEmoji, t as buildDiscordSendError, w as DiscordSendError, x as DISCORD_MAX_EMOJI_BYTES, z as resolveDiscordRest } from "./send.shared-
|
|
4
|
-
import { n as sendPollDiscord, o as rewriteDiscordKnownMentions, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-
|
|
3
|
+
import { A as hasAllGuildPermissionsDiscord, C as DISCORD_MAX_STICKER_BYTES, D as canViewDiscordGuildChannel, E as canManageGuildRoleDiscord, F as createDiscordClient, M as hasAnyGuildPermissionDiscord, O as fetchChannelPermissionsDiscord, P as parseAndResolveChannelRecipient, R as resolveDiscordClientAccountContext, S as DISCORD_MAX_EVENT_COVER_BYTES, T as canManageGuildMemberRoleDiscord, g as createDiscordMessageNonce, i as formatReactionEmoji, j as hasAnyChannelPermissionDiscord, k as fetchMemberGuildPermissionsDiscord, l as resolveChannelId, o as normalizeEmojiName, r as buildReactionIdentifier, s as normalizeReactionEmoji, t as buildDiscordSendError, w as DiscordSendError, x as DISCORD_MAX_EMOJI_BYTES, z as resolveDiscordRest } from "./send.shared-Xz7IMVpu.js";
|
|
4
|
+
import { n as sendPollDiscord, o as rewriteDiscordKnownMentions, r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-BlA6VzSE.js";
|
|
5
|
+
import { n as DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS } from "./timeouts-ZRc9Lw4y.js";
|
|
5
6
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalLowercaseString, normalizeOptionalString, normalizeStringEntries } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
7
|
import { ChannelType } from "discord-api-types/v10";
|
|
7
8
|
import { parseStrictFiniteNumber, resolveExpiresAtMsFromDurationMs, timestampMsToIsoString } from "openclaw/plugin-sdk/number-runtime";
|
|
8
9
|
import crypto from "node:crypto";
|
|
9
10
|
import path from "node:path";
|
|
10
11
|
import { writeExternalFileWithinRoot } from "openclaw/plugin-sdk/security-runtime";
|
|
12
|
+
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
11
13
|
import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
|
|
12
14
|
import { MEDIA_FFMPEG_MAX_AUDIO_DURATION_SECS, extensionForMime, maxBytesForKind, parseFfprobeCodecAndSampleRate, runFfmpeg, runFfprobe, unlinkIfExists } from "openclaw/plugin-sdk/media-runtime";
|
|
13
15
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
@@ -223,6 +225,10 @@ function assertDiscordResponseObject(value, label) {
|
|
|
223
225
|
if (!value || typeof value !== "object" || Array.isArray(value)) throw new Error(`Unexpected Discord response for ${label}: expected object.`);
|
|
224
226
|
return value;
|
|
225
227
|
}
|
|
228
|
+
function resolveDefaultThreadAutoArchiveDuration(channel) {
|
|
229
|
+
if (!channel || !("default_auto_archive_duration" in channel)) return;
|
|
230
|
+
return channel.default_auto_archive_duration;
|
|
231
|
+
}
|
|
226
232
|
var DiscordThreadInitialMessageError = class extends Error {
|
|
227
233
|
constructor(thread, error) {
|
|
228
234
|
const initialMessageError = formatDiscordThreadInitialMessageError(error);
|
|
@@ -270,15 +276,14 @@ async function listPinsDiscord(channelId, opts) {
|
|
|
270
276
|
async function createThreadDiscord(channelId, payload, opts) {
|
|
271
277
|
const rest = resolveDiscordRest(opts);
|
|
272
278
|
const body = { name: payload.name };
|
|
273
|
-
if (payload.autoArchiveMinutes) body.auto_archive_duration = payload.autoArchiveMinutes;
|
|
274
279
|
if (!payload.messageId && payload.type !== void 0) body.type = payload.type;
|
|
275
|
-
let
|
|
280
|
+
let channel;
|
|
276
281
|
if (!payload.messageId) try {
|
|
277
|
-
|
|
278
|
-
} catch {
|
|
279
|
-
|
|
280
|
-
|
|
281
|
-
const isForumLike =
|
|
282
|
+
channel = await getChannel(rest, channelId);
|
|
283
|
+
} catch {}
|
|
284
|
+
const archiveDuration = payload.autoArchiveMinutes ?? resolveDefaultThreadAutoArchiveDuration(channel);
|
|
285
|
+
if (archiveDuration !== void 0) body.auto_archive_duration = archiveDuration;
|
|
286
|
+
const isForumLike = channel?.type === ChannelType.GuildForum || channel?.type === ChannelType.GuildMedia;
|
|
282
287
|
if (isForumLike) {
|
|
283
288
|
body.message = { content: payload.content?.trim() ? payload.content : payload.name };
|
|
284
289
|
if (payload.appliedTags?.length) body.applied_tags = payload.appliedTags;
|
|
@@ -495,7 +500,7 @@ async function generateWaveformFromPcm(filePath) {
|
|
|
495
500
|
let sum = 0;
|
|
496
501
|
let count = 0;
|
|
497
502
|
for (let j = 0; j < step && i * step + j < samples.length; j++) {
|
|
498
|
-
sum += Math.abs(samples
|
|
503
|
+
sum += Math.abs(expectDefined(samples.at(i * step + j), "bounded PCM waveform sample"));
|
|
499
504
|
count++;
|
|
500
505
|
}
|
|
501
506
|
const avg = count > 0 ? sum / count : 0;
|
|
@@ -614,6 +619,7 @@ async function requestVoiceUploadUrl(params) {
|
|
|
614
619
|
id: "0"
|
|
615
620
|
}] })
|
|
616
621
|
},
|
|
622
|
+
timeoutMs: params.rest.options.timeout,
|
|
617
623
|
policy: DISCORD_VOICE_UPLOAD_SSRF_POLICY,
|
|
618
624
|
auditContext: "discord.voice.upload-url"
|
|
619
625
|
});
|
|
@@ -632,6 +638,7 @@ async function uploadVoiceAttachment(params) {
|
|
|
632
638
|
headers: { "Content-Type": "audio/ogg" },
|
|
633
639
|
body: new Uint8Array(params.audioBuffer)
|
|
634
640
|
},
|
|
641
|
+
timeoutMs: DISCORD_ATTACHMENT_TOTAL_TIMEOUT_MS,
|
|
635
642
|
policy: DISCORD_VOICE_UPLOAD_SSRF_POLICY,
|
|
636
643
|
auditContext: "discord.voice.attachment-upload"
|
|
637
644
|
});
|
|
@@ -672,6 +679,8 @@ async function sendDiscordVoiceMessage(rest, channelId, audioBuffer, metadata, r
|
|
|
672
679
|
}, "voice-upload");
|
|
673
680
|
const messagePayload = {
|
|
674
681
|
flags: silent ? 12288 : DISCORD_VOICE_MESSAGE_FLAG,
|
|
682
|
+
nonce: createDiscordMessageNonce(),
|
|
683
|
+
enforce_nonce: true,
|
|
675
684
|
attachments: [{
|
|
676
685
|
id: "0",
|
|
677
686
|
filename,
|
|
@@ -684,7 +693,7 @@ async function sendDiscordVoiceMessage(rest, channelId, audioBuffer, metadata, r
|
|
|
684
693
|
message_id: replyTo,
|
|
685
694
|
fail_if_not_exists: false
|
|
686
695
|
};
|
|
687
|
-
return await request(() => rest.post(`/channels/${channelId}/messages`, { body: messagePayload }), "voice-message");
|
|
696
|
+
return await request(() => rest.post(`/channels/${channelId}/messages`, { body: messagePayload }), "voice-message", { safety: "nonce-protected-create" });
|
|
688
697
|
}
|
|
689
698
|
//#endregion
|
|
690
699
|
//#region extensions/discord/src/send.voice.ts
|
|
@@ -1,10 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { L as serializePayload, Xt as __exportAll, n as createDiscordSendResult, pt as createChannelMessage, vt as editChannelMessage } from "./send.receipt-aegk69an.js";
|
|
2
2
|
import { s as resolveDiscordAccount } from "./accounts-P19jm1lf.js";
|
|
3
|
-
import "./config-api-
|
|
3
|
+
import "./config-api-B18fR8M5.js";
|
|
4
4
|
import "./channel-api-CAJ0wMoV.js";
|
|
5
|
-
import { c as buildDiscordComponentMessage, f as resolveDiscordComponentAttachmentName, l as buildDiscordComponentMessageFlags } from "./components-
|
|
6
|
-
import { F as createDiscordClient, P as parseAndResolveChannelRecipient, b as stripUndefinedFields,
|
|
7
|
-
import { t as sendMessageDiscord } from "./send.outbound-
|
|
5
|
+
import { c as buildDiscordComponentMessage, f as resolveDiscordComponentAttachmentName, l as buildDiscordComponentMessageFlags } from "./components-BVrfRS-F.js";
|
|
6
|
+
import { F as createDiscordClient, P as parseAndResolveChannelRecipient, b as stripUndefinedFields, g as createDiscordMessageNonce, l as resolveChannelId, m as SUPPRESS_NOTIFICATIONS_FLAG, t as buildDiscordSendError, u as resolveDiscordChannel } from "./send.shared-Xz7IMVpu.js";
|
|
7
|
+
import { t as sendMessageDiscord } from "./send.outbound-BlA6VzSE.js";
|
|
8
8
|
import { n as getOptionalDiscordRuntime } from "./runtime-DgnVQ7zW.js";
|
|
9
9
|
import "openclaw/plugin-sdk/account-id";
|
|
10
10
|
import "openclaw/plugin-sdk/secret-input";
|
|
@@ -375,7 +375,7 @@ async function buildDiscordComponentPayload(params) {
|
|
|
375
375
|
resolvedFileName = params.opts.filename?.trim() || media.fileName || "upload";
|
|
376
376
|
spec = withImplicitComponentAttachmentBlock(spec, resolvedFileName);
|
|
377
377
|
files = [{
|
|
378
|
-
data:
|
|
378
|
+
data: media.buffer,
|
|
379
379
|
name: resolvedFileName
|
|
380
380
|
}];
|
|
381
381
|
}
|
|
@@ -435,16 +435,21 @@ async function sendDiscordComponentMessage(to, spec, opts) {
|
|
|
435
435
|
cfg
|
|
436
436
|
});
|
|
437
437
|
const { channelId } = await resolveChannelId(rest, await parseAndResolveChannelRecipient(to, cfg, opts.accountId), request);
|
|
438
|
-
const
|
|
439
|
-
if (
|
|
440
|
-
const { body, buildResult } = await buildDiscordComponentPayload({
|
|
438
|
+
const channel = await resolveDiscordChannel(rest, channelId);
|
|
439
|
+
if (channel && DISCORD_FORUM_LIKE_TYPES.has(channel.type)) throw new Error("Discord components are not supported in forum-style channels");
|
|
440
|
+
const { body: componentBody, buildResult } = await buildDiscordComponentPayload({
|
|
441
441
|
spec,
|
|
442
442
|
opts,
|
|
443
443
|
accountId: accountInfo.accountId
|
|
444
444
|
});
|
|
445
|
+
const body = {
|
|
446
|
+
...componentBody,
|
|
447
|
+
nonce: createDiscordMessageNonce(),
|
|
448
|
+
enforce_nonce: true
|
|
449
|
+
};
|
|
445
450
|
let result;
|
|
446
451
|
try {
|
|
447
|
-
result = await request(() => createChannelMessage(rest, channelId, { body }), "components");
|
|
452
|
+
result = await request(() => createChannelMessage(rest, channelId, { body }), "components", { safety: "nonce-protected-create" });
|
|
448
453
|
} catch (err) {
|
|
449
454
|
throw await buildDiscordSendError(err, {
|
|
450
455
|
channelId,
|
|
@@ -1,9 +1,10 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { mt as createThread, n as createDiscordSendResult, pt as createChannelMessage, r as createReusableDiscordReplyReference } from "./send.receipt-aegk69an.js";
|
|
2
2
|
import { s as resolveDiscordAccount } from "./accounts-P19jm1lf.js";
|
|
3
|
-
import { F as createDiscordClient, P as parseAndResolveChannelRecipient, _ as resolveDiscordMessageFlags, a as normalizeDiscordPollInput, c as normalizeStickerIds, f as sendDiscordMedia, g as buildDiscordMessageRequest, l as resolveChannelId, n as buildDiscordTextChunks, p as sendDiscordText, t as buildDiscordSendError, u as
|
|
4
|
-
import { a as resolveDiscordDirectoryUserId } from "./directory-live-
|
|
3
|
+
import { F as createDiscordClient, P as parseAndResolveChannelRecipient, _ as resolveDiscordMessageFlags, a as normalizeDiscordPollInput, c as normalizeStickerIds, f as sendDiscordMedia, g as createDiscordMessageNonce, h as buildDiscordMessageRequest, l as resolveChannelId, n as buildDiscordTextChunks, p as sendDiscordText, t as buildDiscordSendError, u as resolveDiscordChannel, v as resolveDiscordSendComponents, y as resolveDiscordSendEmbeds } from "./send.shared-Xz7IMVpu.js";
|
|
4
|
+
import { a as resolveDiscordDirectoryUserId } from "./directory-live-DZByMdPO.js";
|
|
5
5
|
import { normalizeLowercaseStringOrEmpty, normalizeOptionalString, normalizeOptionalStringifiedId } from "openclaw/plugin-sdk/string-coerce-runtime";
|
|
6
6
|
import { ChannelType } from "discord-api-types/v10";
|
|
7
|
+
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
7
8
|
import { requireRuntimeConfig } from "openclaw/plugin-sdk/plugin-config-runtime";
|
|
8
9
|
import { resolveChunkMode } from "openclaw/plugin-sdk/reply-chunking";
|
|
9
10
|
import { truncateUtf16Safe } from "openclaw/plugin-sdk/text-utility-runtime";
|
|
@@ -39,7 +40,7 @@ function formatMention(params) {
|
|
|
39
40
|
} : null
|
|
40
41
|
].filter((entry) => Boolean(entry));
|
|
41
42
|
if (values.length !== 1) throw new Error("formatMention requires exactly one of userId, roleId, or channelId");
|
|
42
|
-
const target = values
|
|
43
|
+
const target = expectDefined(values.at(0), "single Discord mention target");
|
|
43
44
|
if (target.kind === "user") return `<@${target.id}>`;
|
|
44
45
|
if (target.kind === "role") return `<@&${target.id}>`;
|
|
45
46
|
return `<#${target.id}>`;
|
|
@@ -170,8 +171,8 @@ function deriveForumThreadName(text) {
|
|
|
170
171
|
return truncateUtf16Safe(normalizeOptionalString(text.split("\n").find((line) => normalizeOptionalString(line))) ?? "", DISCORD_THREAD_NAME_LIMIT) || (/* @__PURE__ */ new Date()).toISOString().slice(0, 16);
|
|
171
172
|
}
|
|
172
173
|
/** Forum/Media channels cannot receive regular messages; detect them here. */
|
|
173
|
-
function
|
|
174
|
-
return
|
|
174
|
+
function isForumLikeChannel(channel) {
|
|
175
|
+
return channel?.type === ChannelType.GuildForum || channel?.type === ChannelType.GuildMedia;
|
|
175
176
|
}
|
|
176
177
|
function toDiscordSendResult(result, fallbackChannelId, params = {}) {
|
|
177
178
|
const resultParams = {
|
|
@@ -226,7 +227,8 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
226
227
|
cfg
|
|
227
228
|
});
|
|
228
229
|
const { channelId } = await resolveChannelId(rest, await parseAndResolveChannelRecipient(to, cfg, opts.accountId), request);
|
|
229
|
-
|
|
230
|
+
const channel = await resolveDiscordChannel(rest, channelId);
|
|
231
|
+
if (isForumLikeChannel(channel)) {
|
|
230
232
|
const threadName = deriveForumThreadName(textWithTables);
|
|
231
233
|
const chunks = buildDiscordTextChunks(textWithMentions, {
|
|
232
234
|
maxLinesPerMessage,
|
|
@@ -244,6 +246,7 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
244
246
|
isFirst: true
|
|
245
247
|
});
|
|
246
248
|
const starterBody = buildDiscordMessageRequest({
|
|
249
|
+
endpoint: "forum-thread",
|
|
247
250
|
text: starterContent,
|
|
248
251
|
components: starterComponents,
|
|
249
252
|
embeds: starterEmbeds,
|
|
@@ -257,8 +260,9 @@ async function sendMessageDiscord(to, text, opts) {
|
|
|
257
260
|
try {
|
|
258
261
|
threadRes = await request(() => createThread(rest, channelId, { body: {
|
|
259
262
|
name: threadName,
|
|
263
|
+
...channel.default_auto_archive_duration === void 0 ? {} : { auto_archive_duration: channel.default_auto_archive_duration },
|
|
260
264
|
message: starterBody
|
|
261
|
-
} }), "forum-thread");
|
|
265
|
+
} }), "forum-thread", { safety: "non-idempotent-create" });
|
|
262
266
|
} catch (err) {
|
|
263
267
|
throw await buildDiscordSendError(err, {
|
|
264
268
|
channelId,
|
|
@@ -424,11 +428,14 @@ async function sendStickerDiscord(to, stickerIds, opts) {
|
|
|
424
428
|
const { rest, request, channelId, rewrittenContent, suppressEmbeds } = await resolveDiscordStructuredSendContext(to, opts);
|
|
425
429
|
const stickers = normalizeStickerIds(stickerIds);
|
|
426
430
|
const flags = resolveDiscordMessageFlags({ suppressEmbeds });
|
|
427
|
-
|
|
431
|
+
const body = {
|
|
428
432
|
content: rewrittenContent || void 0,
|
|
429
433
|
sticker_ids: stickers,
|
|
434
|
+
nonce: createDiscordMessageNonce(),
|
|
435
|
+
enforce_nonce: true,
|
|
430
436
|
...flags ? { flags } : {}
|
|
431
|
-
}
|
|
437
|
+
};
|
|
438
|
+
return toDiscordSendResult(await request(() => createChannelMessage(rest, channelId, { body }), "sticker", { safety: "nonce-protected-create" }), channelId, { kind: "card" });
|
|
432
439
|
}
|
|
433
440
|
async function sendPollDiscord(to, poll, opts) {
|
|
434
441
|
const { rest, request, channelId, rewrittenContent, suppressEmbeds } = await resolveDiscordStructuredSendContext(to, opts);
|
|
@@ -438,11 +445,14 @@ async function sendPollDiscord(to, poll, opts) {
|
|
|
438
445
|
silent: opts.silent,
|
|
439
446
|
suppressEmbeds
|
|
440
447
|
});
|
|
441
|
-
|
|
448
|
+
const body = {
|
|
442
449
|
content: rewrittenContent || void 0,
|
|
443
450
|
poll: payload,
|
|
451
|
+
nonce: createDiscordMessageNonce(),
|
|
452
|
+
enforce_nonce: true,
|
|
444
453
|
...flags ? { flags } : {}
|
|
445
|
-
}
|
|
454
|
+
};
|
|
455
|
+
return toDiscordSendResult(await request(() => createChannelMessage(rest, channelId, { body }), "poll", { safety: "nonce-protected-create" }), channelId, { kind: "card" });
|
|
446
456
|
}
|
|
447
457
|
async function resolveDiscordStructuredSendContext(to, opts) {
|
|
448
458
|
const accountInfo = resolveDiscordAccount({
|
|
@@ -3,10 +3,11 @@ import "node:module";
|
|
|
3
3
|
import { buildMessagingTarget, parseMentionPrefixOrAtUserTarget, requireTargetKind } from "openclaw/plugin-sdk/channel-targets";
|
|
4
4
|
import { ApplicationCommandOptionType, ApplicationCommandType, ButtonStyle, ComponentType, GatewayDispatchEvents, InteractionContextType, InteractionResponseType, InteractionType, MessageFlags, Routes, TextInputStyle } from "discord-api-types/v10";
|
|
5
5
|
import { asDateTimestampMs, clampTimerTimeoutMs, parseFiniteNumber, parseStrictNonNegativeInteger, resolveExpiresAtMsFromDurationMs, resolveIntegerOption, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
|
|
6
|
-
import { createHash
|
|
6
|
+
import { createHash } from "node:crypto";
|
|
7
7
|
import path from "node:path";
|
|
8
8
|
import { KeyedAsyncQueue } from "openclaw/plugin-sdk/keyed-async-queue";
|
|
9
9
|
import { privateFileStore } from "openclaw/plugin-sdk/security-runtime";
|
|
10
|
+
import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
|
|
10
11
|
import { Type } from "typebox";
|
|
11
12
|
import { Check } from "typebox/value";
|
|
12
13
|
import { inspect } from "node:util";
|
|
@@ -180,9 +181,6 @@ async function createInteractionCallback(rest, interactionId, token, body) {
|
|
|
180
181
|
async function editWebhookMessage(rest, applicationId, token, messageId, data, query) {
|
|
181
182
|
return query ? await rest.patch(Routes.webhookMessage(applicationId, token, messageId), data, query) : await rest.patch(Routes.webhookMessage(applicationId, token, messageId), data);
|
|
182
183
|
}
|
|
183
|
-
async function deleteWebhookMessage(rest, applicationId, token, messageId) {
|
|
184
|
-
return await rest.delete(Routes.webhookMessage(applicationId, token, messageId));
|
|
185
|
-
}
|
|
186
184
|
async function getWebhookMessage(rest, applicationId, token, messageId) {
|
|
187
185
|
return await rest.get(Routes.webhookMessage(applicationId, token, messageId));
|
|
188
186
|
}
|
|
@@ -266,6 +264,7 @@ async function createChannelWebhook(rest, channelId, data) {
|
|
|
266
264
|
}
|
|
267
265
|
//#endregion
|
|
268
266
|
//#region extensions/discord/src/internal/command-deploy.ts
|
|
267
|
+
const DISCORD_APPLICATION_COMMAND_LIMIT_REACHED = 30032;
|
|
269
268
|
/**
|
|
270
269
|
* Per-`command-deploy-cache.json` path async mutex. `server-channels.ts` can
|
|
271
270
|
* start several Discord deployers concurrently in the same Node.js process;
|
|
@@ -340,16 +339,24 @@ var DiscordCommandDeployer = class {
|
|
|
340
339
|
async reconcileGlobalCommands(desired) {
|
|
341
340
|
const existing = await this.getCommands();
|
|
342
341
|
const existingByKey = new Map(existing.map((command) => [stableCommandKey(command), command]));
|
|
343
|
-
const
|
|
344
|
-
|
|
345
|
-
|
|
346
|
-
|
|
342
|
+
const desiredCommands = desired.map((command) => ({
|
|
343
|
+
command,
|
|
344
|
+
key: stableCommandKey(command)
|
|
345
|
+
}));
|
|
346
|
+
const desiredKeys = new Set(desiredCommands.map(({ key }) => key));
|
|
347
|
+
for (const { command, key } of desiredCommands) {
|
|
347
348
|
const current = existingByKey.get(key);
|
|
348
|
-
if (!current)
|
|
349
|
+
if (current && !commandsEqual(current, command)) await editApplicationCommand(this.rest, this.params.clientId, current.id, command);
|
|
350
|
+
}
|
|
351
|
+
for (const { command, key } of desiredCommands) {
|
|
352
|
+
if (existingByKey.has(key)) continue;
|
|
353
|
+
try {
|
|
349
354
|
await createApplicationCommand(this.rest, this.params.clientId, command);
|
|
350
|
-
|
|
355
|
+
} catch (error) {
|
|
356
|
+
if (!isApplicationCommandLimitError(error)) throw error;
|
|
357
|
+
await overwriteApplicationCommands(this.rest, this.params.clientId, desired);
|
|
358
|
+
return;
|
|
351
359
|
}
|
|
352
|
-
if (!commandsEqual(current, command)) await editApplicationCommand(this.rest, this.params.clientId, current.id, command);
|
|
353
360
|
}
|
|
354
361
|
for (const command of existing) if (!desiredKeys.has(stableCommandKey(command))) await deleteApplicationCommand(this.rest, this.params.clientId, command.id);
|
|
355
362
|
}
|
|
@@ -418,6 +425,9 @@ function groupGuildCommands(commands) {
|
|
|
418
425
|
function stableCommandKey(command) {
|
|
419
426
|
return `${command.type ?? ApplicationCommandType.ChatInput}:${command.name}`;
|
|
420
427
|
}
|
|
428
|
+
function isApplicationCommandLimitError(error) {
|
|
429
|
+
return error !== null && typeof error === "object" && "discordCode" in error && error.discordCode === DISCORD_APPLICATION_COMMAND_LIMIT_REACHED;
|
|
430
|
+
}
|
|
421
431
|
function comparableCommand(value) {
|
|
422
432
|
if (!value || typeof value !== "object") return value;
|
|
423
433
|
const omit = /* @__PURE__ */ new Set([
|
|
@@ -501,9 +511,11 @@ function stableCommandSetHash(commands) {
|
|
|
501
511
|
//#endregion
|
|
502
512
|
//#region extensions/discord/src/internal/components.base.ts
|
|
503
513
|
function parseCustomId(id) {
|
|
504
|
-
const [
|
|
514
|
+
const [rawKeyValue, ...parts] = id.split(";");
|
|
515
|
+
const rawKey = expectDefined(rawKeyValue, "custom id split first segment");
|
|
505
516
|
const [keyPart, firstValue] = rawKey.split("=");
|
|
506
|
-
const
|
|
517
|
+
const definedKeyPart = expectDefined(keyPart, "custom id key segment");
|
|
518
|
+
const key = definedKeyPart.includes(":") ? expectDefined(definedKeyPart.split(":").at(0), "namespaced custom id key") : definedKeyPart;
|
|
507
519
|
const data = {};
|
|
508
520
|
const entries = firstValue === void 0 ? parts : [rawKey.slice(key.length + 1), ...parts];
|
|
509
521
|
for (const entry of entries) {
|
|
@@ -522,7 +534,7 @@ function clean$3(value) {
|
|
|
522
534
|
return Object.fromEntries(Object.entries(value).filter(([, entry]) => entry !== void 0));
|
|
523
535
|
}
|
|
524
536
|
function colorToNumber(value) {
|
|
525
|
-
if (typeof value === "number") return value;
|
|
537
|
+
if (typeof value === "number") return Number.isInteger(value) && value >= 0 && value <= 16777215 ? value : void 0;
|
|
526
538
|
if (typeof value === "string" && /^#?[0-9a-f]{6}$/i.test(value)) return Number.parseInt(value.replace(/^#/, ""), 16);
|
|
527
539
|
}
|
|
528
540
|
var BaseComponent = class {
|
|
@@ -2425,39 +2437,6 @@ function decodeResponseBody(buffer) {
|
|
|
2425
2437
|
function isZlibMaxOutputLengthError(err) {
|
|
2426
2438
|
return err instanceof RangeError && "code" in err && err.code === "ERR_BUFFER_TOO_LARGE";
|
|
2427
2439
|
}
|
|
2428
|
-
function escapeMultipartQuotedValue(value) {
|
|
2429
|
-
return value.replace(/["\r\n]/g, (ch) => ch === "\"" ? "%22" : ch === "\r" ? "%0D" : "%0A");
|
|
2430
|
-
}
|
|
2431
|
-
async function formDataToMultipartBody(body, headers) {
|
|
2432
|
-
const boundary = `----openclaw-discord-${randomBytes(12).toString("hex")}`;
|
|
2433
|
-
headers.set("Content-Type", `multipart/form-data; boundary=${boundary}`);
|
|
2434
|
-
const chunks = [];
|
|
2435
|
-
const push = (value) => {
|
|
2436
|
-
chunks.push(typeof value === "string" ? Buffer.from(value) : value);
|
|
2437
|
-
};
|
|
2438
|
-
for (const [key, value] of body.entries()) {
|
|
2439
|
-
push(`--${boundary}\r\n`);
|
|
2440
|
-
const escapedKey = escapeMultipartQuotedValue(key);
|
|
2441
|
-
if (typeof value === "string") {
|
|
2442
|
-
push(`Content-Disposition: form-data; name="${escapedKey}"\r\n\r\n`);
|
|
2443
|
-
push(value);
|
|
2444
|
-
push("\r\n");
|
|
2445
|
-
continue;
|
|
2446
|
-
}
|
|
2447
|
-
const filename = value.name;
|
|
2448
|
-
push(`Content-Disposition: form-data; name="${escapedKey}"; filename="${escapeMultipartQuotedValue(typeof filename === "string" && filename.length > 0 ? filename : "blob")}"\r\n`);
|
|
2449
|
-
if (value.type) push(`Content-Type: ${value.type}\r\n`);
|
|
2450
|
-
push("\r\n");
|
|
2451
|
-
push(Buffer.from(await value.arrayBuffer()));
|
|
2452
|
-
push("\r\n");
|
|
2453
|
-
}
|
|
2454
|
-
push(`--${boundary}--\r\n`);
|
|
2455
|
-
return Buffer.concat(chunks);
|
|
2456
|
-
}
|
|
2457
|
-
async function normalizeFetchBody(body, headers) {
|
|
2458
|
-
if (body instanceof FormData) return await formDataToMultipartBody(body, headers);
|
|
2459
|
-
return body;
|
|
2460
|
-
}
|
|
2461
2440
|
var RequestClient = class {
|
|
2462
2441
|
constructor(token, options) {
|
|
2463
2442
|
this.requestControllers = /* @__PURE__ */ new Set();
|
|
@@ -2525,7 +2504,7 @@ var RequestClient = class {
|
|
|
2525
2504
|
const response = await (this.customFetch ?? fetch)(url, {
|
|
2526
2505
|
method,
|
|
2527
2506
|
headers,
|
|
2528
|
-
body
|
|
2507
|
+
body,
|
|
2529
2508
|
signal
|
|
2530
2509
|
});
|
|
2531
2510
|
const parsed = coerceResponseBody(await readResponseBodyText(response, this.options.timeout ?? 15e3));
|
|
@@ -2797,59 +2776,67 @@ var ResumedListener = class extends BaseListener {
|
|
|
2797
2776
|
this.type = GatewayDispatchEvents.Resumed;
|
|
2798
2777
|
}
|
|
2799
2778
|
};
|
|
2800
|
-
var
|
|
2779
|
+
var GuildCreateListener = class extends BaseListener {
|
|
2801
2780
|
constructor(..._args3) {
|
|
2802
2781
|
super(..._args3);
|
|
2803
|
-
this.type = GatewayDispatchEvents.
|
|
2782
|
+
this.type = GatewayDispatchEvents.GuildCreate;
|
|
2804
2783
|
}
|
|
2805
2784
|
};
|
|
2806
|
-
var
|
|
2785
|
+
var GuildDeleteListener = class extends BaseListener {
|
|
2807
2786
|
constructor(..._args4) {
|
|
2808
2787
|
super(..._args4);
|
|
2809
|
-
this.type = GatewayDispatchEvents.
|
|
2788
|
+
this.type = GatewayDispatchEvents.GuildDelete;
|
|
2810
2789
|
}
|
|
2811
2790
|
};
|
|
2812
|
-
var
|
|
2791
|
+
var MessageCreateListener = class extends BaseListener {
|
|
2813
2792
|
constructor(..._args5) {
|
|
2814
2793
|
super(..._args5);
|
|
2815
|
-
this.type = GatewayDispatchEvents.
|
|
2794
|
+
this.type = GatewayDispatchEvents.MessageCreate;
|
|
2816
2795
|
}
|
|
2817
2796
|
};
|
|
2818
|
-
var
|
|
2797
|
+
var InteractionCreateListener = class extends BaseListener {
|
|
2819
2798
|
constructor(..._args6) {
|
|
2820
2799
|
super(..._args6);
|
|
2821
|
-
this.type = GatewayDispatchEvents.
|
|
2800
|
+
this.type = GatewayDispatchEvents.InteractionCreate;
|
|
2822
2801
|
}
|
|
2823
2802
|
};
|
|
2824
|
-
var
|
|
2803
|
+
var MessageReactionAddListener = class extends BaseListener {
|
|
2825
2804
|
constructor(..._args7) {
|
|
2826
2805
|
super(..._args7);
|
|
2827
|
-
this.type = GatewayDispatchEvents.
|
|
2806
|
+
this.type = GatewayDispatchEvents.MessageReactionAdd;
|
|
2828
2807
|
}
|
|
2829
2808
|
};
|
|
2830
|
-
var
|
|
2809
|
+
var MessageReactionRemoveListener = class extends BaseListener {
|
|
2831
2810
|
constructor(..._args8) {
|
|
2832
2811
|
super(..._args8);
|
|
2833
|
-
this.type = GatewayDispatchEvents.
|
|
2812
|
+
this.type = GatewayDispatchEvents.MessageReactionRemove;
|
|
2834
2813
|
}
|
|
2835
2814
|
};
|
|
2836
|
-
var
|
|
2815
|
+
var PresenceUpdateListener = class extends BaseListener {
|
|
2837
2816
|
constructor(..._args9) {
|
|
2838
2817
|
super(..._args9);
|
|
2818
|
+
this.type = GatewayDispatchEvents.PresenceUpdate;
|
|
2819
|
+
}
|
|
2820
|
+
};
|
|
2821
|
+
var VoiceStateUpdateListener = class extends BaseListener {
|
|
2822
|
+
constructor(..._args10) {
|
|
2823
|
+
super(..._args10);
|
|
2824
|
+
this.type = GatewayDispatchEvents.VoiceStateUpdate;
|
|
2825
|
+
}
|
|
2826
|
+
};
|
|
2827
|
+
var ThreadUpdateListener = class extends BaseListener {
|
|
2828
|
+
constructor(..._args11) {
|
|
2829
|
+
super(..._args11);
|
|
2839
2830
|
this.type = GatewayDispatchEvents.ThreadUpdate;
|
|
2840
2831
|
}
|
|
2841
2832
|
};
|
|
2842
2833
|
//#endregion
|
|
2843
2834
|
//#region extensions/discord/src/internal/discord.ts
|
|
2844
2835
|
var discord_exports = /* @__PURE__ */ __exportAll({
|
|
2845
|
-
AnySelectMenu: () => AnySelectMenu,
|
|
2846
2836
|
AutocompleteInteraction: () => AutocompleteInteraction,
|
|
2847
2837
|
BaseCommand: () => BaseCommand,
|
|
2848
|
-
BaseComponent: () => BaseComponent,
|
|
2849
2838
|
BaseComponentInteraction: () => BaseComponentInteraction,
|
|
2850
|
-
BaseInteraction: () => BaseInteraction,
|
|
2851
2839
|
BaseMessageInteractiveComponent: () => BaseMessageInteractiveComponent,
|
|
2852
|
-
BaseModalComponent: () => BaseModalComponent,
|
|
2853
2840
|
Button: () => Button,
|
|
2854
2841
|
ButtonInteraction: () => ButtonInteraction,
|
|
2855
2842
|
ChannelSelectMenu: () => ChannelSelectMenu,
|
|
@@ -2865,6 +2852,8 @@ var discord_exports = /* @__PURE__ */ __exportAll({
|
|
|
2865
2852
|
Embed: () => Embed,
|
|
2866
2853
|
File: () => File,
|
|
2867
2854
|
Guild: () => Guild,
|
|
2855
|
+
GuildCreateListener: () => GuildCreateListener,
|
|
2856
|
+
GuildDeleteListener: () => GuildDeleteListener,
|
|
2868
2857
|
GuildMember: () => GuildMember,
|
|
2869
2858
|
InteractionCreateListener: () => InteractionCreateListener,
|
|
2870
2859
|
Label: () => Label,
|
|
@@ -2877,9 +2866,7 @@ var discord_exports = /* @__PURE__ */ __exportAll({
|
|
|
2877
2866
|
MessageReactionAddListener: () => MessageReactionAddListener,
|
|
2878
2867
|
MessageReactionRemoveListener: () => MessageReactionRemoveListener,
|
|
2879
2868
|
Modal: () => Modal,
|
|
2880
|
-
ModalFields: () => ModalFields,
|
|
2881
2869
|
ModalInteraction: () => ModalInteraction,
|
|
2882
|
-
OptionsHandler: () => OptionsHandler,
|
|
2883
2870
|
Plugin: () => Plugin,
|
|
2884
2871
|
PresenceUpdateListener: () => PresenceUpdateListener,
|
|
2885
2872
|
RadioGroup: () => RadioGroup,
|
|
@@ -2905,8 +2892,6 @@ var discord_exports = /* @__PURE__ */ __exportAll({
|
|
|
2905
2892
|
VoiceStateUpdateListener: () => VoiceStateUpdateListener,
|
|
2906
2893
|
addGuildMemberRole: () => addGuildMemberRole,
|
|
2907
2894
|
channelFactory: () => channelFactory,
|
|
2908
|
-
clean: () => clean$3,
|
|
2909
|
-
colorToNumber: () => colorToNumber,
|
|
2910
2895
|
createApplicationCommand: () => createApplicationCommand,
|
|
2911
2896
|
createChannelMessage: () => createChannelMessage,
|
|
2912
2897
|
createChannelWebhook: () => createChannelWebhook,
|
|
@@ -2927,7 +2912,6 @@ var discord_exports = /* @__PURE__ */ __exportAll({
|
|
|
2927
2912
|
deleteChannelMessage: () => deleteChannelMessage,
|
|
2928
2913
|
deleteChannelPermission: () => deleteChannelPermission,
|
|
2929
2914
|
deleteOwnMessageReaction: () => deleteOwnMessageReaction,
|
|
2930
|
-
deleteWebhookMessage: () => deleteWebhookMessage,
|
|
2931
2915
|
editApplicationCommand: () => editApplicationCommand,
|
|
2932
2916
|
editChannel: () => editChannel,
|
|
2933
2917
|
editChannelMessage: () => editChannelMessage,
|
|
@@ -3019,7 +3003,7 @@ function clampToCodePointBoundary(text, index) {
|
|
|
3019
3003
|
return boundary;
|
|
3020
3004
|
}
|
|
3021
3005
|
function findWhitespaceBreak(window) {
|
|
3022
|
-
for (let i = window.length - 1; i >= 0; i--) if (/\s/.test(window
|
|
3006
|
+
for (let i = window.length - 1; i >= 0; i--) if (/\s/.test(window.charAt(i))) return i;
|
|
3023
3007
|
return -1;
|
|
3024
3008
|
}
|
|
3025
3009
|
function findCjkPunctuationBreak(window) {
|
|
@@ -3107,7 +3091,7 @@ function chunkDiscordText(text, opts = {}) {
|
|
|
3107
3091
|
current += addition;
|
|
3108
3092
|
if (!isLineContinuation) currentLines += 1;
|
|
3109
3093
|
} else {
|
|
3110
|
-
current = segment;
|
|
3094
|
+
current = expectDefined(segment, "current Discord chunk segment");
|
|
3111
3095
|
currentLines = 1;
|
|
3112
3096
|
}
|
|
3113
3097
|
}
|
|
@@ -3139,10 +3123,10 @@ function rebalanceReasoningItalics(source, chunks) {
|
|
|
3139
3123
|
const adjusted = [...chunks];
|
|
3140
3124
|
for (let i = 0; i < adjusted.length; i++) {
|
|
3141
3125
|
const isLast = i === adjusted.length - 1;
|
|
3142
|
-
const current = adjusted[i];
|
|
3126
|
+
const current = expectDefined(adjusted[i], "Discord chunk adjustment index");
|
|
3143
3127
|
if (!current.trimEnd().endsWith("_")) adjusted[i] = `${current}_`;
|
|
3144
3128
|
if (isLast) break;
|
|
3145
|
-
const next = adjusted[i + 1];
|
|
3129
|
+
const next = expectDefined(adjusted[i + 1], "non-final Discord chunk successor");
|
|
3146
3130
|
const leadingWhitespaceLen = next.length - next.trimStart().length;
|
|
3147
3131
|
const leadingWhitespace = next.slice(0, leadingWhitespaceLen);
|
|
3148
3132
|
const nextBody = next.slice(leadingWhitespaceLen);
|
|
@@ -3272,4 +3256,4 @@ function createDiscordSendResult(params) {
|
|
|
3272
3256
|
};
|
|
3273
3257
|
}
|
|
3274
3258
|
//#endregion
|
|
3275
|
-
export {
|
|
3259
|
+
export { Section as $, readDiscordMessage as A, createGuildChannel as At, Label as B, listGuildEmojis as Bt, Client as C, listChannelPins as Ct, RateLimitError as D, unpinChannelMessage as Dt, DiscordError as E, sendChannelTyping as Et, Message as F, getGuild as Ft, ChannelSelectMenu as G, removeGuildMember as Gt, RadioGroup as H, listGuildScheduledEvents as Ht, User as I, getGuildMember as It, LinkButton as J, parseDiscordTarget as Jt, Container as K, removeGuildMemberRole as Kt, serializePayload as L, getGuildVoiceState as Lt, Command as M, createGuildScheduledEvent as Mt, CommandWithSubcommands as N, createGuildSticker as Nt, isUnknownDiscordVoiceStateError as O, addGuildMemberRole as Ot, Guild as P, deleteChannelPermission as Pt, Row as Q, Embed as R, listGuildActiveThreads as Rt, VoiceStateUpdateListener as S, listChannelMessages as St, RequestClient as T, searchGuildMessages as Tt, TextInput as U, moveGuildChannels as Ut, Modal as V, listGuildRoles as Vt, Button as W, putChannelPermission as Wt, MentionableSelectMenu as X, __exportAll as Xt, MediaGallery as Y, resolveDiscordChannelId as Yt, RoleSelectMenu as Z, MessageReactionRemoveListener as _, editChannel as _t, resolveDiscordReplyReference as a, BaseMessageInteractiveComponent as at, ResumedListener as b, getChannelMessage as bt, normalizeDiscordMessagingTarget as c, createUserDmChannel as ct, discord_exports as d, deleteOwnMessageReaction as dt, Separator as et, GuildCreateListener as f, listMessageReactionUsers as ft, MessageReactionAddListener as g, deleteChannelMessage as gt, MessageCreateListener as h, deleteChannel as ht, resolveDiscordReplyMessageId as i, UserSelectMenu as it, readRetryAfter as j, createGuildEmoji as jt, readDiscordCode as k, createGuildBan as kt, normalizeDiscordOutboundTarget as l, getCurrentUser as lt, InteractionCreateListener as m, createThread as mt, createDiscordSendResult as n, TextDisplay as nt, allowFromContainsDiscordUserId as o, parseCustomId as ot, GuildDeleteListener as p, createChannelMessage as pt, File as q, timeoutGuildMember as qt, createReusableDiscordReplyReference as r, Thumbnail as rt, looksLikeDiscordTargetId as s, createChannelWebhook as st, createDiscordSendReceipt as t, StringSelectMenu as tt, chunkDiscordTextWithMode as u, createOwnMessageReaction as ut, PresenceUpdateListener as v, editChannelMessage as vt, Plugin as w, pinChannelMessage as wt, ThreadUpdateListener as x, listChannelArchivedThreads as xt, ReadyListener as y, getChannel as yt, CheckboxGroup as z, listGuildChannels as zt };
|