@openclaw/discord 2026.9.6 → 2026.9.7

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.
Files changed (150) hide show
  1. package/assets/icon.png +0 -0
  2. package/dist/.setup/{account-inspect-BwQj24ht.mjs → account-inspect-De8hOUxG.mjs} +1 -1
  3. package/dist/.setup/{accounts-CwJQoLjM.mjs → accounts-ChaMcixG.mjs} +1 -4
  4. package/dist/.setup/{activities-api-COU4-0nR.mjs → activities-api-tvbsU2e3.mjs} +38 -66
  5. package/dist/.setup/{api-CBK9zcq5.mjs → api-DVbJwZVt.mjs} +10 -2
  6. package/dist/.setup/{approval-handler.runtime-CbBktBb4.mjs → approval-handler.runtime-DxCK2Rux.mjs} +49 -125
  7. package/dist/.setup/{approval-message-updates-jf9zMaIC.mjs → approval-message-updates-BKFqavHZ.mjs} +2 -2
  8. package/dist/.setup/{audit-vKbh-LFR.mjs → audit-CLg9I71N.mjs} +5 -5
  9. package/dist/.setup/{channel-Dv4e3Jpc.mjs → channel-DxlUVU9t.mjs} +121 -227
  10. package/dist/.setup/{channel-type-DKnjV1XW.mjs → channel-type-DRCrEMss.mjs} +22 -22
  11. package/dist/.setup/{channel.setup-0NX6FFwi.mjs → channel.setup-CRo1GjV7.mjs} +6 -9
  12. package/dist/.setup/{components-yBEb75bB.mjs → components-Cq1PvIpN.mjs} +41 -69
  13. package/dist/.setup/{config-schema-CiZz-mtA.mjs → config-schema-oxELUSDx.mjs} +19 -44
  14. package/dist/.setup/{conversation-binding-route-B7qImK_b.mjs → conversation-binding-route-Caz_XuFH.mjs} +10 -5
  15. package/dist/.setup/{directory-config-BytTftz-.mjs → directory-config-esqNn0Eo.mjs} +6 -9
  16. package/dist/.setup/{directory-live--EGTH0DC.mjs → directory-live-DtKRHuGV.mjs} +6 -12
  17. package/dist/.setup/{discord-BXpHW-cu.mjs → discord-0xJYfdDD.mjs} +82 -386
  18. package/dist/.setup/{doctor-D1R-uFIu.mjs → doctor-BCl1H5tl.mjs} +21 -36
  19. package/dist/.setup/{doctor-contract-Co5vRCZ6.mjs → doctor-contract-CvvgwrrG.mjs} +41 -50
  20. package/dist/.setup/{channel-actions.runtime-leZuw01r.mjs → handle-action-CUvQWnE7.mjs} +67 -104
  21. package/dist/.setup/{handle-action.guild-admin-DcFa8NwA.mjs → handle-action.guild-admin-Df-8gVle.mjs} +62 -120
  22. package/dist/.setup/{live-policy-config-eKQ-PLdy.mjs → live-policy-config-8Pv20CHc.mjs} +2 -3
  23. package/dist/.setup/{message-handler-X6ejmbtY.mjs → message-handler-B-Jk4oDk.mjs} +18 -94
  24. package/dist/.setup/{message-handler.preflight-pluralkit-8Xji34AF.mjs → message-handler.preflight-pluralkit-CWLUBVcx.mjs} +8 -10
  25. package/dist/.setup/{message-handler.preflight-DE_POxFc.mjs → message-handler.preflight-v-__NSDq.mjs} +69 -180
  26. package/dist/.setup/{message-handler.process-CCmIVnxy.mjs → message-handler.process-BNFFuChn.mjs} +65 -86
  27. package/dist/.setup/{outbound-adapter-ClIgmu4F.mjs → outbound-adapter-BobT-kse.mjs} +105 -19
  28. package/dist/.setup/{outbound-session-route-VulUE0yV.mjs → outbound-session-route-zVGxxceg.mjs} +140 -108
  29. package/dist/.setup/{pluralkit-CdAt1G0P.mjs → pluralkit-a6_NLfH9.mjs} +1 -1
  30. package/dist/.setup/{presence-cache-dYSHPWMx.mjs → presence-cache-Di3H3DIU.mjs} +0 -4
  31. package/dist/.setup/{probe-CupW4we4.mjs → probe-LYrIHlBF.mjs} +13 -4
  32. package/dist/.setup/{provider-iOf73HW-.mjs → provider-B_G5hASF.mjs} +721 -1416
  33. package/dist/.setup/provider-session.runtime-BYlTBFD2.mjs +6 -0
  34. package/dist/.setup/provider.runtime-CUE3UxER.mjs +2 -0
  35. package/dist/.setup/{realtime-session.runtime-Dz8uVutq.mjs → realtime-session.runtime-oUd9DOcz.mjs} +41 -55
  36. package/dist/.setup/{receive-recovery-DHst8WRx.mjs → receive-recovery-CHPOsnLc.mjs} +1 -4
  37. package/dist/.setup/{resolve-allowlist-common-CwMBzbx9.mjs → resolve-allowlist-common-DPdRggu5.mjs} +4 -7
  38. package/dist/.setup/{resolve-channels-BbvsLQOZ.mjs → resolve-channels-BFPNRmVv.mjs} +21 -40
  39. package/dist/.setup/{resolve-users-ByFlR7LQ.mjs → resolve-users-0-aBuCy3.mjs} +4 -4
  40. package/dist/.setup/{retry-BEYkDy0P.mjs → retry-pz_cSha2.mjs} +3 -3
  41. package/dist/.setup/rolldown-runtime-B4FMCO8f.mjs +28 -0
  42. package/dist/.setup/{runtime-B8lJfyrA.mjs → runtime-FN000lxA.mjs} +60 -162
  43. package/dist/.setup/runtime-doctor-migrations-CshUGl36.mjs +159 -0
  44. package/dist/.setup/{runtime-DisDbixd.mjs → runtime-sUksZ--Q.mjs} +2 -5
  45. package/dist/.setup/{secret-config-contract-DFu9hfU8.mjs → secret-config-contract-uOE2J7yM.mjs} +15 -85
  46. package/dist/.setup/{security-audit-s5w50-Ly.mjs → security-audit-Cdaegq7C.mjs} +3 -1
  47. package/dist/.setup/{send-CIBzvXjS.mjs → send-CrfEI6Bs.mjs} +53 -108
  48. package/dist/.setup/{send.components-ChY21qr-.mjs → send.components-DxQAMfES.mjs} +62 -107
  49. package/dist/.setup/{send.outbound-QTyuFupn.mjs → send.outbound-BISKnb-a.mjs} +66 -140
  50. package/dist/.setup/{send.shared-VNvWfX2T.mjs → send.shared-DGFkbkQR.mjs} +10 -25
  51. package/dist/.setup/{sender-identity-0Ymgvmaj.mjs → sender-identity-B9X5Vb9R.mjs} +2 -3
  52. package/dist/.setup/setup-plugin-api-BQUBxbhe.mjs +3 -0
  53. package/dist/.setup/{shared-DHPDaMSx.mjs → shared-B3wZ4hN-.mjs} +25 -32
  54. package/dist/.setup/{subagent-hooks-CjW7r8Pe.mjs → subagent-hooks-nlUE9ow7.mjs} +5 -6
  55. package/dist/.setup/system-events-CdeZnvPV.mjs +33 -0
  56. package/dist/.setup/{target-resolver-BXpy6VT8.mjs → target-resolver-BuLapkhy.mjs} +9 -12
  57. package/dist/.setup/targets-0KUcEIYx.mjs +3 -0
  58. package/dist/.setup/{thread-bindings-CEh2dhqP.mjs → thread-bindings-D7TfgjR_.mjs} +33 -35
  59. package/dist/.setup/{thread-bindings.manager-ve-i6oqt.mjs → thread-bindings.manager-DN-NissX.mjs} +325 -233
  60. package/dist/.setup/thread-bindings.session-updates-CshfKghV.mjs +359 -0
  61. package/dist/.setup/{thread-bindings.state-BThFQEga.mjs → thread-bindings.state-g6v9zAym.mjs} +21 -62
  62. package/dist/.setup/{transcripts-source-DVegW0WI.mjs → transcripts-source-p8EV179h.mjs} +76 -235
  63. package/dist/.setup/{typing-BKZL5fGj.mjs → typing-BiHCzBRu.mjs} +2 -1
  64. package/dist/.setup/{voice-runtime-elTtjEIG.mjs → voice-runtime-B46rcwrG.mjs} +140 -244
  65. package/dist/account-inspect-api.js +1 -1
  66. package/dist/action-runtime-api.js +1 -1
  67. package/dist/activities-api.js +1 -1
  68. package/dist/api.js +18 -18
  69. package/dist/channel-config-api.js +1 -1
  70. package/dist/channel-plugin-api.js +1 -1
  71. package/dist/directory-contract-api.js +1 -1
  72. package/dist/doctor-contract-api.js +4 -4
  73. package/dist/index.js +1 -1
  74. package/dist/runtime-api.js +20 -20
  75. package/dist/secret-contract-api.js +1 -1
  76. package/dist/security-audit-contract-api.js +1 -1
  77. package/dist/setup-entry.js +1 -1
  78. package/dist/setup-plugin-api.js +1 -1
  79. package/dist/src/voice/audio-worker.runtime.js +15 -24
  80. package/dist/subagent-hooks-api.js +3 -4
  81. package/dist/transcripts-source-api.js +1 -1
  82. package/node_modules/@types/node/README.md +2 -2
  83. package/node_modules/@types/node/child_process.d.ts +1 -1
  84. package/node_modules/@types/node/crypto.d.ts +20 -8
  85. package/node_modules/@types/node/ffi.d.ts +14 -0
  86. package/node_modules/@types/node/http2.d.ts +3 -2
  87. package/node_modules/@types/node/net.d.ts +16 -4
  88. package/node_modules/@types/node/package.json +2 -17
  89. package/node_modules/@types/node/process.d.ts +1 -0
  90. package/node_modules/@types/node/quic.d.ts +39 -1
  91. package/node_modules/@types/node/stream/iter.d.ts +9 -12
  92. package/node_modules/@types/node/test/reporters.d.ts +1 -0
  93. package/node_modules/@types/node/test.d.ts +72 -0
  94. package/node_modules/@types/node/tls.d.ts +14 -10
  95. package/node_modules/@types/node/vm.d.ts +2 -1
  96. package/node_modules/@types/node/worker_threads.d.ts +4 -1
  97. package/node_modules/typebox/build/compile/code.mjs +1 -2
  98. package/node_modules/typebox/build/compile/validator.mjs +5 -1
  99. package/node_modules/typebox/build/format/iri.mjs +16 -9
  100. package/node_modules/typebox/build/guard/emit.mjs +2 -2
  101. package/node_modules/typebox/build/guard/guard.d.mts +7 -5
  102. package/node_modules/typebox/build/guard/guard.mjs +14 -9
  103. package/node_modules/typebox/build/guard/index.mjs +6 -0
  104. package/node_modules/typebox/build/guard/unicode/unicode.d.mts +6 -0
  105. package/node_modules/typebox/build/guard/unicode/unicode.mjs +35 -0
  106. package/node_modules/typebox/build/guard/{string.mjs → unicode/unicode_segment.mjs} +16 -19
  107. package/node_modules/typebox/build/schema/build.mjs +2 -3
  108. package/node_modules/typebox/build/schema/engine/_pathing.d.mts +1 -0
  109. package/node_modules/typebox/build/schema/engine/_pathing.mjs +11 -0
  110. package/node_modules/typebox/build/schema/engine/_refine.mjs +13 -5
  111. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +2 -1
  112. package/node_modules/typebox/build/schema/engine/dependencies.mjs +2 -1
  113. package/node_modules/typebox/build/schema/engine/dependentSchemas.mjs +2 -1
  114. package/node_modules/typebox/build/schema/engine/dynamicRef.d.mts +1 -1
  115. package/node_modules/typebox/build/schema/engine/dynamicRef.mjs +2 -2
  116. package/node_modules/typebox/build/schema/engine/format.mjs +9 -2
  117. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +3 -2
  118. package/node_modules/typebox/build/schema/engine/properties.mjs +3 -2
  119. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -1
  120. package/node_modules/typebox/build/schema/engine/recursiveRef.d.mts +1 -1
  121. package/node_modules/typebox/build/schema/engine/recursiveRef.mjs +2 -2
  122. package/node_modules/typebox/build/schema/engine/ref.d.mts +1 -1
  123. package/node_modules/typebox/build/schema/engine/ref.mjs +2 -2
  124. package/node_modules/typebox/build/schema/engine/schema.mjs +24 -24
  125. package/node_modules/typebox/build/schema/parse.mjs +3 -0
  126. package/node_modules/typebox/build/schema/pointer/pointer.d.mts +1 -6
  127. package/node_modules/typebox/build/schema/pointer/pointer.mjs +47 -64
  128. package/node_modules/typebox/build/system/settings/internal.d.mts +2 -0
  129. package/node_modules/typebox/build/system/settings/internal.mjs +20 -0
  130. package/node_modules/typebox/build/system/settings/settings.d.mts +11 -0
  131. package/node_modules/typebox/build/system/settings/settings.mjs +14 -0
  132. package/node_modules/typebox/build/type/extends/inference.d.mts +1 -1
  133. package/node_modules/typebox/build/type/extends/inference.mjs +15 -2
  134. package/node_modules/typebox/build/type/extends/tuple.d.mts +2 -1
  135. package/node_modules/typebox/build/type/extends/tuple.mjs +21 -1
  136. package/node_modules/typebox/build/value/parse/parse.mjs +10 -4
  137. package/node_modules/typebox/package.json +1 -1
  138. package/node_modules/typebox/readme.md +3 -1
  139. package/openclaw.plugin.json +21 -1
  140. package/package.json +5 -5
  141. package/dist/.setup/agent-components.runtime-CEPrf2SY.mjs +0 -4
  142. package/dist/.setup/probe.runtime-DBQ_AGPe.mjs +0 -2
  143. package/dist/.setup/provider-session.runtime-DrGAYnZv.mjs +0 -6
  144. package/dist/.setup/provider.runtime-BmjW_pIw.mjs +0 -2
  145. package/dist/.setup/security-audit.runtime-DHtYenx9.mjs +0 -2
  146. package/dist/.setup/setup-plugin-api-Dvr41dyx.mjs +0 -3
  147. package/dist/.setup/system-events-B2YEEMbS.mjs +0 -34
  148. package/dist/.setup/targets-CvemhN3i.mjs +0 -3
  149. package/dist/.setup/thread-bindings.session-updates-DCQq1WZ5.mjs +0 -55
  150. /package/node_modules/typebox/build/guard/{string.d.mts → unicode/unicode_segment.d.mts} +0 -0
