@openclaw/discord 2026.11.3 → 2026.11.5-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (220) hide show
  1. package/dist/.setup/{account-inspect-8cCu6uPG.mjs → account-inspect-DGkdWwix.mjs} +1 -1
  2. package/dist/.setup/{accounts-ljrzXBJi.mjs → accounts-C_25wyxC.mjs} +9 -6
  3. package/dist/.setup/{active-turn-thread-route-C4tp9noA.mjs → active-turn-thread-route-KvRTAVE3.mjs} +1 -2
  4. package/dist/.setup/{allow-list-BKqOldGy.mjs → allow-list-BXrS8-R9.mjs} +4 -152
  5. package/dist/.setup/{api-DqmMUZau.mjs → api-BlBD4ism.mjs} +10 -20
  6. package/dist/.setup/{approval-handler.runtime-D0qu1um7.mjs → approval-handler.runtime-BGYjX1t9.mjs} +80 -61
  7. package/dist/.setup/{approval-message-updates-CdurC9Ej.mjs → approval-message-updates-DKsCfxSW.mjs} +2 -2
  8. package/dist/.setup/{audit-ChorIwio.mjs → audit-5b-FXj9R.mjs} +4 -4
  9. package/dist/.setup/{channel-ZilgdF5e.mjs → channel-CWwTHWFo.mjs} +134 -202
  10. package/dist/.setup/channel-access-9cyzozUP.mjs +24 -0
  11. package/dist/.setup/channel.setup-B3MtmBQG.mjs +238 -0
  12. package/dist/.setup/{components-Du9NhD8h.mjs → components-YCvQ6YLS.mjs} +209 -430
  13. package/dist/.setup/components.base-CiS0h_XP.mjs +32 -0
  14. package/dist/.setup/{config-schema-_uBILpQf.mjs → config-schema-BNKN1cu5.mjs} +6 -7
  15. package/dist/.setup/{conversation-binding-route-8Ul1KpGF.mjs → conversation-binding-route-kCTw8cij.mjs} +2 -2
  16. package/dist/.setup/{directory-config-3iVub-3m.mjs → directory-config-Ble81PWH.mjs} +1 -1
  17. package/dist/.setup/{directory-live-BDVl2DoC.mjs → directory-live-DH3tpS3x.mjs} +52 -57
  18. package/dist/.setup/{discord-BMD-JiVS.mjs → discord-DGVSguhx.mjs} +1124 -1710
  19. package/dist/.setup/{doctor-hQKbkNKq.mjs → doctor-eujgbnpZ.mjs} +3 -5
  20. package/dist/.setup/endpoint-runtime-lf4DeLas.mjs +139 -0
  21. package/dist/.setup/guilds-eDq22iSM.mjs +22 -0
  22. package/dist/.setup/{handle-action-B1lmt4ms.mjs → handle-action-CktwmzMz.mjs} +15 -15
  23. package/dist/.setup/{handle-action.guild-admin-B6g31cwt.mjs → handle-action.guild-admin-WLQ7fRqI.mjs} +5 -5
  24. package/dist/.setup/listeners-Df8lx3vK.mjs +47 -0
  25. package/dist/.setup/{live-policy-config-C_Q966Wh.mjs → live-policy-config-DiBVuaU6.mjs} +2 -3
  26. package/dist/.setup/{message-handler-CkI3yMjL.mjs → message-handler-hhNSioxo.mjs} +154 -115
  27. package/dist/.setup/{message-handler.preflight-CEfkFV9U.mjs → message-handler.preflight-BZcZE1o-.mjs} +30 -105
  28. package/dist/.setup/{message-handler.preflight-pluralkit-D5si80_L.mjs → message-handler.preflight-pluralkit-CYZfXXb6.mjs} +9 -22
  29. package/dist/.setup/{message-handler.process-DsMtetRf.mjs → message-handler.process-B0n-mQ99.mjs} +256 -373
  30. package/dist/.setup/outbound-payload-BaZmjewa.mjs +447 -0
  31. package/dist/.setup/{outbound-session-route-BtUpGBTb.mjs → outbound-session-route-Cgx4i9cS.mjs} +139 -86
  32. package/dist/.setup/{preflight-audio-wWgsZG5F.mjs → preflight-audio-C6QtD6HX.mjs} +1 -5
  33. package/dist/.setup/{presence-cache-DCeTsL73.mjs → presence-cache-Dq-3nH7R.mjs} +1 -6
  34. package/dist/.setup/{probe-CBaoCs-c.mjs → probe-DezB-6xz.mjs} +5 -9
  35. package/dist/.setup/{provider-CI_OLfvz.mjs → provider-BN2bCIUp.mjs} +3440 -4308
  36. package/dist/.setup/{provider-session.runtime-TWOo_JZx.mjs → provider-session.runtime-Dr_5X43t.mjs} +3 -3
  37. package/dist/.setup/provider.runtime-BuJpl0Pv.mjs +1 -0
  38. package/dist/.setup/proxy-fetch-BzXwBAXt.mjs +30 -0
  39. package/dist/.setup/{realtime-session.runtime-DvfS4vJj.mjs → realtime-session.runtime-BTDWsV4d.mjs} +44 -81
  40. package/dist/.setup/{receive-recovery-CKvaG2Hf.mjs → receive-recovery-C3Ks4wAQ.mjs} +13 -27
  41. package/dist/.setup/{resolve-allowlist-common-cIjtqh2F.mjs → resolve-allowlist-common-Bk8Fj6Ik.mjs} +3 -13
  42. package/dist/.setup/{resolve-channels-Cj5i7hzj.mjs → resolve-channels-Bp8frXvc.mjs} +7 -8
  43. package/dist/.setup/{resolve-users-BQLbysRB.mjs → resolve-users-Cvcj22sG.mjs} +4 -7
  44. package/dist/.setup/{runtime-RWnuJgWB.mjs → runtime-BJaCvlmq.mjs} +196 -239
  45. package/dist/.setup/{runtime-plifsKg9.mjs → runtime-BMgTyuwg.mjs} +6 -6
  46. package/dist/.setup/{secret-config-contract-z6FhbT8E.mjs → secret-config-contract-B1kE4sDv.mjs} +4 -9
  47. package/dist/.setup/{send-da6ENJ9f.mjs → send-CVW7V-VZ.mjs} +149 -175
  48. package/dist/.setup/{send.components-CWZUuGvA.mjs → send.components-C8YXdnO_.mjs} +59 -71
  49. package/dist/.setup/{send.outbound-qZ3iK3Vq.mjs → send.outbound-Uzcmh3Yd.mjs} +76 -129
  50. package/dist/.setup/{send.receipt-C18khRYH.mjs → send.receipt-NZDOTZBU.mjs} +30 -32
  51. package/dist/.setup/{send.shared-CnlMgoqQ.mjs → send.shared-a_6Oeyg1.mjs} +38 -115
  52. package/dist/.setup/{sender-identity-DgbJykq0.mjs → sender-identity-76HFb8eK.mjs} +3 -9
  53. package/dist/.setup/setup-plugin-api-BExhGEhL.mjs +2 -0
  54. package/dist/.setup/shared-interactive-DmzaoKOM.mjs +316 -0
  55. package/dist/.setup/{shared-CY5vJM48.mjs → shared-yDUSExm2.mjs} +8 -11
  56. package/dist/.setup/{subagent-hooks-CIu2TFz3.mjs → subagent-hooks-CDkdHQyy.mjs} +1 -1
  57. package/dist/.setup/{system-events-DCOLXkwS.mjs → system-events-yfWz150v.mjs} +2 -2
  58. package/dist/.setup/{target-resolver-CApivu3G.mjs → target-resolver-BOOzqxxM.mjs} +3 -3
  59. package/dist/.setup/{thread-bindings-DcvT_JgI.mjs → thread-bindings-zce4cpu_.mjs} +12 -20
  60. package/dist/.setup/{thread-bindings.manager-5Sh7yedN.mjs → thread-bindings.manager-NywKzUtc.mjs} +22 -42
  61. package/dist/.setup/{thread-bindings.session-updates-BMdJeJMc.mjs → thread-bindings.session-updates-D0j7oh8S.mjs} +11 -18
  62. package/dist/.setup/{threading-CzjFeUSe.mjs → threading-DodLYDt-.mjs} +68 -105
  63. package/dist/.setup/{timeouts-CuNARfyw.mjs → timeouts-cIxzatmv.mjs} +1 -1
  64. package/dist/.setup/{transcripts-source-8RDQrSVb.mjs → transcripts-source-ie9GBWaU.mjs} +110 -179
  65. package/dist/.setup/{voice-runtime-BsDILmAv.mjs → voice-runtime-B7V_LTdX.mjs} +231 -452
  66. package/dist/.source-module-urls/d6c089460280c5a04184542d6712e04545caeb1ebb290d3504377b4cc5e22fea.json +1 -0
  67. package/dist/account-inspect-api.js +1 -1
  68. package/dist/action-runtime-api.js +1 -2
  69. package/dist/activities-api.js +286 -341
  70. package/dist/api.js +16 -16
  71. package/dist/channel-config-api.js +1 -2
  72. package/dist/channel-plugin-api.js +1 -2
  73. package/dist/contract-api.js +1 -2
  74. package/dist/directory-contract-api.js +1 -1
  75. package/dist/runtime-api.js +22 -22
  76. package/dist/runtime-setter-api.js +1 -2
  77. package/dist/secret-contract-api.js +1 -2
  78. package/dist/security-audit-contract-api.js +1 -2
  79. package/dist/security-contract-api.js +1 -2
  80. package/dist/session-key-api.js +1 -2
  81. package/dist/setup-entry.js +1 -1
  82. package/dist/setup-plugin-api.js +1 -2
  83. package/dist/src/voice/audio-worker.runtime.js +56 -68
  84. package/dist/subagent-hooks-api.js +1 -1
  85. package/dist/thread-binding-api.js +1 -2
  86. package/dist/transcripts-source-api.js +1 -1
  87. package/node_modules/@napi-rs/wasm-runtime/dist/fs.js +3339 -4021
  88. package/node_modules/@napi-rs/wasm-runtime/package.json +1 -1
  89. package/node_modules/@types/lodash/README.md +1 -1
  90. package/node_modules/@types/lodash/common/function.d.ts +2 -2
  91. package/node_modules/@types/lodash/package.json +2 -2
  92. package/node_modules/@types/node/README.md +1 -1
  93. package/node_modules/@types/node/package.json +2 -2
  94. package/node_modules/@types/node/util.d.ts +6 -3
  95. package/node_modules/discord-api-types/package.json +4 -4
  96. package/node_modules/discord-api-types/rest/v10/index.d.ts +8 -0
  97. package/node_modules/discord-api-types/rest/v10/index.d.ts.map +1 -1
  98. package/node_modules/discord-api-types/rest/v10/index.js +8 -0
  99. package/node_modules/discord-api-types/rest/v10/index.js.map +1 -1
  100. package/node_modules/discord-api-types/rest/v10/oauth2.d.ts +26 -2
  101. package/node_modules/discord-api-types/rest/v10/oauth2.d.ts.map +1 -1
  102. package/node_modules/discord-api-types/rest/v9/index.d.ts +8 -0
  103. package/node_modules/discord-api-types/rest/v9/index.d.ts.map +1 -1
  104. package/node_modules/discord-api-types/rest/v9/index.js +8 -0
  105. package/node_modules/discord-api-types/rest/v9/index.js.map +1 -1
  106. package/node_modules/discord-api-types/rest/v9/oauth2.d.ts +26 -2
  107. package/node_modules/discord-api-types/rest/v9/oauth2.d.ts.map +1 -1
  108. package/node_modules/typebox/build/format/duration.d.mts +2 -2
  109. package/node_modules/typebox/build/format/duration.mjs +2 -2
  110. package/node_modules/typebox/build/format/idn_email.d.mts +1 -0
  111. package/node_modules/typebox/build/format/idn_email.mjs +1 -0
  112. package/node_modules/typebox/build/format/idn_hostname.d.mts +1 -1
  113. package/node_modules/typebox/build/format/idn_hostname.mjs +1 -1
  114. package/node_modules/typebox/build/format/ipv4.d.mts +2 -2
  115. package/node_modules/typebox/build/format/ipv4.mjs +2 -2
  116. package/node_modules/typebox/build/format/ipv6.d.mts +1 -1
  117. package/node_modules/typebox/build/format/ipv6.mjs +1 -1
  118. package/node_modules/typebox/build/format/relative_json_pointer.d.mts +2 -2
  119. package/node_modules/typebox/build/format/relative_json_pointer.mjs +2 -2
  120. package/node_modules/typebox/build/schema/build.mjs +1 -0
  121. package/node_modules/typebox/build/schema/engine/_unique.d.mts +4 -2
  122. package/node_modules/typebox/build/schema/engine/_unique.mjs +7 -3
  123. package/node_modules/typebox/build/schema/engine/additionalItems.mjs +3 -3
  124. package/node_modules/typebox/build/schema/engine/additionalProperties.d.mts +0 -3
  125. package/node_modules/typebox/build/schema/engine/additionalProperties.mjs +15 -17
  126. package/node_modules/typebox/build/schema/engine/contains.mjs +3 -3
  127. package/node_modules/typebox/build/schema/engine/index.d.mts +1 -0
  128. package/node_modules/typebox/build/schema/engine/index.mjs +1 -0
  129. package/node_modules/typebox/build/schema/engine/items.mjs +7 -4
  130. package/node_modules/typebox/build/schema/engine/maxContains.mjs +2 -2
  131. package/node_modules/typebox/build/schema/engine/minContains.mjs +3 -3
  132. package/node_modules/typebox/build/schema/engine/oneOf.mjs +2 -2
  133. package/node_modules/typebox/build/schema/engine/patternProperties.mjs +2 -2
  134. package/node_modules/typebox/build/schema/engine/propertyNames.mjs +2 -2
  135. package/node_modules/typebox/build/schema/engine/unevaluatedItems.mjs +2 -2
  136. package/node_modules/typebox/build/schema/engine/unevaluatedProperties.mjs +2 -2
  137. package/node_modules/typebox/build/system/hashing/hash.mjs +63 -34
  138. package/node_modules/typebox/build/system/locale/en_US.mjs +2 -1
  139. package/node_modules/typebox/build/system/memory/assign.d.mts +2 -8
  140. package/node_modules/typebox/build/system/memory/assign.mjs +13 -6
  141. package/node_modules/typebox/build/system/memory/clone.d.mts +4 -5
  142. package/node_modules/typebox/build/system/memory/clone.mjs +8 -96
  143. package/node_modules/typebox/build/system/memory/create.d.mts +1 -5
  144. package/node_modules/typebox/build/system/memory/create.mjs +18 -13
  145. package/node_modules/typebox/build/system/memory/deep.d.mts +2 -0
  146. package/node_modules/typebox/build/system/memory/deep.mjs +108 -0
  147. package/node_modules/typebox/build/system/memory/discard.d.mts +1 -1
  148. package/node_modules/typebox/build/system/memory/discard.mjs +9 -8
  149. package/node_modules/typebox/build/system/memory/finalize.d.mts +4 -0
  150. package/node_modules/typebox/build/system/memory/finalize.mjs +30 -0
  151. package/node_modules/typebox/build/system/memory/keys.d.mts +2 -0
  152. package/node_modules/typebox/build/system/memory/keys.mjs +8 -0
  153. package/node_modules/typebox/build/system/memory/update.d.mts +1 -4
  154. package/node_modules/typebox/build/system/memory/update.mjs +43 -16
  155. package/node_modules/typebox/build/type/engine/call/index.d.mts +1 -0
  156. package/node_modules/typebox/build/type/engine/call/index.mjs +1 -0
  157. package/node_modules/typebox/build/type/engine/evaluate/composite.d.mts +2 -24
  158. package/node_modules/typebox/build/type/engine/evaluate/composite.mjs +2 -29
  159. package/node_modules/typebox/build/type/engine/evaluate/index.d.mts +1 -0
  160. package/node_modules/typebox/build/type/engine/evaluate/index.mjs +1 -0
  161. package/node_modules/typebox/build/type/engine/evaluate/narrow.d.mts +5 -1
  162. package/node_modules/typebox/build/type/engine/evaluate/narrow.mjs +6 -1
  163. package/node_modules/typebox/build/type/engine/evaluate/property.d.mts +30 -0
  164. package/node_modules/typebox/build/type/engine/evaluate/property.mjs +29 -0
  165. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.d.mts +1 -3
  166. package/node_modules/typebox/build/type/engine/immutable/instantiate_add.mjs +1 -4
  167. package/node_modules/typebox/build/type/engine/object/from_intersect.d.mts +2 -2
  168. package/node_modules/typebox/build/type/engine/object/from_intersect.mjs +2 -2
  169. package/node_modules/typebox/build/type/engine/object/from_union.d.mts +2 -2
  170. package/node_modules/typebox/build/type/engine/object/from_union.mjs +2 -2
  171. package/node_modules/typebox/build/type/engine/optional/instantiate_add.d.mts +1 -3
  172. package/node_modules/typebox/build/type/engine/optional/instantiate_add.mjs +1 -4
  173. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.d.mts +1 -3
  174. package/node_modules/typebox/build/type/engine/readonly/instantiate_add.mjs +1 -4
  175. package/node_modules/typebox/build/type/engine/this/index.d.mts +1 -0
  176. package/node_modules/typebox/build/type/engine/this/index.mjs +1 -0
  177. package/node_modules/typebox/build/value/clone/clone.d.mts +4 -3
  178. package/node_modules/typebox/build/value/clone/clone.mjs +5 -7
  179. package/node_modules/typebox/build/value/repair/from_cyclic.d.mts +2 -0
  180. package/node_modules/typebox/build/value/repair/from_cyclic.mjs +6 -0
  181. package/node_modules/typebox/build/value/shared/union_priority_sort.mjs +25 -14
  182. package/node_modules/typebox/package.json +1 -1
  183. package/node_modules/typebox/readme.md +1 -1
  184. package/node_modules/undici/docs/docs/api/Interceptors.md +15 -2
  185. package/node_modules/undici/lib/dispatcher/client-h2.js +78 -3
  186. package/node_modules/undici/lib/dispatcher/pool-base.js +20 -3
  187. package/node_modules/undici/package.json +3 -3
  188. package/node_modules/undici/types/api.d.ts +1 -1
  189. package/node_modules/undici/types/utility.d.ts +4 -4
  190. package/node_modules/uuid/package.json +17 -17
  191. package/node_modules/zod/package.json +1 -1
  192. package/node_modules/zod/src/v4/classic/tests/array.test.ts +27 -0
  193. package/node_modules/zod/src/v4/classic/tests/map.test.ts +7 -0
  194. package/node_modules/zod/src/v4/classic/tests/set.test.ts +6 -0
  195. package/node_modules/zod/src/v4/core/compile.ts +9 -0
  196. package/node_modules/zod/src/v4/core/schemas.ts +35 -1
  197. package/node_modules/zod/src/v4/core/util.ts +13 -0
  198. package/node_modules/zod/src/v4/core/versions.ts +1 -1
  199. package/node_modules/zod/v4/core/compile.cjs +8 -0
  200. package/node_modules/zod/v4/core/compile.js +8 -0
  201. package/node_modules/zod/v4/core/schemas.cjs +30 -0
  202. package/node_modules/zod/v4/core/schemas.d.cts +3 -1
  203. package/node_modules/zod/v4/core/schemas.d.ts +3 -1
  204. package/node_modules/zod/v4/core/schemas.js +30 -0
  205. package/node_modules/zod/v4/core/util.cjs +15 -0
  206. package/node_modules/zod/v4/core/util.d.cts +2 -0
  207. package/node_modules/zod/v4/core/util.d.ts +2 -0
  208. package/node_modules/zod/v4/core/util.js +14 -0
  209. package/node_modules/zod/v4/core/versions.cjs +1 -1
  210. package/node_modules/zod/v4/core/versions.js +1 -1
  211. package/openclaw.plugin.json +1 -31
  212. package/package.json +8 -8
  213. package/dist/.setup/channel-access-DasWY_OV.mjs +0 -48
  214. package/dist/.setup/channel.setup-DaDQdctj.mjs +0 -249
  215. package/dist/.setup/outbound-adapter-DfAanoCO.mjs +0 -543
  216. package/dist/.setup/provider.runtime-DnionCyo.mjs +0 -2
  217. package/dist/.setup/setup-plugin-api-D1QuM187.mjs +0 -3
  218. package/dist/.setup/targets-UWWZ6gF7.mjs +0 -3
  219. package/node_modules/typebox/build/system/memory/freeze.d.mts +0 -4
  220. package/node_modules/typebox/build/system/memory/freeze.mjs +0 -6
@@ -1,6 +1,7 @@
1
1
  import { t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- import { r as fetchDiscord, t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-DqmMUZau.mjs";
3
- import { i as listGuilds, n as parseDiscordAllowlistInput, r as resolveDiscordAllowlistToken, t as filterDiscordGuilds } from "./resolve-allowlist-common-cIjtqh2F.mjs";
2
+ import { t as DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS } from "./api-BlBD4ism.mjs";
3
+ import { n as listGuilds, r as searchDiscordGuildMembers } from "./guilds-eDq22iSM.mjs";
4
+ import { n as parseDiscordAllowlistInput, r as resolveDiscordAllowlistToken, t as filterDiscordGuilds } from "./resolve-allowlist-common-Bk8Fj6Ik.mjs";
4
5
  import { normalizeOptionalLowercaseString, normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
5
6
  //#region extensions/discord/src/resolve-users.ts
6
7
  var resolve_users_exports = /* @__PURE__ */ __exportAll({ resolveDiscordUserAllowlist: () => resolveDiscordUserAllowlist });
@@ -50,11 +51,7 @@ async function resolveDiscordUserAllowlist(params) {
50
51
  let best = null;
51
52
  let matches = 0;
52
53
  for (const guild of guildList) {
53
- const paramsObj = new URLSearchParams({
54
- query,
55
- limit: "25"
56
- });
57
- const members = await fetchDiscord(`/guilds/${guild.id}/members/search?${paramsObj.toString()}`, token, fetcher, { timeoutMs: DISCORD_DIRECTORY_LOOKUP_TIMEOUT_MS });
54
+ const members = await searchDiscordGuildMembers(token, fetcher, guild.id, query, 25);
58
55
  for (const member of members) {
59
56
  const score = scoreDiscordMember(member, query);
60
57
  if (score === 0) continue;
@@ -1,14 +1,13 @@
1
- import { c as resolveDefaultDiscordAccountId, s as mergeDiscordAccountConfig, t as createDiscordActionGate } from "./accounts-ljrzXBJi.mjs";
2
- import { A as isDiscordThreadChannelType, l as resolveDiscordChannelConfigWithFallback, n as hasConfiguredDiscordChannels, o as normalizeDiscordSlug, r as isDiscordGroupAllowedByPolicy, y as resolveGroupDmAllow } from "./allow-list-BKqOldGy.mjs";
3
- import { C as hasAnyChannelPermissionDiscord, F as createDiscordRuntimeAccountContext, U as getGateway, _ as canManageGuildMemberRoleDiscord, b as fetchChannelPermissionsDiscord, n as buildDiscordTextChunks, u as resolveDiscordTargetChannelId, v as canManageGuildRoleDiscord, w as hasAnyGuildPermissionDiscord, y as canViewDiscordGuildChannel } from "./send.shared-CnlMgoqQ.mjs";
4
- import { n as getPresence } from "./presence-cache-DCeTsL73.mjs";
5
- import { a as createReusableDiscordReplyReference, s as resolveDiscordReplyReference } from "./send.receipt-C18khRYH.mjs";
1
+ import { c as resolveDefaultDiscordAccountId, s as mergeDiscordAccountConfig, t as createDiscordActionGate } from "./accounts-C_25wyxC.mjs";
2
+ import { C as hasAnyChannelPermissionDiscord, P as createDiscordRuntimeAccountContext, R as getGateway, _ as canManageGuildMemberRoleDiscord, b as fetchChannelPermissionsDiscord, n as buildDiscordTextChunks, u as resolveDiscordTargetChannelId, v as canManageGuildRoleDiscord, w as hasAnyGuildPermissionDiscord, y as canViewDiscordGuildChannel } from "./send.shared-a_6Oeyg1.mjs";
3
+ import { l as resolveDiscordChannelConfigWithFallback, n as hasConfiguredDiscordChannels, o as normalizeDiscordSlug, r as isDiscordGroupAllowedByPolicy, w as isDiscordThreadChannelType, y as resolveGroupDmAllow } from "./allow-list-BXrS8-R9.mjs";
4
+ import { f as resolveDiscordReplyReference, u as createReusableDiscordReplyReference } from "./send.receipt-NZDOTZBU.mjs";
6
5
  import { n as resolveDiscordChannelId, t as parseDiscordTarget } from "./target-parsing-C-HyNxcE.mjs";
7
- 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, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, l as DiscordThreadInitialMessageError, m as listPinsDiscord, n as fetchReactionsDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, w as fetchGuildInfoDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-da6ENJ9f.mjs";
8
- import { r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-qZ3iK3Vq.mjs";
9
- import "./targets-UWWZ6gF7.mjs";
10
- import { h as readDiscordComponentSpec, m as coerceDiscordComponentParam } from "./components-Du9NhD8h.mjs";
11
- import { r as sendDiscordComponentMessage } from "./send.components-CWZUuGvA.mjs";
6
+ 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, d as deleteMessageDiscord, f as editMessageDiscord, g as pinMessageDiscord, h as listThreadsDiscord, i as removeOwnReactionsDiscord, j as removeRoleDiscord, k as listGuildChannelsDiscord, l as DiscordThreadInitialMessageError, m as listPinsDiscord, n as fetchReactionsDiscord, p as fetchMessageDiscord, r as reactMessageDiscord, s as sendVoiceMessageDiscord, u as createThreadDiscord, v as searchMessagesDiscord, w as fetchGuildInfoDiscord, x as banMemberDiscord, y as unpinMessageDiscord, z as editChannelDiscord } from "./send-CVW7V-VZ.mjs";
7
+ import { r as sendStickerDiscord, t as sendMessageDiscord } from "./send.outbound-Uzcmh3Yd.mjs";
8
+ import { n as getPresence } from "./presence-cache-Dq-3nH7R.mjs";
9
+ import { c as coerceDiscordComponentParam, l as readDiscordComponentSpec } from "./components-YCvQ6YLS.mjs";
10
+ import { r as sendDiscordComponentMessage } from "./send.components-C8YXdnO_.mjs";
12
11
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
13
12
  import { asBoolean, asOptionalRecord, isRecord, normalizeLowercaseStringOrEmpty } from "openclaw/plugin-sdk/string-coerce-runtime";
14
13
  import { assertMediaNotDataUrl, jsonResult, parseAvailableTags, readNonNegativeIntegerParam, readPositiveIntegerParam, readReactionParams, readStringArrayParam, readStringParam, withNormalizedTimestamp } from "openclaw/plugin-sdk/channel-actions";
@@ -315,7 +314,8 @@ function createDiscordMessagingActionContext(params) {
315
314
  });
316
315
  const guildNameById = /* @__PURE__ */ new Map();
317
316
  const resolveGuildName = async (guildId) => {
318
- if (guildNameById.has(guildId)) return guildNameById.get(guildId) ?? null;
317
+ const cached = guildNameById.get(guildId);
318
+ if (cached !== void 0) return cached;
319
319
  try {
320
320
  const guildName = readDiscordChannelStringField(await fetchGuildInfoDiscord(guildId, withOpts()), "name") ?? null;
321
321
  guildNameById.set(guildId, guildName);
@@ -569,7 +569,7 @@ async function resolveGuildIdForGuildAdminAction(params) {
569
569
  cfg: params.cfg,
570
570
  accountId: params.accountId
571
571
  }));
572
- return "guild_id" in channel ? channel.guild_id ?? void 0 : void 0;
572
+ return "guild_id" in channel ? channel.guild_id : void 0;
573
573
  }
574
574
  async function resolveGuildAdminActionPermissions(params) {
575
575
  if (params.action !== "channelEdit") return params.guard.permissions;
@@ -617,7 +617,6 @@ async function verifySenderGuildAdminPermission(params) {
617
617
  }
618
618
  async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, options) {
619
619
  const accountId = readStringParam(params, "accountId");
620
- if (!cfg) throw new Error("Discord guild actions require a resolved runtime config.");
621
620
  const assertActionEnabled = () => {
622
621
  const guard = guildActionGuards[action];
623
622
  if (guard && !isActionEnabled(guard.gate, guard.defaultEnabled)) throw new Error(guard.disabledMessage);
@@ -674,8 +673,8 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
674
673
  accountId: effectiveAccountId
675
674
  }));
676
675
  const presence = getPresence(effectiveAccountId, userId);
677
- const activities = presence?.activities ?? void 0;
678
- const status = presence?.status ?? void 0;
676
+ const activities = presence?.activities;
677
+ const status = presence?.status;
679
678
  return jsonResult({
680
679
  ok: true,
681
680
  member,
@@ -867,8 +866,8 @@ async function handleDiscordGuildAction(action, params, isActionEnabled, cfg, op
867
866
  channelId,
868
867
  targetId,
869
868
  targetType,
870
- allow: allow ?? void 0,
871
- deny: deny ?? void 0
869
+ allow,
870
+ deny
872
871
  }, withOpts());
873
872
  return jsonResult({ ok: true });
874
873
  }
@@ -1017,8 +1016,7 @@ async function handleDiscordMessageManagementAction(ctx) {
1017
1016
  authorIds: authorIdList.length ? authorIdList : void 0,
1018
1017
  limit
1019
1018
  }, ctx.withOpts());
1020
- const messages = results.messages;
1021
- const normalizedMessages = Array.isArray(messages) ? messages.map((group) => Array.isArray(group) ? group.map((msg) => ctx.normalizeMessage(msg)) : group) : messages;
1019
+ const normalizedMessages = results.messages.map((group) => Array.isArray(group) ? group.map((msg) => ctx.normalizeMessage(msg)) : group);
1022
1020
  return jsonResult({
1023
1021
  ok: true,
1024
1022
  results: {
@@ -1031,38 +1029,6 @@ async function handleDiscordMessageManagementAction(ctx) {
1031
1029
  }
1032
1030
  }
1033
1031
  //#endregion
1034
- //#region extensions/discord/src/actions/runtime.messaging.reactions.ts
1035
- async function handleDiscordReactionMessagingAction(ctx) {
1036
- const action = ctx.action;
1037
- if (action !== "react" && action !== "reactions") return;
1038
- if (!ctx.isActionEnabled("reactions")) throw new Error("Discord reactions are disabled.");
1039
- const channelId = await ctx.resolveReactionChannelId();
1040
- const messageId = readStringParam(ctx.params, "messageId", { required: true });
1041
- if (action === "reactions") {
1042
- const limit = readPositiveIntegerParam(ctx.params, "limit");
1043
- await ctx.assertReadTargetAllowed({ channelId });
1044
- const reactions = await fetchReactionsDiscord(channelId, messageId, ctx.withReactionRuntimeOptions({ limit }));
1045
- return jsonResult({
1046
- ok: true,
1047
- reactions
1048
- });
1049
- }
1050
- const { emoji, remove, isEmpty } = readReactionParams(ctx.params, { removeErrorMessage: "Emoji is required to remove a Discord reaction." });
1051
- await ctx.assertReadTargetAllowed({ channelId });
1052
- if (isEmpty) {
1053
- const removed = await removeOwnReactionsDiscord(channelId, messageId, ctx.withReactionRuntimeOptions());
1054
- return jsonResult({
1055
- ok: true,
1056
- removed: removed.removed
1057
- });
1058
- }
1059
- await (remove ? removeReactionDiscord : reactMessageDiscord)(channelId, messageId, emoji, ctx.withReactionRuntimeOptions());
1060
- return jsonResult({
1061
- ok: true,
1062
- [remove ? "removed" : "added"]: emoji
1063
- });
1064
- }
1065
- //#endregion
1066
1032
  //#region extensions/discord/src/actions/runtime.messaging.send.ts
1067
1033
  function resolveActionReplyReference(ctx, replyToId) {
1068
1034
  const reply = ctx.options?.reply;
@@ -1072,65 +1038,6 @@ function resolveActionReplyReference(ctx, replyToId) {
1072
1038
  replyToMode: reply.source === "implicit" ? reply.mode : void 0
1073
1039
  }) : createReusableDiscordReplyReference(replyToId);
1074
1040
  }
1075
- function normalizeDiscordThreadListActionResult(params) {
1076
- const record = asOptionalRecord(params.value);
1077
- const threadItems = Array.isArray(record?.threads) ? record.threads : [];
1078
- const hasMore = record?.has_more === true;
1079
- const archiveTimestamp = params.includeArchived && hasMore ? asOptionalRecord(asOptionalRecord(threadItems[threadItems.length - 1])?.thread_metadata)?.archive_timestamp : void 0;
1080
- const nextBefore = typeof archiveTimestamp === "string" && archiveTimestamp.trim() ? archiveTimestamp : void 0;
1081
- return {
1082
- ok: true,
1083
- threads: params.value,
1084
- complete: !hasMore,
1085
- hasMore,
1086
- returnedCount: threadItems.length,
1087
- source: params.includeArchived ? "discord.threadList.archived" : "discord.threadList.active",
1088
- query: {
1089
- guildId: params.guildId,
1090
- ...params.channelId ? { channelId: params.channelId } : {},
1091
- includeArchived: params.includeArchived,
1092
- ...params.before ? { before: params.before } : {},
1093
- ...params.limit !== void 0 ? { limit: params.limit } : {}
1094
- },
1095
- ...nextBefore ? { nextBefore } : {}
1096
- };
1097
- }
1098
- async function appendDiscordThreadRenameResult(ctx, params) {
1099
- const threadName = params.threadName;
1100
- if (!threadName) return params.payload;
1101
- const ignored = (reason) => ({
1102
- ...params.payload,
1103
- warning: `Discord threadName was ignored because ${reason}.`
1104
- });
1105
- if (!ctx.isActionEnabled("channels")) return ignored("Discord channel management is disabled");
1106
- let channelId;
1107
- try {
1108
- channelId = resolveDiscordChannelId(params.target);
1109
- } catch {
1110
- return ignored("the send target is not a channel/thread");
1111
- }
1112
- try {
1113
- const channel = await fetchChannelInfoDiscord(channelId, ctx.withOpts());
1114
- if (!isDiscordThreadChannelType(channel.type)) return ignored("the send target is not a thread");
1115
- const renamed = await editChannelDiscord({
1116
- channelId,
1117
- name: threadName
1118
- }, ctx.withOpts());
1119
- return {
1120
- ...params.payload,
1121
- threadRename: {
1122
- ok: true,
1123
- channelId,
1124
- name: renamed.name ?? threadName
1125
- }
1126
- };
1127
- } catch (error) {
1128
- return {
1129
- ...params.payload,
1130
- warning: `Discord message was sent, but thread rename failed: ${formatErrorMessage(error)}`
1131
- };
1132
- }
1133
- }
1134
1041
  async function handleDiscordMessageSendAction(ctx) {
1135
1042
  switch (ctx.action) {
1136
1043
  case "sticker": {
@@ -1211,15 +1118,45 @@ async function handleDiscordMessageSendAction(ctx) {
1211
1118
  embeds,
1212
1119
  ...suppressEmbeds === void 0 ? {} : { suppressEmbeds }
1213
1120
  });
1214
- return jsonResult(await appendDiscordThreadRenameResult(ctx, {
1215
- payload: {
1216
- ok: true,
1217
- result,
1218
- ...componentSpec ? { components: true } : asVoice ? { voiceMessage: true } : {}
1219
- },
1220
- target: asVoice ? to : result.receipt?.threadId ?? to,
1221
- threadName
1222
- }));
1121
+ const payload = {
1122
+ ok: true,
1123
+ result,
1124
+ ...componentSpec ? { components: true } : asVoice ? { voiceMessage: true } : {}
1125
+ };
1126
+ const target = asVoice ? to : result.receipt?.threadId ?? to;
1127
+ if (!threadName) return jsonResult(payload);
1128
+ const ignored = (reason) => jsonResult({
1129
+ ...payload,
1130
+ warning: `Discord threadName was ignored because ${reason}.`
1131
+ });
1132
+ if (!ctx.isActionEnabled("channels")) return ignored("Discord channel management is disabled");
1133
+ let channelId;
1134
+ try {
1135
+ channelId = resolveDiscordChannelId(target);
1136
+ } catch {
1137
+ return ignored("the send target is not a channel/thread");
1138
+ }
1139
+ try {
1140
+ const channel = await fetchChannelInfoDiscord(channelId, ctx.withOpts());
1141
+ if (!isDiscordThreadChannelType(channel.type)) return ignored("the send target is not a thread");
1142
+ const renamed = await editChannelDiscord({
1143
+ channelId,
1144
+ name: threadName
1145
+ }, ctx.withOpts());
1146
+ return jsonResult({
1147
+ ...payload,
1148
+ threadRename: {
1149
+ ok: true,
1150
+ channelId,
1151
+ name: renamed.name ?? threadName
1152
+ }
1153
+ });
1154
+ } catch (error) {
1155
+ return jsonResult({
1156
+ ...payload,
1157
+ warning: `Discord message was sent, but thread rename failed: ${formatErrorMessage(error)}`
1158
+ });
1159
+ }
1223
1160
  }
1224
1161
  case "threadCreate": {
1225
1162
  if (!ctx.isActionEnabled("threads")) throw new Error("Discord threads are disabled.");
@@ -1232,7 +1169,7 @@ async function handleDiscordMessageSendAction(ctx) {
1232
1169
  messageId,
1233
1170
  autoArchiveMinutes: readDiscordAutoArchiveDurationParam(ctx.params, "autoArchiveMinutes"),
1234
1171
  content,
1235
- appliedTags: readStringArrayParam(ctx.params, "appliedTags") ?? void 0
1172
+ appliedTags: readStringArrayParam(ctx.params, "appliedTags")
1236
1173
  };
1237
1174
  try {
1238
1175
  const { initialMessageDelivery, ...thread } = await createThreadDiscord(channelId, payload, ctx.withOpts());
@@ -1276,24 +1213,40 @@ async function handleDiscordMessageSendAction(ctx) {
1276
1213
  guildId,
1277
1214
  channelTargetRequiredMessage: "Discord active thread lists require a wildcard channel allowlist so each read target can be authorized."
1278
1215
  });
1279
- const query = {
1216
+ const response = await listThreadsDiscord({
1280
1217
  guildId,
1281
1218
  channelId,
1282
1219
  includeArchived,
1283
1220
  before,
1284
1221
  limit
1285
- };
1286
- const response = await listThreadsDiscord(query, ctx.withOpts());
1222
+ }, ctx.withOpts());
1287
1223
  const threads = channelId && includeArchived !== true ? await ctx.filterActiveThreadList({
1288
1224
  guildId,
1289
1225
  channelId,
1290
1226
  value: response
1291
1227
  }) : response;
1292
- return jsonResult(normalizeDiscordThreadListActionResult({
1293
- value: threads,
1294
- ...query,
1295
- includeArchived: includeArchived === true
1296
- }));
1228
+ const archived = includeArchived === true;
1229
+ const record = asOptionalRecord(threads);
1230
+ const threadItems = Array.isArray(record?.threads) ? record.threads : [];
1231
+ const hasMore = record?.has_more === true;
1232
+ const archiveTimestamp = archived && hasMore ? asOptionalRecord(asOptionalRecord(threadItems[threadItems.length - 1])?.thread_metadata)?.archive_timestamp : void 0;
1233
+ const nextBefore = typeof archiveTimestamp === "string" && archiveTimestamp.trim() ? archiveTimestamp : void 0;
1234
+ return jsonResult({
1235
+ ok: true,
1236
+ threads,
1237
+ complete: !hasMore,
1238
+ hasMore,
1239
+ returnedCount: threadItems.length,
1240
+ source: archived ? "discord.threadList.archived" : "discord.threadList.active",
1241
+ query: {
1242
+ guildId,
1243
+ ...channelId ? { channelId } : {},
1244
+ includeArchived: archived,
1245
+ ...before ? { before } : {},
1246
+ ...limit !== void 0 ? { limit } : {}
1247
+ },
1248
+ ...nextBefore ? { nextBefore } : {}
1249
+ });
1297
1250
  }
1298
1251
  case "threadReply": {
1299
1252
  if (!ctx.isActionEnabled("threads")) throw new Error("Discord threads are disabled.");
@@ -1322,21 +1275,6 @@ async function handleDiscordMessageSendAction(ctx) {
1322
1275
  }
1323
1276
  }
1324
1277
  //#endregion
1325
- //#region extensions/discord/src/actions/runtime.messaging.ts
1326
- async function handleDiscordMessagingAction(action, params, isActionEnabled, cfg, options) {
1327
- if (!cfg) throw new Error("Discord messaging actions require a resolved runtime config.");
1328
- const ctx = createDiscordMessagingActionContext({
1329
- action,
1330
- input: params,
1331
- isActionEnabled,
1332
- cfg,
1333
- options
1334
- });
1335
- const result = await handleDiscordReactionMessagingAction(ctx) ?? await handleDiscordMessageSendAction(ctx) ?? await handleDiscordMessageManagementAction(ctx);
1336
- if (result == null) throw new Error(`Unknown action: ${action}`);
1337
- return result;
1338
- }
1339
- //#endregion
1340
1278
  //#region extensions/discord/src/actions/runtime.moderation-shared.ts
1341
1279
  const moderationPermissions = {
1342
1280
  timeout: PermissionFlagsBits.ModerateMembers,
@@ -1365,47 +1303,7 @@ function readDiscordModerationCommand(action, params) {
1365
1303
  };
1366
1304
  }
1367
1305
  //#endregion
1368
- //#region extensions/discord/src/actions/runtime.moderation.ts
1369
- async function handleDiscordModerationAction(action, params, isActionEnabled, cfg) {
1370
- if (!isDiscordModerationAction(action)) throw new Error(`Unknown action: ${action}`);
1371
- if (!isActionEnabled("moderation", false)) throw new Error("Discord moderation is disabled.");
1372
- if (!cfg) throw new Error("Discord moderation actions require a resolved runtime config.");
1373
- const accountId = readStringParam(params, "accountId");
1374
- const command = readDiscordModerationCommand(action, params);
1375
- const senderUserId = readStringParam(params, "senderUserId");
1376
- const withOpts = () => createDiscordActionOptions({
1377
- cfg,
1378
- accountId
1379
- });
1380
- if (!await (senderUserId ? hasAnyGuildPermissionDiscord(command.guildId, senderUserId, [requiredGuildPermissionForModerationAction(command.action)], withOpts()) : true)) throw new Error("Sender does not have required permissions for this moderation action.");
1381
- const target = {
1382
- guildId: command.guildId,
1383
- userId: command.userId,
1384
- reason: command.reason
1385
- };
1386
- if (command.action === "timeout") {
1387
- const member = await timeoutMemberDiscord({
1388
- ...target,
1389
- durationMinutes: command.durationMinutes,
1390
- until: command.until
1391
- }, withOpts());
1392
- return jsonResult({
1393
- ok: true,
1394
- member
1395
- });
1396
- }
1397
- if (command.action === "kick") {
1398
- await kickMemberDiscord(target, withOpts());
1399
- return jsonResult({ ok: true });
1400
- }
1401
- await banMemberDiscord({
1402
- ...target,
1403
- deleteMessageDays: command.deleteMessageDays
1404
- }, withOpts());
1405
- return jsonResult({ ok: true });
1406
- }
1407
- //#endregion
1408
- //#region extensions/discord/src/actions/runtime.presence.ts
1306
+ //#region extensions/discord/src/actions/runtime.ts
1409
1307
  const ACTIVITY_TYPE_MAP = /* @__PURE__ */ new Map([
1410
1308
  ["playing", 0],
1411
1309
  ["streaming", 1],
@@ -1414,58 +1312,6 @@ const ACTIVITY_TYPE_MAP = /* @__PURE__ */ new Map([
1414
1312
  ["custom", 4],
1415
1313
  ["competing", 5]
1416
1314
  ]);
1417
- const VALID_STATUSES = /* @__PURE__ */ new Set([
1418
- "online",
1419
- "dnd",
1420
- "idle",
1421
- "invisible"
1422
- ]);
1423
- async function handleDiscordPresenceAction(action, params, isActionEnabled, cfg) {
1424
- if (action !== "setPresence") throw new Error(`Unknown presence action: ${action}`);
1425
- if (!isActionEnabled("presence", false)) throw new Error("Discord presence changes are disabled.");
1426
- const accountId = readStringParam(params, "accountId") ?? resolveDefaultDiscordAccountId(cfg);
1427
- const gateway = getGateway(accountId);
1428
- if (!gateway) throw new Error(`Discord gateway not available for account "${accountId}". The bot may not be connected.`);
1429
- if (!gateway.isConnected) throw new Error(`Discord gateway is not connected for account "${accountId}".`);
1430
- const statusRaw = readStringParam(params, "status") ?? "online";
1431
- if (!VALID_STATUSES.has(statusRaw)) throw new Error(`Invalid status "${statusRaw}". Must be one of: ${[...VALID_STATUSES].join(", ")}`);
1432
- const status = statusRaw;
1433
- const activityTypeRaw = readStringParam(params, "activityType");
1434
- const activityName = readStringParam(params, "activityName");
1435
- const activities = [];
1436
- if (activityTypeRaw || activityName) {
1437
- if (!activityTypeRaw) throw new Error(`activityType is required when activityName is provided. Valid types: ${[...ACTIVITY_TYPE_MAP.keys()].join(", ")}`);
1438
- const typeNum = ACTIVITY_TYPE_MAP.get(normalizeLowercaseStringOrEmpty(activityTypeRaw));
1439
- if (typeNum === void 0) throw new Error(`Invalid activityType "${activityTypeRaw}". Must be one of: ${[...ACTIVITY_TYPE_MAP.keys()].join(", ")}`);
1440
- const activity = {
1441
- name: activityName ?? "",
1442
- type: typeNum
1443
- };
1444
- if (typeNum === 1) {
1445
- const url = readStringParam(params, "activityUrl");
1446
- if (url) activity.url = url;
1447
- }
1448
- const state = readStringParam(params, "activityState");
1449
- if (state) activity.state = state;
1450
- activities.push(activity);
1451
- }
1452
- gateway.updatePresence({
1453
- since: null,
1454
- activities,
1455
- status,
1456
- afk: false
1457
- });
1458
- return jsonResult({
1459
- ok: true,
1460
- status,
1461
- activities: activities.map((a) => Object.assign({
1462
- type: a.type,
1463
- name: a.name
1464
- }, a.url ? { url: a.url } : {}, a.state ? { state: a.state } : {}))
1465
- });
1466
- }
1467
- //#endregion
1468
- //#region extensions/discord/src/actions/runtime.ts
1469
1315
  const messagingActions = /* @__PURE__ */ new Set([
1470
1316
  "react",
1471
1317
  "reactions",
@@ -1492,10 +1338,121 @@ async function handleDiscordAction(params, cfg, options) {
1492
1338
  cfg,
1493
1339
  accountId
1494
1340
  });
1495
- if (messagingActions.has(action)) return await handleDiscordMessagingAction(action, params, isActionEnabled, cfg, options);
1341
+ if (messagingActions.has(action)) {
1342
+ const ctx = createDiscordMessagingActionContext({
1343
+ action,
1344
+ input: params,
1345
+ isActionEnabled,
1346
+ cfg,
1347
+ options
1348
+ });
1349
+ if (action === "react" || action === "reactions") {
1350
+ if (!ctx.isActionEnabled("reactions")) throw new Error("Discord reactions are disabled.");
1351
+ const channelId = await ctx.resolveReactionChannelId();
1352
+ const messageId = readStringParam(ctx.params, "messageId", { required: true });
1353
+ if (action === "reactions") {
1354
+ const limit = readPositiveIntegerParam(ctx.params, "limit");
1355
+ await ctx.assertReadTargetAllowed({ channelId });
1356
+ const reactions = await fetchReactionsDiscord(channelId, messageId, ctx.withReactionRuntimeOptions({ limit }));
1357
+ return jsonResult({
1358
+ ok: true,
1359
+ reactions
1360
+ });
1361
+ }
1362
+ const { emoji, remove, isEmpty } = readReactionParams(ctx.params, { removeErrorMessage: "Emoji is required to remove a Discord reaction." });
1363
+ await ctx.assertReadTargetAllowed({ channelId });
1364
+ if (isEmpty) {
1365
+ const removed = await removeOwnReactionsDiscord(channelId, messageId, ctx.withReactionRuntimeOptions());
1366
+ return jsonResult({
1367
+ ok: true,
1368
+ removed: removed.removed
1369
+ });
1370
+ }
1371
+ await (remove ? removeReactionDiscord : reactMessageDiscord)(channelId, messageId, emoji, ctx.withReactionRuntimeOptions());
1372
+ return jsonResult({
1373
+ ok: true,
1374
+ [remove ? "removed" : "added"]: emoji
1375
+ });
1376
+ }
1377
+ const result = await handleDiscordMessageSendAction(ctx) ?? await handleDiscordMessageManagementAction(ctx);
1378
+ if (result == null) throw new Error(`Unknown action: ${action}`);
1379
+ return result;
1380
+ }
1496
1381
  if (isDiscordGuildAction(action)) return await handleDiscordGuildAction(action, params, isActionEnabled, cfg, options);
1497
- if (isDiscordModerationAction(action)) return await handleDiscordModerationAction(action, params, isActionEnabled, cfg);
1498
- if (action === "setPresence") return await handleDiscordPresenceAction(action, params, isActionEnabled, cfg);
1382
+ if (isDiscordModerationAction(action)) {
1383
+ if (!isActionEnabled("moderation", false)) throw new Error("Discord moderation is disabled.");
1384
+ const command = readDiscordModerationCommand(action, params);
1385
+ const senderUserId = readStringParam(params, "senderUserId");
1386
+ const withOpts = () => createDiscordActionOptions({
1387
+ cfg,
1388
+ accountId
1389
+ });
1390
+ if (!await (senderUserId ? hasAnyGuildPermissionDiscord(command.guildId, senderUserId, [requiredGuildPermissionForModerationAction(command.action)], withOpts()) : true)) throw new Error("Sender does not have required permissions for this moderation action.");
1391
+ const target = {
1392
+ guildId: command.guildId,
1393
+ userId: command.userId,
1394
+ reason: command.reason
1395
+ };
1396
+ if (command.action === "timeout") {
1397
+ const member = await timeoutMemberDiscord({
1398
+ ...target,
1399
+ durationMinutes: command.durationMinutes,
1400
+ until: command.until
1401
+ }, withOpts());
1402
+ return jsonResult({
1403
+ ok: true,
1404
+ member
1405
+ });
1406
+ }
1407
+ if (command.action === "kick") {
1408
+ await kickMemberDiscord(target, withOpts());
1409
+ return jsonResult({ ok: true });
1410
+ }
1411
+ await banMemberDiscord({
1412
+ ...target,
1413
+ deleteMessageDays: command.deleteMessageDays
1414
+ }, withOpts());
1415
+ return jsonResult({ ok: true });
1416
+ }
1417
+ if (action === "setPresence") {
1418
+ if (!isActionEnabled("presence", false)) throw new Error("Discord presence changes are disabled.");
1419
+ const presenceAccountId = accountId ?? resolveDefaultDiscordAccountId(cfg);
1420
+ const gateway = getGateway(presenceAccountId);
1421
+ if (!gateway) throw new Error(`Discord gateway not available for account "${presenceAccountId}". The bot may not be connected.`);
1422
+ if (!gateway.isConnected) throw new Error(`Discord gateway is not connected for account "${presenceAccountId}".`);
1423
+ const status = readStringParam(params, "status") ?? "online";
1424
+ if (status !== "online" && status !== "dnd" && status !== "idle" && status !== "invisible") throw new Error(`Invalid status "${status}". Must be one of: online, dnd, idle, invisible`);
1425
+ const activityTypeRaw = readStringParam(params, "activityType");
1426
+ const activityName = readStringParam(params, "activityName");
1427
+ const activities = [];
1428
+ if (activityTypeRaw || activityName) {
1429
+ if (!activityTypeRaw) throw new Error(`activityType is required when activityName is provided. Valid types: ${[...ACTIVITY_TYPE_MAP.keys()].join(", ")}`);
1430
+ const typeNum = ACTIVITY_TYPE_MAP.get(normalizeLowercaseStringOrEmpty(activityTypeRaw));
1431
+ if (typeNum === void 0) throw new Error(`Invalid activityType "${activityTypeRaw}". Must be one of: ${[...ACTIVITY_TYPE_MAP.keys()].join(", ")}`);
1432
+ const activity = {
1433
+ name: activityName ?? "",
1434
+ type: typeNum
1435
+ };
1436
+ if (typeNum === 1) {
1437
+ const url = readStringParam(params, "activityUrl");
1438
+ if (url) activity.url = url;
1439
+ }
1440
+ const state = readStringParam(params, "activityState");
1441
+ if (state) activity.state = state;
1442
+ activities.push(activity);
1443
+ }
1444
+ gateway.updatePresence({
1445
+ since: null,
1446
+ activities,
1447
+ status,
1448
+ afk: false
1449
+ });
1450
+ return jsonResult({
1451
+ ok: true,
1452
+ status,
1453
+ activities
1454
+ });
1455
+ }
1499
1456
  throw new Error(`Unknown action: ${action}`);
1500
1457
  }
1501
1458
  //#endregion
@@ -1,5 +1,5 @@
1
- import { _ as selectDiscordActivitiesRuntimeConfig, i as listDiscordAccountIds, l as resolveDiscordAccount, r as isDiscordAccountEnabledForRuntime } from "./accounts-ljrzXBJi.mjs";
2
- import { z as resolveDiscordProxyFetchForAccount } from "./send.shared-CnlMgoqQ.mjs";
1
+ import { _ as selectDiscordActivitiesRuntimeConfig, i as listDiscordAccountIds, l as resolveDiscordAccount, r as isDiscordAccountEnabledForRuntime } from "./accounts-C_25wyxC.mjs";
2
+ import { t as resolveDiscordProxyFetchForAccount } from "./proxy-fetch-BzXwBAXt.mjs";
3
3
  import { normalizeOptionalString } from "openclaw/plugin-sdk/string-coerce-runtime";
4
4
  //#region extensions/discord/src/activities/config.ts
5
5
  function resolveDiscordActivitiesConfig(account, env = process.env) {
@@ -22,15 +22,14 @@ function resolveDiscordActivitiesConfig(account, env = process.env) {
22
22
  //#endregion
23
23
  //#region extensions/discord/src/activities/runtime.ts
24
24
  var DiscordActivitiesRuntime = class {
25
- constructor(store, startupConfig, getCurrentConfig, env = process.env) {
25
+ constructor(store, getCurrentConfig, env = process.env) {
26
26
  this.store = store;
27
- this.startupConfig = startupConfig;
28
27
  this.getCurrentConfig = getCurrentConfig;
29
28
  this.env = env;
30
29
  this.learnedApplicationIds = /* @__PURE__ */ new Map();
31
30
  }
32
31
  currentConfig() {
33
- return selectDiscordActivitiesRuntimeConfig(this.getCurrentConfig?.() ?? this.startupConfig);
32
+ return selectDiscordActivitiesRuntimeConfig(this.getCurrentConfig());
34
33
  }
35
34
  registerApplicationId(accountId, applicationId) {
36
35
  const trimmed = applicationId.trim();
@@ -62,7 +61,8 @@ var DiscordActivitiesRuntime = class {
62
61
  if (applicationId) return accounts.find((account) => account.applicationId === applicationId) ?? null;
63
62
  return accounts.length === 1 ? accounts[0] ?? null : null;
64
63
  }
65
- hasEnabledAccounts(cfg = this.currentConfig()) {
64
+ hasEnabledAccounts() {
65
+ const cfg = this.currentConfig();
66
66
  return listDiscordAccountIds(cfg).some((accountId) => this.resolveAccount(accountId, cfg) !== null);
67
67
  }
68
68
  };
@@ -1,5 +1,5 @@
1
1
  import { normalizeAccountId } from "openclaw/plugin-sdk/account-id";
2
- import { collectNestedChannelFieldAssignments, collectSimpleChannelFieldAssignments, createChannelSecretTargetRegistryEntries, getChannelSurface, hasConfiguredSecretInputValue, isBaseFieldActiveForChannelSurface, isEnabledFlag, isRecord } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
2
+ import { collectNestedChannelFieldAssignments, collectSimpleChannelFieldAssignments, createChannelSecretTargetRegistryEntries, getChannelRecord, hasConfiguredSecretInputValue, isBaseFieldActiveForChannelSurface, isEnabledFlag, isRecord, resolveChannelAccountSurface } from "openclaw/plugin-sdk/channel-secret-basic-runtime";
3
3
  import { collectNestedChannelTtsAssignments } from "openclaw/plugin-sdk/channel-secret-tts-runtime";
4
4
  //#region extensions/discord/src/secret-config-contract.ts
5
5
  function discordRealtimeVoiceSecretOwnerId(accountId, providerId) {
@@ -24,14 +24,9 @@ const secretTargetRegistryEntries = createChannelSecretTargetRegistryEntries({
24
24
  return entry;
25
25
  });
26
26
  function collectRuntimeConfigAssignments(params) {
27
- const resolved = getChannelSurface(params.config, "discord");
28
- if (!resolved) return;
29
- const { channel: discord, surface } = resolved;
30
- if (surface.hasExplicitAccounts && !surface.accounts.some(({ accountId }) => normalizeAccountId(accountId) === "default") && [discord.token, params.context.env.DISCORD_BOT_TOKEN].some((value) => hasConfiguredSecretInputValue(value, params.defaults))) surface.accounts.push({
31
- accountId: "default",
32
- account: {},
33
- enabled: surface.channelEnabled
34
- });
27
+ const discord = getChannelRecord(params.config, "discord");
28
+ if (!discord) return;
29
+ const surface = resolveChannelAccountSurface(discord, [discord.token, params.context.env.DISCORD_BOT_TOKEN].some((value) => hasConfiguredSecretInputValue(value, params.defaults)));
35
30
  const assignmentContext = {
36
31
  channelKey: "discord",
37
32
  channel: discord,