@@ -1,12 +1,12 @@
1
- import { E as getDiscordEndpointRuntime, w as parseDiscordRetryAfterBodySeconds } from "./channel-type-DKnjV1XW.mjs";
2
- import "node:module";
1
+ import { n as __reExport, t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
+ import { D as getDiscordEndpointRuntime, T as parseDiscordRetryAfterBodySeconds } from "./channel-type-DRCrEMss.mjs";
3
3
  import { redactIdentifier, redactSensitiveFieldValue } from "openclaw/plugin-sdk/logging-core";
4
4
  import { ApplicationCommandOptionType, ApplicationCommandType, ButtonStyle, ComponentType, GatewayDispatchEvents, InteractionContextType, InteractionResponseType, InteractionType, MessageFlags, Routes, TextInputStyle } from "discord-api-types/v10";
5
5
  import { Type } from "typebox";
6
6
  import { Check } from "typebox/value";
7
7
  import { createHash } from "node:crypto";
8
- import { asDateTimestampMs, clampTimerTimeoutMs, parseStrictNonNegativeInteger, resolveExpiresAtMsFromDurationMs, resolveIntegerOption, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
9
8
  import { expectDefined } from "openclaw/plugin-sdk/expect-runtime";
9
+ import { asDateTimestampMs, clampTimerTimeoutMs, parseStrictNonNegativeInteger, resolveExpiresAtMsFromDurationMs, resolveIntegerOption, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
10
10
  import { inspect } from "node:util";
11
11
  import { gunzipSync } from "node:zlib";
12
12
  import { captureChannelReadAuthority } from "openclaw/plugin-sdk/fetch-runtime";
@@ -15,52 +15,6 @@ import { AsyncLocalStorage } from "node:async_hooks";
15
15
  import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
16
16
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
17
17
  import { parseRetryAfterHeaderSeconds } from "openclaw/plugin-sdk/retry-runtime";
18
- //#region \0rolldown/runtime.js
19
- var __defProp = Object.defineProperty;
20
- var __getOwnPropDesc = Object.getOwnPropertyDescriptor;
21
- var __getOwnPropNames = Object.getOwnPropertyNames;
22
- var __hasOwnProp = Object.prototype.hasOwnProperty;
23
- var __exportAll = (all, no_symbols) => {
24
- let target = {};
25
- for (var name in all) __defProp(target, name, {
26
- get: all[name],
27
- enumerable: true
28
- });
29
- if (!no_symbols) __defProp(target, Symbol.toStringTag, { value: "Module" });
30
- return target;
31
- };
32
- var __copyProps = (to, from, except, desc) => {
33
- if (from && typeof from === "object" || typeof from === "function") for (var keys = __getOwnPropNames(from), i = 0, n = keys.length, key; i < n; i++) {
34
- key = keys[i];
35
- if (!__hasOwnProp.call(to, key) && key !== except) __defProp(to, key, {
36
- get: ((k) => from[k]).bind(null, key),
37
- enumerable: !(desc = __getOwnPropDesc(from, key)) || desc.enumerable
38
- });
39
- }
40
- return to;
41
- };
42
- var __reExport = (target, mod, secondTarget) => (__copyProps(target, mod, "default"), secondTarget && __copyProps(secondTarget, mod, "default"));
43
- //#endregion
44
- //#region extensions/discord/src/internal/api.commands.ts
45
- async function listApplicationCommands(rest, clientId) {
46
- return await rest.get(Routes.applicationCommands(clientId));
47
- }
48
- async function createApplicationCommand(rest, clientId, body) {
49
- return await rest.post(Routes.applicationCommands(clientId), { body });
50
- }
51
- async function editApplicationCommand(rest, clientId, commandId, body) {
52
- return await rest.patch(Routes.applicationCommand(clientId, commandId), { body });
53
- }
54
- async function deleteApplicationCommand(rest, clientId, commandId) {
55
- await rest.delete(Routes.applicationCommand(clientId, commandId));
56
- }
57
- async function overwriteApplicationCommands(rest, clientId, body) {
58
- await rest.put(Routes.applicationCommands(clientId), { body });
59
- }
60
- async function overwriteGuildApplicationCommands(rest, clientId, guildId, body) {
61
- await rest.put(Routes.applicationGuildCommands(clientId, guildId), { body });
62
- }
63
- //#endregion
64
18
  //#region extensions/discord/src/internal/api.guild.ts
65
19
  const discordGuildEmojiListSchema = Type.Array(Type.Object({
66
20
  id: Type.Union([Type.String(), Type.Null()]),
@@ -186,28 +140,6 @@ async function searchGuildMessages(rest, guildId, params) {
186
140
  return await rest.get(`/guilds/${guildId}/messages/search?${params.toString()}`);
187
141
  }
188
142
  //#endregion
189
- //#region extensions/discord/src/internal/api.interactions.ts
190
- function normalizeDiscordWebhookMessageId(messageId) {
191
- const normalized = messageId.trim();
192
- return normalized === "@original" ? normalized : normalizeDiscordMessageId(normalized);
193
- }
194
- async function createInteractionCallback(rest, interactionId, token, body) {
195
- return await rest.post(Routes.interactionCallback(interactionId, token), { body });
196
- }
197
- async function editWebhookMessage(rest, applicationId, token, messageId, data, query) {
198
- const route = Routes.webhookMessage(applicationId, token, normalizeDiscordWebhookMessageId(messageId));
199
- return query ? await rest.patch(route, data, query) : await rest.patch(route, data);
200
- }
201
- async function deleteWebhookMessage(rest, applicationId, token, messageId) {
202
- return await rest.delete(Routes.webhookMessage(applicationId, token, normalizeDiscordWebhookMessageId(messageId)));
203
- }
204
- async function getWebhookMessage(rest, applicationId, token, messageId) {
205
- return await rest.get(Routes.webhookMessage(applicationId, token, normalizeDiscordWebhookMessageId(messageId)));
206
- }
207
- async function createWebhookMessage(rest, applicationId, token, data, query) {
208
- return await rest.post(Routes.webhook(applicationId, token), data, query);
209
- }
210
- //#endregion
211
143
  //#region extensions/discord/src/internal/api.reactions.ts
212
144
  async function createOwnMessageReaction(rest, channelId, messageId, encodedEmoji) {
213
145
  await rest.put(Routes.channelMessageOwnReaction(channelId, normalizeDiscordMessageId(messageId), encodedEmoji));
@@ -304,41 +236,24 @@ var DiscordCommandDeployer = class {
304
236
  this.hashes = /* @__PURE__ */ new Map();
305
237
  this.loadedKeys = /* @__PURE__ */ new Set();
306
238
  }
307
- async getCommands() {
308
- return await listApplicationCommands(this.rest, this.params.clientId);
309
- }
310
239
  async deploy(options = {}) {
311
240
  const commands = this.params.commands.filter((command) => command.name !== "*");
312
241
  const serializedGlobal = commands.filter((command) => !command.guildIds).map((command) => command.serialize());
313
- for (const [guildId, entries] of groupGuildCommands(commands)) await this.putCommandSetIfChanged(this.scopedCacheKey(`guild:${guildId}`), entries, async () => {
314
- await overwriteGuildApplicationCommands(this.rest, this.params.clientId, guildId, entries);
315
- }, options);
242
+ for (const [guildId, entries] of groupGuildCommands(commands)) await this.putCommandSetIfChanged(this.scopedCacheKey(`guild:${guildId}`), entries, () => this.rest.put(Routes.applicationGuildCommands(this.params.clientId, guildId), { body: entries }), options);
316
243
  if (this.params.devGuilds?.length) {
317
244
  for (const guildId of this.params.devGuilds) {
318
245
  const entries = commands.map((command) => command.serialize());
319
- await this.putCommandSetIfChanged(this.scopedCacheKey(`dev-guild:${guildId}`), entries, async () => {
320
- await overwriteGuildApplicationCommands(this.rest, this.params.clientId, guildId, entries);
321
- }, options);
246
+ await this.putCommandSetIfChanged(this.scopedCacheKey(`dev-guild:${guildId}`), entries, () => this.rest.put(Routes.applicationGuildCommands(this.params.clientId, guildId), { body: entries }), options);
322
247
  }
323
248
  return {
324
249
  mode: options.mode ?? "reconcile",
325
250
  usedDevGuilds: true
326
251
  };
327
252
  }
328
- if (options.mode !== "overwrite") {
329
- await this.putCommandSetIfChanged(this.scopedCacheKey("global:reconcile"), serializedGlobal, async () => {
330
- await this.reconcileGlobalCommands(serializedGlobal);
331
- }, options);
332
- return {
333
- mode: "reconcile",
334
- usedDevGuilds: false
335
- };
336
- }
337
- await this.putCommandSetIfChanged(this.scopedCacheKey("global:overwrite"), serializedGlobal, async () => {
338
- await overwriteApplicationCommands(this.rest, this.params.clientId, serializedGlobal);
339
- }, options);
253
+ const mode = options.mode === "overwrite" ? "overwrite" : "reconcile";
254
+ await this.putCommandSetIfChanged(this.scopedCacheKey(`global:${mode}`), serializedGlobal, () => mode === "overwrite" ? this.rest.put(Routes.applicationCommands(this.params.clientId), { body: serializedGlobal }) : this.reconcileGlobalCommands(serializedGlobal), options);
340
255
  return {
341
- mode: "overwrite",
256
+ mode,
342
257
  usedDevGuilds: false
343
258
  };
344
259
  }
@@ -353,7 +268,7 @@ var DiscordCommandDeployer = class {
353
268
  return `app:${this.params.clientId}:${suffix}`;
354
269
  }
355
270
  async reconcileGlobalCommands(desired) {
356
- const existing = await this.getCommands();
271
+ const existing = await this.rest.get(Routes.applicationCommands(this.params.clientId));
357
272
  const existingByKey = new Map(existing.map((command) => [stableCommandKey(command), command]));
358
273
  const desiredCommands = desired.map((command) => ({
359
274
  command,
@@ -362,19 +277,19 @@ var DiscordCommandDeployer = class {
362
277
  const desiredKeys = new Set(desiredCommands.map(({ key }) => key));
363
278
  for (const { command, key } of desiredCommands) {
364
279
  const current = existingByKey.get(key);
365
- if (current && !commandsEqual(current, command)) await editApplicationCommand(this.rest, this.params.clientId, current.id, command);
280
+ if (current && !commandsEqual(current, command)) await this.rest.patch(Routes.applicationCommand(this.params.clientId, current.id), { body: command });
366
281
  }
367
282
  for (const { command, key } of desiredCommands) {
368
283
  if (existingByKey.has(key)) continue;
369
284
  try {
370
- await createApplicationCommand(this.rest, this.params.clientId, command);
285
+ await this.rest.post(Routes.applicationCommands(this.params.clientId), { body: command });
371
286
  } catch (error) {
372
287
  if (!isApplicationCommandLimitError(error)) throw error;
373
- await overwriteApplicationCommands(this.rest, this.params.clientId, desired);
288
+ await this.rest.put(Routes.applicationCommands(this.params.clientId), { body: desired });
374
289
  return;
375
290
  }
376
291
  }
377
- for (const command of existing) if (!desiredKeys.has(stableCommandKey(command))) await deleteApplicationCommand(this.rest, this.params.clientId, command.id);
292
+ for (const command of existing) if (!desiredKeys.has(stableCommandKey(command))) await this.rest.delete(Routes.applicationCommand(this.params.clientId, command.id));
378
293
  }
379
294
  async putCommandSetIfChanged(key, commands, deploy, options) {
380
295
  const hash = stableCommandSetHash(commands);
@@ -400,7 +315,7 @@ var DiscordCommandDeployer = class {
400
315
  };
401
316
  function groupGuildCommands(commands) {
402
317
  const guildCommands = /* @__PURE__ */ new Map();
403
- for (const command of commands.filter((entry) => entry.guildIds)) for (const guildId of command.guildIds ?? []) {
318
+ for (const command of commands) for (const guildId of command.guildIds ?? []) {
404
319
  const entries = guildCommands.get(guildId) ?? [];
405
320
  entries.push(command.serialize());
406
321
  guildCommands.set(guildId, entries);
@@ -511,6 +426,12 @@ var AnySelectMenu = class extends BaseMessageInteractiveComponent {
511
426
  super(..._args3);
512
427
  this.disabled = false;
513
428
  }
429
+ serializeOptions() {
430
+ return {
431
+ type: this.type,
432
+ default_values: this.defaultValues
433
+ };
434
+ }
514
435
  serialize() {
515
436
  return stripUndefinedFields({
516
437
  ...this.serializeOptions(),
@@ -540,36 +461,18 @@ var UserSelectMenu = class extends AnySelectMenu {
540
461
  super(..._args5);
541
462
  this.type = ComponentType.UserSelect;
542
463
  }
543
- serializeOptions() {
544
- return {
545
- type: this.type,
546
- default_values: this.defaultValues
547
- };
548
- }
549
464
  };
550
465
  var RoleSelectMenu = class extends AnySelectMenu {
551
466
  constructor(..._args6) {
552
467
  super(..._args6);
553
468
  this.type = ComponentType.RoleSelect;
554
469
  }
555
- serializeOptions() {
556
- return {
557
- type: this.type,
558
- default_values: this.defaultValues
559
- };
560
- }
561
470
  };
562
471
  var MentionableSelectMenu = class extends AnySelectMenu {
563
472
  constructor(..._args7) {
564
473
  super(..._args7);
565
474
  this.type = ComponentType.MentionableSelect;
566
475
  }
567
- serializeOptions() {
568
- return {
569
- type: this.type,
570
- default_values: this.defaultValues
571
- };
572
- }
573
476
  };
574
477
  var ChannelSelectMenu = class extends AnySelectMenu {
575
478
  constructor(..._args8) {
@@ -738,10 +641,9 @@ var TextInput = class extends BaseModalComponent {
738
641
  });
739
642
  }
740
643
  };
741
- var CheckboxGroup = class extends BaseModalComponent {
644
+ var ModalChoiceGroup = class extends BaseModalComponent {
742
645
  constructor(..._args2) {
743
646
  super(..._args2);
744
- this.type = 22;
745
647
  this.options = [];
746
648
  }
747
649
  serialize() {
@@ -755,21 +657,16 @@ var CheckboxGroup = class extends BaseModalComponent {
755
657
  });
756
658
  }
757
659
  };
758
- var RadioGroup = class extends BaseModalComponent {
660
+ var CheckboxGroup = class extends ModalChoiceGroup {
759
661
  constructor(..._args3) {
760
662
  super(..._args3);
761
- this.type = 21;
762
- this.options = [];
663
+ this.type = 22;
763
664
  }
764
- serialize() {
765
- return stripUndefinedFields({
766
- type: this.type,
767
- custom_id: this.customId,
768
- options: this.options,
769
- required: this.required,
770
- min_values: this.minValues,
771
- max_values: this.maxValues
772
- });
665
+ };
666
+ var RadioGroup = class extends ModalChoiceGroup {
667
+ constructor(..._args4) {
668
+ super(..._args4);
669
+ this.type = 21;
773
670
  }
774
671
  };
775
672
  var Label = class extends BaseModalComponent {
@@ -853,7 +750,6 @@ function serializePayload(payload) {
853
750
  var ComponentRegistry = class {
854
751
  constructor() {
855
752
  this.entries = /* @__PURE__ */ new Map();
856
- this.oneOffComponents = /* @__PURE__ */ new Map();
857
753
  this.wildcardEntries = [];
858
754
  }
859
755
  register(entry) {
@@ -882,56 +778,10 @@ var ComponentRegistry = class {
882
778
  return true;
883
779
  });
884
780
  }
885
- waitForMessageComponent(message, timeoutMs) {
886
- const key = createOneOffComponentKey(message.id, message.channelId);
887
- return new Promise((resolve) => {
888
- const existing = this.oneOffComponents.get(key);
889
- if (existing) {
890
- clearTimeout(existing.timer);
891
- existing.resolve({
892
- success: false,
893
- message: existing.message,
894
- reason: "timed out"
895
- });
896
- }
897
- const timer = setTimeout(() => {
898
- this.oneOffComponents.delete(key);
899
- resolve({
900
- success: false,
901
- message,
902
- reason: "timed out"
903
- });
904
- }, resolveTimerTimeoutMs(timeoutMs, 0, 0));
905
- timer.unref?.();
906
- this.oneOffComponents.set(key, {
907
- message,
908
- timer,
909
- resolve
910
- });
911
- });
912
- }
913
- resolveOneOffComponent(params) {
914
- if (!params.messageId || !params.channelId) return false;
915
- const key = createOneOffComponentKey(params.messageId, params.channelId);
916
- const entry = this.oneOffComponents.get(key);
917
- if (!entry) return false;
918
- clearTimeout(entry.timer);
919
- this.oneOffComponents.delete(key);
920
- entry.resolve({
921
- success: true,
922
- customId: params.customId,
923
- message: entry.message,
924
- values: params.values
925
- });
926
- return true;
927
- }
928
781
  };
929
782
  function parseRegistryKey(customId, parser = parseCustomId) {
930
783
  return parser(customId).key;
931
784
  }
932
- function createOneOffComponentKey(messageId, channelId) {
933
- return `${messageId}:${channelId}`;
934
- }
935
785
  //#endregion
936
786
  //#region extensions/discord/src/internal/structures.ts
937
787
  var Base = class {
@@ -939,12 +789,14 @@ var Base = class {
939
789
  this.client = client;
940
790
  }
941
791
  };
942
- var User = class extends Base {
792
+ var PartialEntity = class extends Base {
943
793
  constructor(client, rawDataOrId) {
944
794
  super(client);
945
795
  this.rawDataValue = typeof rawDataOrId === "string" ? null : rawDataOrId;
946
796
  this.id = typeof rawDataOrId === "string" ? rawDataOrId : rawDataOrId.id;
947
797
  }
798
+ };
799
+ var User = class extends PartialEntity {
948
800
  get rawData() {
949
801
  if (!this.rawDataValue) throw new Error("Partial Discord user has no raw data");
950
802
  return this.rawDataValue;
@@ -967,49 +819,22 @@ var User = class extends Base {
967
819
  get avatar() {
968
820
  return this.rawDataValue?.avatar;
969
821
  }
970
- get avatarUrl() {
971
- return this.avatar ? `https://cdn.discordapp.com/avatars/${this.id}/${this.avatar}.png` : null;
972
- }
973
- toString() {
974
- return `<@${this.id}>`;
975
- }
976
822
  async fetch() {
977
823
  return this.client.fetchUser(this.id);
978
824
  }
979
- async createDm() {
980
- return await createUserDmChannel(this.client.rest, this.id);
981
- }
982
- async send(data) {
983
- const dm = await this.createDm();
984
- const message = await createChannelMessage(this.client.rest, dm.id, { body: serializePayload(data) });
985
- return new Message(this.client, message);
986
- }
987
825
  };
988
- var Role = class extends Base {
989
- constructor(client, rawDataOrId) {
990
- super(client);
991
- this.rawDataValue = typeof rawDataOrId === "string" ? null : rawDataOrId;
992
- this.id = typeof rawDataOrId === "string" ? rawDataOrId : rawDataOrId.id;
993
- }
826
+ var Role = class extends PartialEntity {
994
827
  get name() {
995
828
  return this.rawDataValue?.name ?? "";
996
829
  }
997
830
  };
998
- var Guild = class extends Base {
999
- constructor(client, rawDataOrId) {
1000
- super(client);
1001
- this.rawDataValue = typeof rawDataOrId === "string" ? null : rawDataOrId;
1002
- this.id = typeof rawDataOrId === "string" ? rawDataOrId : rawDataOrId.id;
1003
- }
831
+ var Guild = class extends PartialEntity {
1004
832
  get name() {
1005
833
  return this.rawDataValue?.name ?? "";
1006
834
  }
1007
835
  get icon() {
1008
836
  return this.rawDataValue?.icon;
1009
837
  }
1010
- get iconUrl() {
1011
- return this.icon ? `https://cdn.discordapp.com/icons/${this.id}/${this.icon}.png` : null;
1012
- }
1013
838
  };
1014
839
  var GuildMember = class extends Base {
1015
840
  constructor(client, rawData) {
@@ -1108,29 +933,6 @@ var Message = class Message extends Base {
1108
933
  const raw = await getChannelMessage(this.client.rest, this.channelId, this.id);
1109
934
  return new Message(this.client, raw);
1110
935
  }
1111
- async delete() {
1112
- await deleteChannelMessage(this.client.rest, this.channelId, this.id);
1113
- }
1114
- async edit(data) {
1115
- const raw = await editChannelMessage(this.client.rest, this.channelId, this.id, { body: serializePayload(data) });
1116
- return new Message(this.client, raw);
1117
- }
1118
- async reply(data) {
1119
- const raw = await createChannelMessage(this.client.rest, this.channelId, { body: {
1120
- ...serializePayload(data),
1121
- message_reference: {
1122
- message_id: this.id,
1123
- fail_if_not_exists: false
1124
- }
1125
- } });
1126
- return new Message(this.client, raw);
1127
- }
1128
- async pin() {
1129
- await pinChannelMessage(this.client.rest, this.channelId, this.id);
1130
- }
1131
- async unpin() {
1132
- await unpinChannelMessage(this.client.rest, this.channelId, this.id);
1133
- }
1134
936
  };
1135
937
  function channelFactory(clientForTest, channelData, _partial) {
1136
938
  return {
@@ -1147,6 +949,17 @@ function channelFactory(clientForTest, channelData, _partial) {
1147
949
  const DEFAULT_REST_CACHE_TTL_MS = 3e4;
1148
950
  const DEFAULT_MAX_ENTRIES = 5e3;
1149
951
  const DEFAULT_SWEEP_INTERVAL_MS = 3e4;
952
+ const CACHE_KIND_BY_EVENT = /* @__PURE__ */ new Map([
953
+ [GatewayDispatchEvents.ChannelUpdate, "channel"],
954
+ [GatewayDispatchEvents.ChannelDelete, "channel"],
955
+ [GatewayDispatchEvents.ThreadUpdate, "channel"],
956
+ [GatewayDispatchEvents.ThreadDelete, "channel"],
957
+ [GatewayDispatchEvents.GuildUpdate, "guild"],
958
+ [GatewayDispatchEvents.GuildEmojisUpdate, "guild-emojis"],
959
+ [GatewayDispatchEvents.GuildMemberAdd, "member"],
960
+ [GatewayDispatchEvents.GuildMemberRemove, "member"],
961
+ [GatewayDispatchEvents.GuildMemberUpdate, "member"]
962
+ ]);
1150
963
  var DiscordEntityCache = class {
1151
964
  constructor(params) {
1152
965
  this.params = params;
@@ -1184,27 +997,17 @@ var DiscordEntityCache = class {
1184
997
  return await this.fetchCached(`guild-emojis:${guildId}`, fetcher);
1185
998
  }
1186
999
  invalidateForGatewayEvent(type, data) {
1000
+ const kind = CACHE_KIND_BY_EVENT.get(type);
1001
+ if (!kind) return;
1187
1002
  const raw = data && typeof data === "object" ? data : {};
1188
- const channelUpdate = GatewayDispatchEvents.ChannelUpdate;
1189
- const channelDelete = GatewayDispatchEvents.ChannelDelete;
1190
- const threadUpdate = GatewayDispatchEvents.ThreadUpdate;
1191
- const threadDelete = GatewayDispatchEvents.ThreadDelete;
1192
- const guildUpdate = GatewayDispatchEvents.GuildUpdate;
1193
- const guildEmojisUpdate = GatewayDispatchEvents.GuildEmojisUpdate;
1194
- const guildMemberAdd = GatewayDispatchEvents.GuildMemberAdd;
1195
- const guildMemberRemove = GatewayDispatchEvents.GuildMemberRemove;
1196
- const guildMemberUpdate = GatewayDispatchEvents.GuildMemberUpdate;
1197
- if (type === channelUpdate || type === channelDelete || type === threadUpdate || type === threadDelete) this.deleteId("channel", raw.id);
1198
- if (type === guildUpdate) this.deleteId("guild", raw.id);
1199
- if (type === guildEmojisUpdate) this.deleteId("guild-emojis", raw.guild_id);
1200
- if (type === guildMemberAdd || type === guildMemberRemove || type === guildMemberUpdate) {
1003
+ if (kind === "member") {
1201
1004
  const guildId = raw.guild_id;
1202
1005
  const user = raw.user && typeof raw.user === "object" ? raw.user : {};
1203
1006
  if (typeof guildId === "string" && typeof user.id === "string") {
1204
1007
  this.entries.delete(`member:${guildId}:${user.id}`);
1205
1008
  this.entries.delete(`user:${user.id}`);
1206
1009
  }
1207
- }
1010
+ } else this.deleteId(kind, kind === "guild-emojis" ? raw.guild_id : raw.id);
1208
1011
  }
1209
1012
  deleteId(prefix, id) {
1210
1013
  if (typeof id === "string") this.entries.delete(`${prefix}:${id}`);
@@ -1483,17 +1286,10 @@ var CommandWithSubcommands = class extends BaseCommand {
1483
1286
  };
1484
1287
  //#endregion
1485
1288
  //#region extensions/discord/src/internal/interaction-options.ts
1486
- function readFocusedOption(options) {
1487
- for (const option of options ?? []) {
1488
- if ("focused" in option && option.focused) return option;
1489
- const child = readFocusedOption(readChildOptions(option));
1490
- if (child) return child;
1491
- }
1492
- }
1493
- function findOption(options, name) {
1289
+ function findOption(options, matches) {
1494
1290
  for (const option of options ?? []) {
1495
- if (option.name === name) return option;
1496
- const child = findOption(readChildOptions(option), name);
1291
+ if (matches(option)) return option;
1292
+ const child = findOption(readChildOptions(option), matches);
1497
1293
  if (child) return child;
1498
1294
  }
1499
1295
  }
@@ -1508,22 +1304,22 @@ var OptionsHandler = class {
1508
1304
  this.resolvedChannels = resolvedChannels;
1509
1305
  }
1510
1306
  getString(name) {
1511
- const option = findOption(this.rawOptions, name);
1307
+ const option = findOption(this.rawOptions, (entry) => entry.name === name);
1512
1308
  const value = option && "value" in option ? option.value : void 0;
1513
1309
  return typeof value === "string" ? value : null;
1514
1310
  }
1515
1311
  getNumber(name) {
1516
- const option = findOption(this.rawOptions, name);
1312
+ const option = findOption(this.rawOptions, (entry) => entry.name === name);
1517
1313
  const value = option && "value" in option ? option.value : void 0;
1518
1314
  return typeof value === "number" ? value : null;
1519
1315
  }
1520
1316
  getBoolean(name) {
1521
- const option = findOption(this.rawOptions, name);
1317
+ const option = findOption(this.rawOptions, (entry) => entry.name === name);
1522
1318
  const value = option && "value" in option ? option.value : void 0;
1523
1319
  return typeof value === "boolean" ? value : null;
1524
1320
  }
1525
1321
  async getChannel(name, required = false) {
1526
- const option = findOption(this.rawOptions, name);
1322
+ const option = findOption(this.rawOptions, (entry) => entry.name === name);
1527
1323
  const value = option && "value" in option ? option.value : void 0;
1528
1324
  const id = typeof value === "string" ? value : void 0;
1529
1325
  const resolved = id ? this.resolvedChannels?.[id] : void 0;
@@ -1533,7 +1329,7 @@ var OptionsHandler = class {
1533
1329
  return null;
1534
1330
  }
1535
1331
  getFocused() {
1536
- return readFocusedOption(this.rawOptions);
1332
+ return findOption(this.rawOptions, (option) => "focused" in option && Boolean(option.focused));
1537
1333
  }
1538
1334
  };
1539
1335
  //#endregion
@@ -1654,15 +1450,6 @@ function isDiscordRateLimitBody(value) {
1654
1450
  }
1655
1451
  //#endregion
1656
1452
  //#region extensions/discord/src/internal/interactions.ts
1657
- function toCommandRawInteraction(rawData) {
1658
- return rawData;
1659
- }
1660
- function toMessageComponentRawInteraction(rawData) {
1661
- return rawData;
1662
- }
1663
- function toModalSubmitRawInteraction(rawData) {
1664
- return rawData;
1665
- }
1666
1453
  function readInteractionUser(rawData, client) {
1667
1454
  const directUser = "user" in rawData ? rawData.user : void 0;
1668
1455
  if (directUser && typeof directUser === "object" && "id" in directUser) return new User(client, directUser);
@@ -1713,10 +1500,10 @@ var BaseInteraction = class {
1713
1500
  }
1714
1501
  async performCallback(type, data) {
1715
1502
  if (this.response.acknowledged) throw new Error("Discord interaction has already been acknowledged.");
1716
- const result = await createInteractionCallback(this.client.rest, this.id, this.token, data === void 0 ? { type } : {
1503
+ const result = await this.client.rest.post(Routes.interactionCallback(this.id, this.token), { body: data === void 0 ? { type } : {
1717
1504
  type,
1718
1505
  data
1719
- });
1506
+ } });
1720
1507
  this.response.recordCallback(type);
1721
1508
  return result;
1722
1509
  }
@@ -1761,33 +1548,29 @@ var BaseInteraction = class {
1761
1548
  async performReplyEdit(payload) {
1762
1549
  const body = serializePayload(payload);
1763
1550
  const query = needsComponentsV2Query(body) ? { with_components: true } : void 0;
1764
- const result = query ? await editWebhookMessage(this.client.rest, this.client.options.clientId, this.token, "@original", { body }, query) : await editWebhookMessage(this.client.rest, this.client.options.clientId, this.token, "@original", { body });
1551
+ const result = query ? await this.client.rest.patch(this.originalReplyRoute, { body }, query) : await this.client.rest.patch(this.originalReplyRoute, { body });
1765
1552
  this.response.recordReplyEdit();
1766
1553
  return result;
1767
1554
  }
1768
1555
  async deleteReply() {
1769
1556
  return await this.enqueueResponse(async () => {
1770
- const result = await deleteWebhookMessage(this.client.rest, this.client.options.clientId, this.token, "@original");
1557
+ const result = await this.client.rest.delete(this.originalReplyRoute);
1771
1558
  this.response.recordReplyDelete();
1772
1559
  return result;
1773
1560
  });
1774
1561
  }
1775
1562
  async fetchReply() {
1776
- return await this.enqueueResponse(() => getWebhookMessage(this.client.rest, this.client.options.clientId, this.token, "@original"));
1563
+ return await this.enqueueResponse(() => this.client.rest.get(this.originalReplyRoute));
1777
1564
  }
1778
- async replyAndWaitForComponent(payload, timeoutMs = 3e5) {
1779
- const result = await this.reply(payload);
1780
- const rawMessage = isRawMessage(result) ? result : await this.fetchReply();
1781
- if (!isRawMessage(rawMessage)) throw new Error("Discord interaction reply did not return a message");
1782
- const message = new Message(this.client, rawMessage);
1783
- return await this.client.componentHandler.waitForMessageComponent(message, timeoutMs);
1565
+ get originalReplyRoute() {
1566
+ return Routes.webhookMessage(this.client.options.clientId, this.token, "@original");
1784
1567
  }
1785
1568
  async followUp(payload) {
1786
1569
  return await this.enqueueResponse(() => this.performFollowUp(payload));
1787
1570
  }
1788
1571
  async performFollowUp(payload) {
1789
1572
  const body = serializePayload(payload);
1790
- const result = await createWebhookMessage(this.client.rest, this.client.options.clientId, this.token, { body }, needsComponentsV2Query(body) ? { with_components: true } : void 0);
1573
+ const result = await this.client.rest.post(Routes.webhook(this.client.options.clientId, this.token), { body }, needsComponentsV2Query(body) ? { with_components: true } : void 0);
1791
1574
  this.sentFollowUp = true;
1792
1575
  return result;
1793
1576
  }
@@ -1839,11 +1622,11 @@ var ModalInteraction = class extends BaseInteraction {
1839
1622
  };
1840
1623
  function createInteraction(client, rawData) {
1841
1624
  assertDiscordInteractionPayload(rawData);
1842
- if (rawData.type === InteractionType.ApplicationCommandAutocomplete) return new AutocompleteInteraction(client, toCommandRawInteraction(rawData));
1843
- if (rawData.type === InteractionType.ApplicationCommand) return new CommandInteraction(client, toCommandRawInteraction(rawData));
1844
- if (rawData.type === InteractionType.ModalSubmit) return new ModalInteraction(client, toModalSubmitRawInteraction(rawData));
1625
+ if (rawData.type === InteractionType.ApplicationCommandAutocomplete) return new AutocompleteInteraction(client, rawData);
1626
+ if (rawData.type === InteractionType.ApplicationCommand) return new CommandInteraction(client, rawData);
1627
+ if (rawData.type === InteractionType.ModalSubmit) return new ModalInteraction(client, rawData);
1845
1628
  if (rawData.type === InteractionType.MessageComponent) {
1846
- const componentRawData = toMessageComponentRawInteraction(rawData);
1629
+ const componentRawData = rawData;
1847
1630
  switch (rawData.data?.component_type) {
1848
1631
  case ComponentType.Button: return new ButtonInteraction(client, componentRawData);
1849
1632
  case ComponentType.StringSelect: return new StringSelectMenuInteraction(client, componentRawData);
@@ -1856,18 +1639,12 @@ function createInteraction(client, rawData) {
1856
1639
  }
1857
1640
  return new BaseInteraction(client, rawData);
1858
1641
  }
1859
- function parseComponentInteractionData(component, customId) {
1860
- return component.customIdParser(customId).data;
1861
- }
1862
- function isRawMessage(value) {
1863
- return Boolean(value) && typeof value === "object" && typeof value.id === "string" && typeof value.channel_id === "string";
1864
- }
1865
1642
  //#endregion
1866
1643
  //#region extensions/discord/src/internal/interaction-dispatch.ts
1867
1644
  async function dispatchInteraction(client, rawData) {
1868
1645
  const interaction = createInteraction(client, rawData);
1869
1646
  if (rawData.type === InteractionType.ApplicationCommandAutocomplete) {
1870
- const command = client.commands.find((entry) => entry.name === readInteractionName(rawData));
1647
+ const command = client.commands.find((entry) => entry.name === rawData.data?.name);
1871
1648
  if (!command) return;
1872
1649
  const autocompleteInteraction = interaction;
1873
1650
  const optionAutocomplete = resolveFocusedCommandOptionAutocompleteHandler(command, autocompleteInteraction);
@@ -1887,7 +1664,7 @@ async function dispatchInteraction(client, rawData) {
1887
1664
  }
1888
1665
  async function dispatchAcknowledgeableInteraction(client, rawData, interaction) {
1889
1666
  if (rawData.type === InteractionType.ApplicationCommand) {
1890
- const command = client.commands.find((entry) => entry.name === readInteractionName(rawData));
1667
+ const command = client.commands.find((entry) => entry.name === rawData.data?.name);
1891
1668
  if (command) {
1892
1669
  await deferCommandInteractionIfNeeded(command, interaction);
1893
1670
  await command.run(interaction);
@@ -1895,60 +1672,24 @@ async function dispatchAcknowledgeableInteraction(client, rawData, interaction)
1895
1672
  return;
1896
1673
  }
1897
1674
  if (rawData.type === InteractionType.MessageComponent) {
1898
- const customId = readCustomId(rawData);
1675
+ const customId = rawData.data?.custom_id;
1899
1676
  if (!customId) return;
1900
1677
  const componentInteraction = interaction;
1901
- if (client.componentHandler.resolveOneOffComponent({
1902
- channelId: readMessageChannelId(rawData),
1903
- customId,
1904
- messageId: readMessageId(rawData),
1905
- values: readComponentValues(rawData)
1906
- })) {
1907
- await componentInteraction.acknowledge();
1908
- return;
1909
- }
1910
1678
  const component = client.componentHandler.resolve(customId, { componentType: rawData.data?.component_type });
1911
1679
  if (component) {
1912
1680
  await deferComponentInteractionIfNeeded(component, componentInteraction);
1913
- await component.run(componentInteraction, parseComponentInteractionData(component, customId));
1681
+ await component.run(componentInteraction, component.customIdParser(customId).data);
1914
1682
  }
1915
1683
  return;
1916
1684
  }
1917
1685
  if (rawData.type === InteractionType.ModalSubmit) {
1918
- const customId = readCustomId(rawData);
1686
+ const customId = rawData.data?.custom_id;
1919
1687
  if (!customId) return;
1920
1688
  const modal = client.modalHandler.resolve(customId);
1921
1689
  if (modal) await modal.run(interaction, modal.customIdParser(customId).data);
1922
1690
  }
1923
1691
  }
1924
- /**
1925
- * Fixed text. The thrown error is deliberately not echoed here: an interaction
1926
- * response is visible to the whole channel, and handler exceptions routinely
1927
- * carry absolute paths, config keys, and provider responses. The rethrow keeps
1928
- * the detail in the Gateway log where operators already look for it.
1929
- */
1930
1692
  const INTERACTION_FAILURE_NOTICE = "Command failed. Check the Gateway logs for details.";
1931
- /**
1932
- * Best-effort user-visible notice for a failed interaction. Never throws: a
1933
- * reporting failure must not mask the original error.
1934
- *
1935
- * Deliberately narrow. It reports only for `deferred`, where a spinner is known
1936
- * to exist and the original response is a placeholder this dispatch created:
1937
- *
1938
- * - `deferred` the deferring callback succeeded (state advances only
1939
- * after a REST success), so editing the original response
1940
- * resolves a spinner that would otherwise hang forever.
1941
- * - `deferred-update` a component acknowledgement. Discord leaves no spinner,
1942
- * and the original response is the message the component is
1943
- * attached to, so editing it would overwrite content the
1944
- * user is still reading.
1945
- * - `unacknowledged` nothing is known to have reached Discord. A second
1946
- * initial callback risks "already acknowledged" if the
1947
- * first one landed after all, and Discord already shows its
1948
- * own "did not respond" notice.
1949
- * - `replied` the user has seen a message, and nextReplyAction() would
1950
- * turn this into a contradictory follow-up beside it.
1951
- */
1952
1693
  async function reportInteractionFailure(interaction) {
1953
1694
  if (interaction.responseState !== "deferred") return;
1954
1695
  if (interaction.hasSentFollowUp) return;
@@ -1970,24 +1711,6 @@ async function deferComponentInteractionIfNeeded(component, interaction) {
1970
1711
  }
1971
1712
  await interaction.acknowledge();
1972
1713
  }
1973
- function readInteractionName(rawData) {
1974
- return rawData.data?.name;
1975
- }
1976
- function readCustomId(rawData) {
1977
- return rawData.data?.custom_id;
1978
- }
1979
- function readComponentValues(rawData) {
1980
- const values = rawData.data?.values;
1981
- return Array.isArray(values) ? values.map(String) : void 0;
1982
- }
1983
- function readMessageId(rawData) {
1984
- const messageId = rawData.message?.id;
1985
- return typeof messageId === "string" ? messageId : void 0;
1986
- }
1987
- function readMessageChannelId(rawData) {
1988
- const channelId = rawData.message?.channel_id;
1989
- return typeof channelId === "string" ? channelId : void 0;
1990
- }
1991
1714
  //#endregion
1992
1715
  //#region extensions/discord/src/internal/request-authority.ts
1993
1716
  const requestAuthority = resolveGlobalSingleton(Symbol.for("openclaw.discord.requestAuthority"), () => new AsyncLocalStorage());
@@ -2377,15 +2100,9 @@ var RestScheduler = class {
2377
2100
  droppedByLane: { ...this.laneDropped },
2378
2101
  oldestQueuedByLane: Object.fromEntries(requestPriorities.map((lane) => [lane, this.getOldestQueuedAge(lane)])),
2379
2102
  activeWorkers: this.activeWorkers,
2380
- maxConcurrentWorkers: this.maxConcurrentWorkers
2103
+ maxConcurrentWorkers: this.options.maxConcurrency
2381
2104
  };
2382
2105
  }
2383
- get maxConcurrentWorkers() {
2384
- return this.options.maxConcurrency;
2385
- }
2386
- get maxRateLimitRetries() {
2387
- return this.options.maxRateLimitRetries;
2388
- }
2389
2106
  getBucket(key) {
2390
2107
  const existing = this.buckets.get(key);
2391
2108
  if (existing) return existing;
@@ -2488,7 +2205,7 @@ var RestScheduler = class {
2488
2205
  }
2489
2206
  drainQueues() {
2490
2207
  let nextDelayMs = Number.POSITIVE_INFINITY;
2491
- while (this.activeWorkers < this.maxConcurrentWorkers) {
2208
+ while (this.activeWorkers < this.options.maxConcurrency) {
2492
2209
  const next = this.takeNextQueuedRequest();
2493
2210
  if (!next.queued) {
2494
2211
  if (next.waitMs !== void 0) nextDelayMs = Math.min(nextDelayMs, next.waitMs);
@@ -2576,7 +2293,7 @@ var RestScheduler = class {
2576
2293
  }
2577
2294
  }
2578
2295
  requeueRateLimitedRequest(queued) {
2579
- if (queued.generation !== this.queueGeneration || queued.retryCount >= this.maxRateLimitRetries) return false;
2296
+ if (queued.generation !== this.queueGeneration || queued.retryCount >= this.options.maxRateLimitRetries) return false;
2580
2297
  const bucketKey = this.routeBuckets.get(queued.routeKey) ?? queued.routeKey;
2581
2298
  this.getBucket(bucketKey).pending[queued.priority].push({
2582
2299
  ...queued,
@@ -2624,8 +2341,7 @@ const defaultOptions = {
2624
2341
  userAgent: "OpenClaw Discord",
2625
2342
  timeout: 15e3,
2626
2343
  queueRequests: true,
2627
- maxQueueSize: 1e3,
2628
- runtimeProfile: "persistent"
2344
+ maxQueueSize: 1e3
2629
2345
  };
2630
2346
  const DEFAULT_MAX_CONCURRENT_WORKERS = 4;
2631
2347
  const defaultLaneOptions = {
@@ -2838,16 +2554,12 @@ function getRequestPriority(method, path) {
2838
2554
  var Plugin = class {};
2839
2555
  var Client = class {
2840
2556
  constructor(options, handlers, plugins = []) {
2841
- this.routes = [];
2842
2557
  this.plugins = [];
2843
2558
  this.componentHandler = new ComponentRegistry();
2844
2559
  this.modalHandler = new ComponentRegistry();
2845
2560
  if (!options.clientId) throw new Error("Missing Discord application ID");
2846
2561
  if (!options.token) throw new Error("Missing Discord bot token");
2847
- this.options = {
2848
- ...options,
2849
- baseUrl: options.baseUrl.replace(/\/+$/, "")
2850
- };
2562
+ this.options = { ...options };
2851
2563
  this.commands = handlers.commands ?? [];
2852
2564
  this.listeners = handlers.listeners ?? [];
2853
2565
  this.rest = new RequestClient(options.token, options.requestOptions);
@@ -2869,15 +2581,11 @@ var Client = class {
2869
2581
  for (const modal of handlers.modals ?? []) this.modalHandler.register(modal);
2870
2582
  for (const plugin of plugins) {
2871
2583
  plugin.registerClient?.(this);
2872
- plugin.registerRoutes?.(this);
2873
- this.plugins.push({
2874
- id: plugin.id,
2875
- plugin
2876
- });
2584
+ this.plugins.push(plugin);
2877
2585
  }
2878
2586
  }
2879
2587
  getPlugin(id) {
2880
- return this.plugins.find((entry) => entry.id === id)?.plugin;
2588
+ return this.plugins.find((plugin) => plugin.id === id);
2881
2589
  }
2882
2590
  registerListener(listener) {
2883
2591
  if (!this.listeners.includes(listener)) this.listeners.push(listener);
@@ -2913,7 +2621,7 @@ var Client = class {
2913
2621
  async deployCommands(options = {}) {
2914
2622
  return await this.commandDeployer.deploy(options);
2915
2623
  }
2916
- async handleInteraction(rawData, _ctx) {
2624
+ async handleInteraction(rawData) {
2917
2625
  await dispatchInteraction(this, rawData);
2918
2626
  }
2919
2627
  async dispatchGatewayEvent(type, data) {
@@ -3069,7 +2777,6 @@ var discord_exports = /* @__PURE__ */ __exportAll({
3069
2777
  VoiceStateUpdateListener: () => VoiceStateUpdateListener,
3070
2778
  addGuildMemberRole: () => addGuildMemberRole,
3071
2779
  channelFactory: () => channelFactory,
3072
- createApplicationCommand: () => createApplicationCommand,
3073
2780
  createChannelMessage: () => createChannelMessage,
3074
2781
  createChannelWebhook: () => createChannelWebhook,
3075
2782
  createGuildBan: () => createGuildBan,
@@ -3078,22 +2785,16 @@ var discord_exports = /* @__PURE__ */ __exportAll({
3078
2785
  createGuildScheduledEvent: () => createGuildScheduledEvent,
3079
2786
  createGuildSticker: () => createGuildSticker,
3080
2787
  createInteraction: () => createInteraction,
3081
- createInteractionCallback: () => createInteractionCallback,
3082
2788
  createOwnMessageReaction: () => createOwnMessageReaction,
3083
2789
  createThread: () => createThread,
3084
2790
  createUserDmChannel: () => createUserDmChannel,
3085
- createWebhookMessage: () => createWebhookMessage,
3086
2791
  deferCommandInteractionIfNeeded: () => deferCommandInteractionIfNeeded,
3087
- deleteApplicationCommand: () => deleteApplicationCommand,
3088
2792
  deleteChannel: () => deleteChannel,
3089
2793
  deleteChannelMessage: () => deleteChannelMessage,
3090
2794
  deleteChannelPermission: () => deleteChannelPermission,
3091
2795
  deleteOwnMessageReaction: () => deleteOwnMessageReaction,
3092
- deleteWebhookMessage: () => deleteWebhookMessage,
3093
- editApplicationCommand: () => editApplicationCommand,
3094
2796
  editChannel: () => editChannel,
3095
2797
  editChannelMessage: () => editChannelMessage,
3096
- editWebhookMessage: () => editWebhookMessage,
3097
2798
  getChannel: () => getChannel,
3098
2799
  getChannelMessage: () => getChannelMessage,
3099
2800
  getCurrentUser: () => getCurrentUser,
@@ -3102,10 +2803,8 @@ var discord_exports = /* @__PURE__ */ __exportAll({
3102
2803
  getGuildVoiceState: () => getGuildVoiceState,
3103
2804
  getThreadMember: () => getThreadMember,
3104
2805
  getUser: () => getUser,
3105
- getWebhookMessage: () => getWebhookMessage,
3106
2806
  hasDiscordV2Components: () => hasDiscordV2Components,
3107
2807
  isUnknownDiscordVoiceStateError: () => isUnknownDiscordVoiceStateError,
3108
- listApplicationCommands: () => listApplicationCommands,
3109
2808
  listChannelArchivedThreads: () => listChannelArchivedThreads,
3110
2809
  listChannelMessages: () => listChannelMessages,
3111
2810
  listChannelPins: () => listChannelPins,
@@ -3117,9 +2816,6 @@ var discord_exports = /* @__PURE__ */ __exportAll({
3117
2816
  listMessageReactionUsers: () => listMessageReactionUsers,
3118
2817
  moveGuildChannels: () => moveGuildChannels,
3119
2818
  normalizeDiscordMessageId: () => normalizeDiscordMessageId,
3120
- overwriteApplicationCommands: () => overwriteApplicationCommands,
3121
- overwriteGuildApplicationCommands: () => overwriteGuildApplicationCommands,
3122
- parseComponentInteractionData: () => parseComponentInteractionData,
3123
2819
  parseCustomId: () => parseCustomId,
3124
2820
  pinChannelMessage: () => pinChannelMessage,
3125
2821
  putChannelPermission: () => putChannelPermission,
@@ -3135,4 +2831,4 @@ var discord_exports = /* @__PURE__ */ __exportAll({
3135
2831
  import * as import_discord_api_types_v10 from "discord-api-types/v10";
3136
2832
  __reExport(discord_exports, import_discord_api_types_v10);
3137
2833
  //#endregion
3138
- export { parseCustomId as $, serializePayload as A, getGuild as At, File as B, removeGuildMember as Bt, withDiscordRequestAuthority as C, addGuildMemberRole as Ct, Message as D, createGuildScheduledEvent as Dt, Guild as E, createGuildEmoji as Et, RadioGroup as F, listGuildEmojis as Ft, Row as G, MediaGallery as H, timeoutGuildMember as Ht, TextInput as I, listGuildRoles as It, StringSelectMenu as J, Section as K, Button as L, listGuildScheduledEvents as Lt, CheckboxGroup as M, getGuildVoiceState as Mt, Label as N, listGuildActiveThreads as Nt, User as O, createGuildSticker as Ot, Modal as P, listGuildChannels as Pt, BaseMessageInteractiveComponent as Q, ChannelSelectMenu as R, moveGuildChannels as Rt, readRetryAfter as S, unpinChannelMessage as St, CommandWithSubcommands as T, createGuildChannel as Tt, MentionableSelectMenu as U, __exportAll as Ut, LinkButton as V, removeGuildMemberRole as Vt, RoleSelectMenu as W, Thumbnail as X, TextDisplay as Y, UserSelectMenu as Z, DiscordError as _, listChannelMessages as _t, MessageCreateListener as a, deleteOwnMessageReaction as at, readDiscordCode as b, searchGuildMessages as bt, PresenceUpdateListener as c, createThread as ct, ThreadDeleteListener as d, editChannel as dt, stripUndefinedFields as et, ThreadUpdateListener as f, editChannelMessage as ft, RequestClient as g, listChannelArchivedThreads as gt, Plugin as h, getThreadMember as ht, InteractionCreateListener as i, createOwnMessageReaction as it, Embed as j, getGuildMember as jt, hasDiscordV2Components as k, deleteChannelPermission as kt, ReadyListener as l, deleteChannel as lt, Client as m, getChannelMessage as mt, GuildCreateListener as n, createUserDmChannel as nt, MessageReactionAddListener as o, listMessageReactionUsers as ot, VoiceStateUpdateListener as p, getChannel as pt, Separator as q, GuildDeleteListener as r, getCurrentUser as rt, MessageReactionRemoveListener as s, createChannelMessage as st, discord_exports as t, createChannelWebhook as tt, ResumedListener as u, deleteChannelMessage as ut, RateLimitError as v, listChannelPins as vt, Command as w, createGuildBan as wt, readDiscordMessage as x, sendChannelTyping as xt, isUnknownDiscordVoiceStateError as y, pinChannelMessage as yt, Container as z, putChannelPermission as zt };
2834
+ export { BaseMessageInteractiveComponent as $, serializePayload as A, deleteChannelPermission as At, Container as B, putChannelPermission as Bt, withDiscordRequestAuthority as C, unpinChannelMessage as Ct, Message as D, createGuildEmoji as Dt, Guild as E, createGuildChannel as Et, RadioGroup as F, listGuildChannels as Ft, RoleSelectMenu as G, LinkButton as H, removeGuildMemberRole as Ht, TextInput as I, listGuildEmojis as It, Separator as J, Row as K, AnySelectMenu as L, listGuildRoles as Lt, CheckboxGroup as M, getGuildMember as Mt, Label as N, getGuildVoiceState as Nt, User as O, createGuildScheduledEvent as Ot, Modal as P, listGuildActiveThreads as Pt, UserSelectMenu as Q, Button as R, listGuildScheduledEvents as Rt, readRetryAfter as S, sendChannelTyping as St, CommandWithSubcommands as T, createGuildBan as Tt, MediaGallery as U, timeoutGuildMember as Ut, File as V, removeGuildMember as Vt, MentionableSelectMenu as W, TextDisplay as X, StringSelectMenu as Y, Thumbnail as Z, DiscordError as _, listChannelArchivedThreads as _t, MessageCreateListener as a, createOwnMessageReaction as at, readDiscordCode as b, pinChannelMessage as bt, PresenceUpdateListener as c, createChannelMessage as ct, ThreadDeleteListener as d, deleteChannelMessage as dt, parseCustomId as et, ThreadUpdateListener as f, editChannel as ft, RequestClient as g, getThreadMember as gt, Plugin as h, getChannelMessage as ht, InteractionCreateListener as i, getCurrentUser as it, Embed as j, getGuild as jt, hasDiscordV2Components as k, createGuildSticker as kt, ReadyListener as l, createThread as lt, Client as m, getChannel as mt, GuildCreateListener as n, createChannelWebhook as nt, MessageReactionAddListener as o, deleteOwnMessageReaction as ot, VoiceStateUpdateListener as p, editChannelMessage as pt, Section as q, GuildDeleteListener as r, createUserDmChannel as rt, MessageReactionRemoveListener as s, listMessageReactionUsers as st, discord_exports as t, stripUndefinedFields as tt, ResumedListener as u, deleteChannel as ut, RateLimitError as v, listChannelMessages as vt, Command as w, addGuildMemberRole as wt, readDiscordMessage as x, searchGuildMessages as xt, isUnknownDiscordVoiceStateError as y, listChannelPins as yt, ChannelSelectMenu as z, moveGuildChannels as zt };