@openclaw/discord 2026.10.2 → 2026.10.5-beta.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (246) hide show
  1. package/dist/.setup/account-inspect-8cCu6uPG.mjs +31 -0
  2. package/dist/.setup/{accounts-HE9-mj1L.mjs → accounts-ljrzXBJi.mjs} +47 -45
  3. package/dist/.setup/{allow-list-vxkG9_JD.mjs → allow-list-B_ToXtew.mjs} +34 -101
  4. package/dist/.setup/{api-DlNUkDqj.mjs → api-CtmE1OUN.mjs} +25 -31
  5. package/dist/.setup/{approval-handler.runtime-DmnEa54W.mjs → approval-handler.runtime-D7FoZSn0.mjs} +30 -53
  6. package/dist/.setup/{approval-message-updates-B0jdSqOj.mjs → approval-message-updates-CIGByUcE.mjs} +2 -2
  7. package/dist/.setup/{audit-BpikUwN_.mjs → audit-zSawfbsN.mjs} +5 -8
  8. package/dist/.setup/{channel-Dr-AUnGt.mjs → channel-DI7DMzu0.mjs} +136 -215
  9. package/dist/.setup/{channel-access-BRp3Y-rF.mjs → channel-access-DasWY_OV.mjs} +6 -7
  10. package/dist/.setup/{channel.setup-BmNvkidb.mjs → channel.setup-DdFVN1mr.mjs} +35 -64
  11. package/dist/.setup/{components-DLJR0xU-.mjs → components-HN9052L1.mjs} +123 -146
  12. package/dist/.setup/{config-schema-BQWfnSCx.mjs → config-schema-_uBILpQf.mjs} +7 -3
  13. package/dist/.setup/{conversation-binding-route-DicJC1Lj.mjs → conversation-binding-route-DTjCBx-O.mjs} +1 -1
  14. package/dist/.setup/{directory-config-gqsdcplU.mjs → directory-config-3iVub-3m.mjs} +1 -1
  15. package/dist/.setup/{directory-live-Bipr0eUJ.mjs → directory-live-DLygQVtW.mjs} +18 -22
  16. package/dist/.setup/{discord-9gysrhzp.mjs → discord-BGqgx-yd.mjs} +686 -854
  17. package/dist/.setup/{doctor-B2bskDcF.mjs → doctor-DSrNJ7m2.mjs} +36 -47
  18. package/dist/.setup/{doctor-contract-Bg3NPAMw.mjs → doctor-contract-Bwv8EuQ_.mjs} +7 -16
  19. package/dist/.setup/{handle-action-UmkjXBfo.mjs → handle-action-CXH1h1tq.mjs} +25 -38
  20. package/dist/.setup/{handle-action.guild-admin-CB4sc9VV.mjs → handle-action.guild-admin-CHKW6PIs.mjs} +25 -31
  21. package/dist/.setup/{live-policy-config-VxexfRKo.mjs → live-policy-config-BPoB3eQi.mjs} +1 -1
  22. package/dist/.setup/{message-handler-BK69A-NB.mjs → message-handler-Ii_etru1.mjs} +9 -14
  23. package/dist/.setup/{message-handler.preflight-DFpsh90H.mjs → message-handler.preflight-C7YuSRl_.mjs} +79 -128
  24. package/dist/.setup/{message-handler.preflight-pluralkit-BXGGVmpe.mjs → message-handler.preflight-pluralkit-C3iAG--b.mjs} +6 -6
  25. package/dist/.setup/{message-handler.process-TKoqcqIP.mjs → message-handler.process-ClgWYH6o.mjs} +234 -206
  26. package/dist/.setup/{outbound-adapter-D4wRAb5S.mjs → outbound-adapter-D8OOIuKn.mjs} +73 -112
  27. package/dist/.setup/{outbound-session-route-BvBH4LC6.mjs → outbound-session-route-B0Hpwn3Q.mjs} +57 -115
  28. package/dist/.setup/output-activity-uBpMSX75.mjs +11 -0
  29. package/dist/.setup/{pluralkit-a6_NLfH9.mjs → pluralkit-B64dfq_j.mjs} +3 -1
  30. package/dist/.setup/{preflight-audio-DHGIHEpv.mjs → preflight-audio-wWgsZG5F.mjs} +1 -5
  31. package/dist/.setup/{presence-cache-Dg3_dADn.mjs → presence-cache-DCeTsL73.mjs} +3 -6
  32. package/dist/.setup/{probe-BwSKpnZf.mjs → probe-D3P1x4aN.mjs} +10 -18
  33. package/dist/.setup/{provider-YP8gN9_o.mjs → provider-D9EzOfG8.mjs} +2990 -3903
  34. package/dist/.setup/{provider-session.runtime-D1gkPxHT.mjs → provider-session.runtime-CsnRvddI.mjs} +5 -5
  35. package/dist/.setup/provider.runtime-BQVcM7Pg.mjs +2 -0
  36. package/dist/.setup/{realtime-session.runtime-BKUQBy1u.mjs → realtime-session.runtime-CxGBk8H-.mjs} +69 -98
  37. package/dist/.setup/{receive-recovery-DgkX7Qvi.mjs → receive-recovery-eVmK2_hl.mjs} +2 -12
  38. package/dist/.setup/resolve-allowlist-common-DNSsUQRF.mjs +66 -0
  39. package/dist/.setup/resolve-channels-UdT38DzU.mjs +173 -0
  40. package/dist/.setup/{resolve-users-DNrwvunm.mjs → resolve-users-DnCsrXZ_.mjs} +12 -41
  41. package/dist/.setup/{runtime-CESTexGn.mjs → runtime-CRTkKU1G.mjs} +202 -313
  42. package/dist/.setup/{runtime-DPcmPST9.mjs → runtime-DPm3gZXk.mjs} +2 -2
  43. package/dist/.setup/{secret-config-contract-uOE2J7yM.mjs → secret-config-contract-CIsH7R3B.mjs} +9 -18
  44. package/dist/.setup/{security-audit-D42cp5N7.mjs → security-audit-BFT84Uny.mjs} +1 -2
  45. package/dist/.setup/security-contract-DNyyjTZZ.mjs +19 -0
  46. package/dist/.setup/{send-CJk3VP5q.mjs → send-DbILKgcm.mjs} +184 -241
  47. package/dist/.setup/{send.components-dPljuV24.mjs → send.components-FxOS3CeP.mjs} +47 -63
  48. package/dist/.setup/{send.outbound-rOboMO_6.mjs → send.outbound-_jx4Xpd3.mjs} +178 -202
  49. package/dist/.setup/{send.receipt-DVOg2Oaw.mjs → send.receipt-BAlzXd8e.mjs} +33 -109
  50. package/dist/.setup/{send.shared-C4CN24D9.mjs → send.shared-CjQ4jbMA.mjs} +97 -153
  51. package/dist/.setup/{sender-identity-AHpUNr72.mjs → sender-identity-BNBvGt1l.mjs} +1 -1
  52. package/dist/.setup/setup-plugin-api-xfOFmxHP.mjs +3 -0
  53. package/dist/.setup/{shared-BoBnM5kM.mjs → shared-CestGDpq.mjs} +30 -20
  54. package/dist/.setup/{subagent-hooks-HH8Uy9cx.mjs → subagent-hooks-CME7dSGf.mjs} +5 -10
  55. package/dist/.setup/{system-events-Cwxaww8i.mjs → system-events-BwwSDCw4.mjs} +2 -2
  56. package/dist/.setup/target-parsing-C-HyNxcE.mjs +48 -0
  57. package/dist/.setup/{target-resolver-CSFoPQ12.mjs → target-resolver-Bse8fuTi.mjs} +11 -27
  58. package/dist/.setup/targets-DZJjkzwv.mjs +3 -0
  59. package/dist/.setup/{thread-bindings-DjQCkmsd.mjs → thread-bindings-0hPTSK14.mjs} +61 -52
  60. package/dist/.setup/{thread-bindings.manager-D2-GYZ5s.mjs → thread-bindings.manager-CdNa6UIs.mjs} +138 -211
  61. package/dist/.setup/{thread-bindings.session-updates-Bu_CGr_O.mjs → thread-bindings.session-updates-DGSljVf6.mjs} +60 -99
  62. package/dist/.setup/threading-BKe3E3tp.mjs +246 -0
  63. package/dist/.setup/{timeouts-pun7VJ02.mjs → timeouts-CuNARfyw.mjs} +10 -18
  64. package/dist/.setup/{transcripts-source-CaZQnGRH.mjs → transcripts-source-0qQYVu2H.mjs} +50 -368
  65. package/dist/.setup/{voice-runtime-DDymtIw8.mjs → voice-runtime-QlZJ4sHv.mjs} +166 -322
  66. package/dist/account-inspect-api.js +1 -1
  67. package/dist/action-runtime-api.js +1 -1
  68. package/dist/activities-api.js +77 -120
  69. package/dist/api.js +19 -18
  70. package/dist/channel-config-api.js +1 -1
  71. package/dist/channel-plugin-api.js +1 -1
  72. package/dist/directory-contract-api.js +1 -1
  73. package/dist/doctor-contract-api.js +1 -1
  74. package/dist/runtime-api.js +21 -20
  75. package/dist/secret-contract-api.js +1 -1
  76. package/dist/security-audit-contract-api.js +1 -1
  77. package/dist/security-contract-api.js +1 -1
  78. package/dist/setup-entry.js +1 -1
  79. package/dist/setup-plugin-api.js +1 -1
  80. package/dist/src/voice/audio-worker.runtime.js +38 -57
  81. package/dist/subagent-hooks-api.js +1 -1
  82. package/dist/transcripts-source-api.js +1 -1
  83. package/node_modules/@types/node/README.md +1 -1
  84. package/node_modules/@types/node/crypto.d.ts +2 -2
  85. package/node_modules/@types/node/dgram.d.ts +1 -1
  86. package/node_modules/@types/node/package.json +2 -2
  87. package/node_modules/@types/node/zlib.d.ts +6 -0
  88. package/node_modules/@types/ws/README.md +1 -1
  89. package/node_modules/@types/ws/index.d.mts +4 -0
  90. package/node_modules/@types/ws/index.d.ts +4 -0
  91. package/node_modules/@types/ws/package.json +3 -3
  92. package/node_modules/discord-api-types/_generated_/rest/v10/interfaces.d.ts +21 -0
  93. package/node_modules/discord-api-types/_generated_/rest/v10/interfaces.d.ts.map +1 -1
  94. package/node_modules/discord-api-types/_generated_/rest/v9/interfaces.d.ts +21 -0
  95. package/node_modules/discord-api-types/_generated_/rest/v9/interfaces.d.ts.map +1 -1
  96. package/node_modules/discord-api-types/globals.d.ts +6 -0
  97. package/node_modules/discord-api-types/globals.d.ts.map +1 -1
  98. package/node_modules/discord-api-types/globals.js +6 -0
  99. package/node_modules/discord-api-types/globals.js.map +1 -1
  100. package/node_modules/discord-api-types/package.json +3 -3
  101. package/node_modules/discord-api-types/payloads/index.mjs +1 -0
  102. package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.d.ts +207 -0
  103. package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.d.ts.map +1 -0
  104. package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.js +25 -0
  105. package/node_modules/discord-api-types/payloads/v10/applicationIdentityProfile.js.map +1 -0
  106. package/node_modules/discord-api-types/payloads/v10/autoModeration.d.ts +1 -1
  107. package/node_modules/discord-api-types/payloads/v10/autoModeration.d.ts.map +1 -1
  108. package/node_modules/discord-api-types/payloads/v10/guild.d.ts +27 -23
  109. package/node_modules/discord-api-types/payloads/v10/guild.d.ts.map +1 -1
  110. package/node_modules/discord-api-types/payloads/v10/guild.js +26 -22
  111. package/node_modules/discord-api-types/payloads/v10/guild.js.map +1 -1
  112. package/node_modules/discord-api-types/payloads/v10/index.d.ts +1 -0
  113. package/node_modules/discord-api-types/payloads/v10/index.d.ts.map +1 -1
  114. package/node_modules/discord-api-types/payloads/v10/index.js +1 -0
  115. package/node_modules/discord-api-types/payloads/v10/index.js.map +1 -1
  116. package/node_modules/discord-api-types/payloads/v10/index.mjs +1 -0
  117. package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.d.ts +207 -0
  118. package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.d.ts.map +1 -0
  119. package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.js +25 -0
  120. package/node_modules/discord-api-types/payloads/v9/applicationIdentityProfile.js.map +1 -0
  121. package/node_modules/discord-api-types/payloads/v9/autoModeration.d.ts +1 -1
  122. package/node_modules/discord-api-types/payloads/v9/autoModeration.d.ts.map +1 -1
  123. package/node_modules/discord-api-types/payloads/v9/guild.d.ts +27 -23
  124. package/node_modules/discord-api-types/payloads/v9/guild.d.ts.map +1 -1
  125. package/node_modules/discord-api-types/payloads/v9/guild.js +26 -22
  126. package/node_modules/discord-api-types/payloads/v9/guild.js.map +1 -1
  127. package/node_modules/discord-api-types/payloads/v9/index.d.ts +1 -0
  128. package/node_modules/discord-api-types/payloads/v9/index.d.ts.map +1 -1
  129. package/node_modules/discord-api-types/payloads/v9/index.js +1 -0
  130. package/node_modules/discord-api-types/payloads/v9/index.js.map +1 -1
  131. package/node_modules/discord-api-types/payloads/v9/index.mjs +1 -0
  132. package/node_modules/discord-api-types/rest/common.d.ts +2 -0
  133. package/node_modules/discord-api-types/rest/common.d.ts.map +1 -1
  134. package/node_modules/discord-api-types/rest/common.js +2 -0
  135. package/node_modules/discord-api-types/rest/common.js.map +1 -1
  136. package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.d.ts +70 -0
  137. package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.d.ts.map +1 -0
  138. package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.js +3 -0
  139. package/node_modules/discord-api-types/rest/v10/applicationIdentityProfile.js.map +1 -0
  140. package/node_modules/discord-api-types/rest/v10/index.d.ts +1 -0
  141. package/node_modules/discord-api-types/rest/v10/index.d.ts.map +1 -1
  142. package/node_modules/discord-api-types/rest/v10/index.js +29 -0
  143. package/node_modules/discord-api-types/rest/v10/index.js.map +1 -1
  144. package/node_modules/discord-api-types/rest/v10/interactions.d.ts +4 -2
  145. package/node_modules/discord-api-types/rest/v10/interactions.d.ts.map +1 -1
  146. package/node_modules/discord-api-types/rest/v10/user.d.ts +2 -2
  147. package/node_modules/discord-api-types/rest/v10/user.d.ts.map +1 -1
  148. package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.d.ts +70 -0
  149. package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.d.ts.map +1 -0
  150. package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.js +3 -0
  151. package/node_modules/discord-api-types/rest/v9/applicationIdentityProfile.js.map +1 -0
  152. package/node_modules/discord-api-types/rest/v9/index.d.ts +1 -0
  153. package/node_modules/discord-api-types/rest/v9/index.d.ts.map +1 -1
  154. package/node_modules/discord-api-types/rest/v9/index.js +29 -0
  155. package/node_modules/discord-api-types/rest/v9/index.js.map +1 -1
  156. package/node_modules/discord-api-types/rest/v9/interactions.d.ts +4 -2
  157. package/node_modules/discord-api-types/rest/v9/interactions.d.ts.map +1 -1
  158. package/node_modules/discord-api-types/rest/v9/user.d.ts +2 -2
  159. package/node_modules/discord-api-types/rest/v9/user.d.ts.map +1 -1
  160. package/node_modules/discord-api-types/v10.mjs +1 -0
  161. package/node_modules/discord-api-types/v9.mjs +1 -0
  162. package/node_modules/micromark/dev/lib/compile.d.ts.map +1 -1
  163. package/node_modules/micromark/dev/lib/compile.js +14 -4
  164. package/node_modules/micromark/dev/lib/create-tokenizer.d.ts.map +1 -1
  165. package/node_modules/micromark/dev/lib/create-tokenizer.js +7 -6
  166. package/node_modules/micromark/dev/lib/initialize/document.js +25 -21
  167. package/node_modules/micromark/dev/lib/initialize/text.d.ts.map +1 -1
  168. package/node_modules/micromark/dev/lib/initialize/text.js +10 -6
  169. package/node_modules/micromark/dev/lib/preprocess.d.ts.map +1 -1
  170. package/node_modules/micromark/dev/lib/preprocess.js +19 -21
  171. package/node_modules/micromark/lib/compile.d.ts.map +1 -1
  172. package/node_modules/micromark/lib/compile.js +37 -29
  173. package/node_modules/micromark/lib/create-tokenizer.d.ts.map +1 -1
  174. package/node_modules/micromark/lib/create-tokenizer.js +37 -35
  175. package/node_modules/micromark/lib/initialize/document.js +21 -13
  176. package/node_modules/micromark/lib/initialize/text.d.ts.map +1 -1
  177. package/node_modules/micromark/lib/initialize/text.js +7 -3
  178. package/node_modules/micromark/lib/preprocess.d.ts.map +1 -1
  179. package/node_modules/micromark/lib/preprocess.js +16 -19
  180. package/node_modules/micromark/package.json +2 -15
  181. package/node_modules/micromark-core-commonmark/dev/lib/attention.js +18 -24
  182. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.d.ts.map +1 -1
  183. package/node_modules/micromark-core-commonmark/dev/lib/code-fenced.js +1 -43
  184. package/node_modules/micromark-core-commonmark/dev/lib/code-indented.js +19 -43
  185. package/node_modules/micromark-core-commonmark/dev/lib/heading-atx.js +2 -6
  186. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.d.ts.map +1 -1
  187. package/node_modules/micromark-core-commonmark/dev/lib/html-flow.js +2 -53
  188. package/node_modules/micromark-core-commonmark/dev/lib/label-end.js +14 -12
  189. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.d.ts.map +1 -1
  190. package/node_modules/micromark-core-commonmark/dev/lib/label-start-image.js +14 -5
  191. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.d.ts.map +1 -1
  192. package/node_modules/micromark-core-commonmark/dev/lib/label-start-link.js +14 -5
  193. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts +4 -0
  194. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.d.ts.map +1 -0
  195. package/node_modules/micromark-core-commonmark/dev/lib/partial-non-lazy-continuation.js +67 -0
  196. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.d.ts.map +1 -1
  197. package/node_modules/micromark-core-commonmark/dev/lib/setext-underline.js +8 -5
  198. package/node_modules/micromark-core-commonmark/lib/attention.js +14 -24
  199. package/node_modules/micromark-core-commonmark/lib/code-fenced.d.ts.map +1 -1
  200. package/node_modules/micromark-core-commonmark/lib/code-fenced.js +1 -39
  201. package/node_modules/micromark-core-commonmark/lib/code-indented.js +11 -29
  202. package/node_modules/micromark-core-commonmark/lib/heading-atx.js +2 -6
  203. package/node_modules/micromark-core-commonmark/lib/html-flow.d.ts.map +1 -1
  204. package/node_modules/micromark-core-commonmark/lib/html-flow.js +2 -51
  205. package/node_modules/micromark-core-commonmark/lib/label-end.js +11 -10
  206. package/node_modules/micromark-core-commonmark/lib/label-start-image.d.ts.map +1 -1
  207. package/node_modules/micromark-core-commonmark/lib/label-start-image.js +11 -3
  208. package/node_modules/micromark-core-commonmark/lib/label-start-link.d.ts.map +1 -1
  209. package/node_modules/micromark-core-commonmark/lib/label-start-link.js +11 -3
  210. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts +4 -0
  211. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.d.ts.map +1 -0
  212. package/node_modules/micromark-core-commonmark/lib/partial-non-lazy-continuation.js +61 -0
  213. package/node_modules/micromark-core-commonmark/lib/setext-underline.d.ts.map +1 -1
  214. package/node_modules/micromark-core-commonmark/lib/setext-underline.js +7 -5
  215. package/node_modules/micromark-core-commonmark/package.json +4 -16
  216. package/node_modules/micromark-factory-space/dev/index.d.ts +24 -1
  217. package/node_modules/micromark-factory-space/dev/index.d.ts.map +1 -1
  218. package/node_modules/micromark-factory-space/dev/index.js +58 -3
  219. package/node_modules/micromark-factory-space/index.d.ts +24 -1
  220. package/node_modules/micromark-factory-space/index.d.ts.map +1 -1
  221. package/node_modules/micromark-factory-space/index.js +55 -3
  222. package/node_modules/micromark-factory-space/package.json +1 -10
  223. package/node_modules/micromark-factory-space/readme.md +25 -25
  224. package/node_modules/micromark-util-edit-map/dev/index.d.ts +78 -0
  225. package/node_modules/micromark-util-edit-map/dev/index.d.ts.map +1 -0
  226. package/node_modules/micromark-util-edit-map/dev/index.js +237 -0
  227. package/node_modules/micromark-util-edit-map/index.d.ts +78 -0
  228. package/node_modules/micromark-util-edit-map/index.d.ts.map +1 -0
  229. package/node_modules/micromark-util-edit-map/index.js +225 -0
  230. package/node_modules/micromark-util-edit-map/license +22 -0
  231. package/node_modules/micromark-util-edit-map/package.json +48 -0
  232. package/node_modules/micromark-util-edit-map/readme.md +234 -0
  233. package/node_modules/micromark-util-types/index.d.ts +6 -3
  234. package/node_modules/micromark-util-types/package.json +2 -36
  235. package/node_modules/ws/lib/websocket.js +17 -3
  236. package/node_modules/ws/package.json +1 -1
  237. package/openclaw.plugin.json +3 -6
  238. package/package.json +7 -12
  239. package/dist/.setup/account-inspect-DsER5ILV.mjs +0 -45
  240. package/dist/.setup/provider.runtime-CZ51OIgD.mjs +0 -2
  241. package/dist/.setup/resolve-allowlist-common-BUyU3C-T.mjs +0 -27
  242. package/dist/.setup/resolve-channels-DA6QlhZN.mjs +0 -246
  243. package/dist/.setup/security-contract-DSHk7I2w.mjs +0 -26
  244. package/dist/.setup/setup-plugin-api-BVlCz3fm.mjs +0 -3
  245. package/dist/.setup/targets-bqXQENmX.mjs +0 -3
  246. package/dist/control-ui/2afbdab1d3aa65a789d8a3eba666f4b1ec5df07073538fe30d6cf32093a1fb2d/index.js +0 -1
@@ -1,16 +1,16 @@
1
1
  import { n as __reExport, t as __exportAll } from "./rolldown-runtime-B4FMCO8f.mjs";
2
- import { D as getDiscordEndpointRuntime, T as parseDiscordRetryAfterBodySeconds } from "./allow-list-vxkG9_JD.mjs";
2
+ import { D as getDiscordEndpointRuntime, T as parseDiscordRetryAfterBodySeconds } from "./allow-list-B_ToXtew.mjs";
3
3
  import { formatErrorMessage } from "openclaw/plugin-sdk/error-runtime";
4
4
  import { asOptionalObjectRecord } from "openclaw/plugin-sdk/string-coerce-runtime";
5
5
  import { ApplicationCommandOptionType, ApplicationCommandType, ButtonStyle, ComponentType, GatewayDispatchEvents, InteractionContextType, InteractionResponseType, InteractionType, MessageFlags, Routes, TextInputStyle } from "discord-api-types/v10";
6
- import { asDateTimestampMs, clampTimerTimeoutMs, parseStrictNonNegativeInteger as parseStrictNonNegativeInteger$1, resolveExpiresAtMsFromDurationMs, resolveIntegerOption, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
6
+ import { asDateTimestampMs, clampTimerTimeoutMs, parseStrictNonNegativeInteger as parseStrictNonNegativeInteger$1, resolveExpiresAtMsFromDurationMs, resolveTimerTimeoutMs } from "openclaw/plugin-sdk/number-runtime";
7
+ import { captureChannelReadAuthority, captureEffectAuthority } from "openclaw/plugin-sdk/fetch-runtime";
7
8
  import { Type } from "typebox";
8
9
  import { Check } from "typebox/value";
9
10
  import { createHash } from "node:crypto";
10
11
  import { raceWithTimeout } from "openclaw/plugin-sdk/time-runtime";
11
12
  import { inspect } from "node:util";
12
13
  import { gunzipSync } from "node:zlib";
13
- import { captureChannelReadAuthority } from "openclaw/plugin-sdk/fetch-runtime";
14
14
  import { readResponseWithLimit } from "openclaw/plugin-sdk/response-limit-runtime";
15
15
  import { AsyncLocalStorage } from "node:async_hooks";
16
16
  import { resolveGlobalSingleton } from "openclaw/plugin-sdk/global-singleton";
@@ -30,12 +30,11 @@ const discordGuildEmojiListSchema = Type.Array(Type.Object({
30
30
  async function getGuild(rest, guildId) {
31
31
  return await rest.get(Routes.guild(guildId));
32
32
  }
33
- async function getGuildMember(rest, guildId, userId) {
34
- return await rest.get(Routes.guildMember(guildId, userId));
35
- }
36
- async function getGuildVoiceState(rest, guildId, userId) {
37
- return await rest.get(Routes.guildVoiceState(guildId, userId));
33
+ function guildUserRead(route) {
34
+ return async (rest, guildId, userId) => await rest.get(Routes[route](guildId, userId));
38
35
  }
36
+ const getGuildMember = guildUserRead("guildMember");
37
+ const getGuildVoiceState = guildUserRead("guildVoiceState");
39
38
  async function listGuildEmojis(rest, guildId) {
40
39
  const emojis = await rest.get(Routes.guildEmojis(guildId));
41
40
  if (!Check(discordGuildEmojiListSchema, emojis)) throw new Error("Invalid Discord guild emoji response.");
@@ -51,6 +50,9 @@ function normalizeDiscordMessageId(messageId) {
51
50
  async function getChannel(rest, channelId) {
52
51
  return await rest.get(Routes.channel(channelId));
53
52
  }
53
+ async function createChannelMessage(rest, channelId, data) {
54
+ return await rest.post(Routes.channelMessages(channelId), data);
55
+ }
54
56
  async function getThreadMember(rest, threadId, userId) {
55
57
  return await rest.get(Routes.threadMembers(threadId, userId));
56
58
  }
@@ -60,27 +62,27 @@ async function getChannelMessage(rest, channelId, messageId) {
60
62
  async function editChannelMessage(rest, channelId, messageId, data) {
61
63
  return await rest.patch(Routes.channelMessage(channelId, normalizeDiscordMessageId(messageId)), data);
62
64
  }
63
- async function deleteChannelMessage(rest, channelId, messageId) {
64
- await rest.delete(Routes.channelMessage(channelId, normalizeDiscordMessageId(messageId)));
65
- }
66
- async function pinChannelMessage(rest, channelId, messageId) {
67
- await rest.put(Routes.channelPin(channelId, normalizeDiscordMessageId(messageId)));
68
- }
69
- async function unpinChannelMessage(rest, channelId, messageId) {
70
- await rest.delete(Routes.channelPin(channelId, normalizeDiscordMessageId(messageId)));
65
+ function messageMutation(method, route) {
66
+ return async (rest, channelId, messageId) => {
67
+ await rest[method](Routes[route](channelId, normalizeDiscordMessageId(messageId)));
68
+ };
71
69
  }
70
+ const deleteChannelMessage = messageMutation("delete", "channelMessage");
71
+ const pinChannelMessage = messageMutation("put", "channelPin");
72
+ const unpinChannelMessage = messageMutation("delete", "channelPin");
72
73
  async function createThread(rest, channelId, data, messageId) {
73
74
  const route = messageId === void 0 ? Routes.threads(channelId) : Routes.threads(channelId, normalizeDiscordMessageId(messageId));
74
75
  return await rest.post(route, data);
75
76
  }
76
77
  //#endregion
77
78
  //#region extensions/discord/src/internal/api.reactions.ts
78
- async function createOwnMessageReaction(rest, channelId, messageId, encodedEmoji) {
79
- await rest.put(Routes.channelMessageOwnReaction(channelId, normalizeDiscordMessageId(messageId), encodedEmoji));
80
- }
81
- async function deleteOwnMessageReaction(rest, channelId, messageId, encodedEmoji) {
82
- await rest.delete(Routes.channelMessageOwnReaction(channelId, normalizeDiscordMessageId(messageId), encodedEmoji));
79
+ function ownReactionMutation(method) {
80
+ return async (rest, channelId, messageId, encodedEmoji) => {
81
+ await rest[method](Routes.channelMessageOwnReaction(channelId, normalizeDiscordMessageId(messageId), encodedEmoji));
82
+ };
83
83
  }
84
+ const createOwnMessageReaction = ownReactionMutation("put");
85
+ const deleteOwnMessageReaction = ownReactionMutation("delete");
84
86
  async function listMessageReactionUsers(rest, channelId, messageId, encodedEmoji, query) {
85
87
  return await rest.get(Routes.channelMessageReaction(channelId, normalizeDiscordMessageId(messageId), encodedEmoji), query);
86
88
  }
@@ -223,7 +225,7 @@ function isApplicationCommandLimitError(error) {
223
225
  return error !== null && typeof error === "object" && "discordCode" in error && error.discordCode === DISCORD_APPLICATION_COMMAND_LIMIT_REACHED;
224
226
  }
225
227
  function stableCommandSetHash(commands) {
226
- const stable = commands.map((command) => stableComparableObject(command)).toSorted((a, b) => stableCommandKey(a).localeCompare(stableCommandKey(b)));
228
+ const stable = commands.toSorted((a, b) => stableCommandKey(a).localeCompare(stableCommandKey(b))).map((command) => stableComparableObject(command));
227
229
  return createHash("sha256").update(JSON.stringify(stable)).digest("hex");
228
230
  }
229
231
  //#endregion
@@ -267,502 +269,132 @@ var BaseMessageInteractiveComponent = class extends BaseComponent {
267
269
  };
268
270
  var BaseModalComponent = class extends BaseComponent {};
269
271
  //#endregion
270
- //#region extensions/discord/src/internal/components.message.ts
271
- var BaseButton = class extends BaseMessageInteractiveComponent {
272
- constructor(..._args) {
273
- super(..._args);
274
- this.type = ComponentType.Button;
275
- this.style = ButtonStyle.Primary;
276
- this.disabled = false;
272
+ //#region extensions/discord/src/internal/component-registry.ts
273
+ var ComponentRegistry = class {
274
+ constructor() {
275
+ this.entries = /* @__PURE__ */ new Map();
276
+ this.wildcardEntries = [];
277
277
  }
278
- };
279
- var Button = class extends BaseButton {
280
- serialize() {
281
- return stripUndefinedFields({
282
- type: this.type,
283
- style: this.style,
284
- custom_id: this.customId,
285
- label: this.label,
286
- emoji: this.emoji,
287
- disabled: this.disabled || void 0
288
- });
278
+ register(entry) {
279
+ const key = (entry.customIdParser ?? parseCustomId)(entry.customId).key;
280
+ const entries = key === "*" ? this.wildcardEntries : this.entries.get(key) ?? [];
281
+ if (!entries.includes(entry)) {
282
+ entries.push(entry);
283
+ if (key !== "*") this.entries.set(key, entries);
284
+ }
289
285
  }
290
- };
291
- var LinkButton = class extends BaseButton {
292
- constructor(..._args2) {
293
- super(..._args2);
294
- this.customId = "";
295
- this.style = ButtonStyle.Link;
286
+ resolve(customId, options) {
287
+ for (const entries of this.entries.values()) {
288
+ const match = entries.find((entry) => {
289
+ if (options?.componentType !== void 0 && entry.type !== options.componentType) return false;
290
+ const parser = entry.customIdParser ?? parseCustomId;
291
+ return parser(entry.customId).key === parser(customId).key;
292
+ });
293
+ if (match) return match;
294
+ }
295
+ return this.wildcardEntries.find((entry) => options?.componentType === void 0 || entry.type === options.componentType);
296
296
  }
297
- async run() {
298
- throw new Error("Link buttons do not run handlers");
297
+ };
298
+ //#endregion
299
+ //#region extensions/discord/src/internal/structures.ts
300
+ var Base = class {
301
+ constructor(client) {
302
+ this.client = client;
299
303
  }
300
- serialize() {
301
- return stripUndefinedFields({
302
- type: this.type,
303
- style: this.style,
304
- label: this.label,
305
- emoji: this.emoji,
306
- disabled: this.disabled || void 0,
307
- url: this.url
308
- });
304
+ };
305
+ var PartialEntity = class extends Base {
306
+ constructor(client, rawDataOrId) {
307
+ super(client);
308
+ this.rawDataValue = typeof rawDataOrId === "string" ? null : rawDataOrId;
309
+ this.id = typeof rawDataOrId === "string" ? rawDataOrId : rawDataOrId.id;
309
310
  }
310
311
  };
311
- var AnySelectMenu = class extends BaseMessageInteractiveComponent {
312
- constructor(..._args3) {
313
- super(..._args3);
314
- this.disabled = false;
312
+ var User = class extends PartialEntity {
313
+ get rawData() {
314
+ if (!this.rawDataValue) throw new Error("Partial Discord user has no raw data");
315
+ return this.rawDataValue;
315
316
  }
316
- serializeOptions() {
317
- return {
318
- type: this.type,
319
- default_values: this.defaultValues
320
- };
317
+ get partial() {
318
+ return this.rawDataValue === null;
321
319
  }
322
- serialize() {
323
- return stripUndefinedFields({
324
- ...this.serializeOptions(),
325
- custom_id: this.customId,
326
- placeholder: this.placeholder,
327
- min_values: this.minValues,
328
- max_values: this.maxValues,
329
- disabled: this.disabled || void 0,
330
- required: this.required
331
- });
320
+ get username() {
321
+ return this.rawDataValue?.username ?? "";
332
322
  }
333
- };
334
- var StringSelectMenu = class extends AnySelectMenu {
335
- constructor(..._args4) {
336
- super(..._args4);
337
- this.type = ComponentType.StringSelect;
323
+ get globalName() {
324
+ return this.rawDataValue?.global_name;
338
325
  }
339
- serializeOptions() {
340
- return {
341
- type: this.type,
342
- options: this.options
343
- };
326
+ get discriminator() {
327
+ return this.rawDataValue?.discriminator;
344
328
  }
345
- };
346
- var UserSelectMenu = class extends AnySelectMenu {
347
- constructor(..._args5) {
348
- super(..._args5);
349
- this.type = ComponentType.UserSelect;
329
+ get bot() {
330
+ return this.rawDataValue?.bot;
350
331
  }
351
- };
352
- var RoleSelectMenu = class extends AnySelectMenu {
353
- constructor(..._args6) {
354
- super(..._args6);
355
- this.type = ComponentType.RoleSelect;
332
+ get avatar() {
333
+ return this.rawDataValue?.avatar;
334
+ }
335
+ async fetch() {
336
+ return this.client.fetchUser(this.id);
356
337
  }
357
338
  };
358
- var MentionableSelectMenu = class extends AnySelectMenu {
359
- constructor(..._args7) {
360
- super(..._args7);
361
- this.type = ComponentType.MentionableSelect;
339
+ var Role = class extends PartialEntity {
340
+ get name() {
341
+ return this.rawDataValue?.name ?? "";
362
342
  }
363
343
  };
364
- var ChannelSelectMenu = class extends AnySelectMenu {
365
- constructor(..._args8) {
366
- super(..._args8);
367
- this.type = ComponentType.ChannelSelect;
344
+ var Guild = class extends PartialEntity {
345
+ get name() {
346
+ return this.rawDataValue?.name ?? "";
368
347
  }
369
- serializeOptions() {
370
- return {
371
- type: this.type,
372
- default_values: this.defaultValues,
373
- channel_types: this.channelTypes
374
- };
348
+ get icon() {
349
+ return this.rawDataValue?.icon;
375
350
  }
376
351
  };
377
- var Row = class extends BaseComponent {
378
- constructor(components = []) {
379
- super();
380
- this.type = ComponentType.ActionRow;
381
- this.isV2 = false;
382
- this.components = components;
352
+ var GuildMember = class extends Base {
353
+ constructor(client, rawData) {
354
+ super(client);
355
+ this.rawData = rawData;
383
356
  }
384
- addComponent(component) {
385
- this.components.push(component);
357
+ get user() {
358
+ return this.rawData.user ? new User(this.client, this.rawData.user) : null;
386
359
  }
387
- serialize() {
388
- return {
389
- type: this.type,
390
- components: this.components.map((entry) => entry.serialize())
391
- };
360
+ get roles() {
361
+ return this.rawData.roles ?? [];
362
+ }
363
+ get nickname() {
364
+ return this.rawData.nick ?? void 0;
392
365
  }
393
366
  };
394
- var TextDisplay = class extends BaseComponent {
395
- constructor(content) {
396
- super();
397
- this.content = content;
398
- this.type = ComponentType.TextDisplay;
399
- this.isV2 = true;
367
+ var Message = class Message extends Base {
368
+ constructor(client, rawDataOrIds) {
369
+ super(client);
370
+ this.rawDataValue = typeof rawDataOrIds === "string" || !("author" in rawDataOrIds) ? null : rawDataOrIds;
371
+ this.id = typeof rawDataOrIds === "string" ? rawDataOrIds : rawDataOrIds.id;
372
+ this.channelId = typeof rawDataOrIds === "string" ? "" : "channel_id" in rawDataOrIds ? rawDataOrIds.channel_id : rawDataOrIds.channelId ?? "";
400
373
  }
401
- serialize() {
402
- return stripUndefinedFields({
403
- type: this.type,
404
- content: this.content
405
- });
374
+ get rawData() {
375
+ if (!this.rawDataValue) throw new Error("Partial Discord message has no raw data");
376
+ return this.rawDataValue;
406
377
  }
407
- };
408
- var Separator = class extends BaseComponent {
409
- constructor(options) {
410
- super();
411
- this.type = ComponentType.Separator;
412
- this.isV2 = true;
413
- this.divider = true;
414
- this.spacing = "small";
415
- this.spacing = options?.spacing ?? this.spacing;
416
- this.divider = options?.divider ?? this.divider;
378
+ get partial() {
379
+ return this.rawDataValue === null;
417
380
  }
418
- serialize() {
419
- return stripUndefinedFields({
420
- type: this.type,
421
- divider: this.divider,
422
- spacing: this.spacing === "large" ? 2 : this.spacing === "small" ? 1 : this.spacing
423
- });
381
+ get message() {
382
+ return this;
424
383
  }
425
- };
426
- var Thumbnail = class extends BaseComponent {
427
- constructor(url) {
428
- super();
429
- this.url = url;
430
- this.type = ComponentType.Thumbnail;
431
- this.isV2 = true;
384
+ get channel_id() {
385
+ return this.channelId;
432
386
  }
433
- serialize() {
434
- return stripUndefinedFields({
435
- type: this.type,
436
- media: this.url ? { url: this.url } : void 0
437
- });
387
+ get guild_id() {
388
+ return this.rawDataValue?.guild_id;
438
389
  }
439
- };
440
- var Section = class extends BaseComponent {
441
- constructor(components = [], accessory) {
442
- super();
443
- this.components = components;
444
- this.accessory = accessory;
445
- this.type = ComponentType.Section;
446
- this.isV2 = true;
390
+ get guild() {
391
+ return this.guild_id ? new Guild(this.client, this.guild_id) : null;
447
392
  }
448
- serialize() {
449
- return stripUndefinedFields({
450
- type: this.type,
451
- components: this.components.map((entry) => entry.serialize()),
452
- accessory: this.accessory?.serialize()
453
- });
393
+ get webhookId() {
394
+ return this.webhook_id;
454
395
  }
455
- };
456
- var MediaGallery = class extends BaseComponent {
457
- constructor(items = []) {
458
- super();
459
- this.items = items;
460
- this.type = ComponentType.MediaGallery;
461
- this.isV2 = true;
462
- }
463
- serialize() {
464
- return {
465
- type: this.type,
466
- items: this.items.map((entry) => ({
467
- media: { url: entry.url },
468
- description: entry.description,
469
- spoiler: entry.spoiler
470
- }))
471
- };
472
- }
473
- };
474
- var File = class extends BaseComponent {
475
- constructor(file, spoiler = false) {
476
- super();
477
- this.file = file;
478
- this.spoiler = spoiler;
479
- this.type = ComponentType.File;
480
- this.isV2 = true;
481
- }
482
- serialize() {
483
- return stripUndefinedFields({
484
- type: this.type,
485
- file: this.file ? { url: this.file } : void 0,
486
- spoiler: this.spoiler || void 0
487
- });
488
- }
489
- };
490
- var Container = class extends BaseComponent {
491
- constructor(components = [], options) {
492
- super();
493
- this.type = ComponentType.Container;
494
- this.isV2 = true;
495
- this.spoiler = false;
496
- this.components = components;
497
- this.accentColor = options?.accentColor;
498
- this.spoiler = options?.spoiler ?? false;
499
- }
500
- serialize() {
501
- return stripUndefinedFields({
502
- type: this.type,
503
- components: this.components.map((entry) => entry.serialize()),
504
- accent_color: colorToNumber(this.accentColor),
505
- spoiler: this.spoiler || void 0
506
- });
507
- }
508
- };
509
- //#endregion
510
- //#region extensions/discord/src/internal/components.modal.ts
511
- var TextInput = class extends BaseModalComponent {
512
- constructor(..._args) {
513
- super(..._args);
514
- this.type = ComponentType.TextInput;
515
- this.customIdParser = parseCustomId;
516
- this.style = TextInputStyle.Short;
517
- }
518
- serialize() {
519
- return stripUndefinedFields({
520
- type: this.type,
521
- custom_id: this.customId,
522
- style: this.style,
523
- min_length: this.minLength,
524
- max_length: this.maxLength,
525
- required: this.required,
526
- value: this.value,
527
- placeholder: this.placeholder
528
- });
529
- }
530
- };
531
- var ModalChoiceGroup = class extends BaseModalComponent {
532
- constructor(..._args2) {
533
- super(..._args2);
534
- this.options = [];
535
- }
536
- serialize() {
537
- return stripUndefinedFields({
538
- type: this.type,
539
- custom_id: this.customId,
540
- options: this.options,
541
- required: this.required,
542
- min_values: this.minValues,
543
- max_values: this.maxValues
544
- });
545
- }
546
- };
547
- var CheckboxGroup = class extends ModalChoiceGroup {
548
- constructor(..._args3) {
549
- super(..._args3);
550
- this.type = 22;
551
- }
552
- };
553
- var RadioGroup = class extends ModalChoiceGroup {
554
- constructor(..._args4) {
555
- super(..._args4);
556
- this.type = 21;
557
- }
558
- };
559
- var Label = class extends BaseModalComponent {
560
- constructor(component) {
561
- super();
562
- this.component = component;
563
- this.type = ComponentType.Label;
564
- this.customId = "";
565
- }
566
- serialize() {
567
- return stripUndefinedFields({
568
- type: this.type,
569
- label: this.label,
570
- description: this.description,
571
- component: this.component?.serialize()
572
- });
573
- }
574
- };
575
- var Modal = class {
576
- constructor() {
577
- this.components = [];
578
- this.customIdParser = parseCustomId;
579
- }
580
- serialize() {
581
- return {
582
- title: this.title,
583
- custom_id: this.customId,
584
- components: this.components.map((entry) => entry.serialize())
585
- };
586
- }
587
- };
588
- //#endregion
589
- //#region extensions/discord/src/internal/embeds.ts
590
- var Embed = class {
591
- constructor(embed) {
592
- Object.assign(this, embed);
593
- }
594
- serialize() {
595
- return stripUndefinedFields({
596
- title: this.title,
597
- description: this.description,
598
- url: this.url,
599
- timestamp: this.timestamp,
600
- color: this.color,
601
- footer: this.footer,
602
- image: typeof this.image === "string" ? { url: this.image } : this.image,
603
- thumbnail: typeof this.thumbnail === "string" ? { url: this.thumbnail } : this.thumbnail,
604
- author: this.author,
605
- fields: this.fields
606
- });
607
- }
608
- };
609
- //#endregion
610
- //#region extensions/discord/src/internal/payload.ts
611
- function hasDiscordV2Components(components) {
612
- return Boolean(components?.some((component) => "isV2" in component && component.isV2 || "type" in component && component.type !== ComponentType.ActionRow));
613
- }
614
- function normalizePayloadFlags(payload) {
615
- const flags = payload.ephemeral ? (payload.flags ?? 0) | MessageFlags.Ephemeral : payload.flags;
616
- if (!hasDiscordV2Components(payload.components)) return flags;
617
- if (payload.content || payload.embeds?.length) throw new Error("Discord Components V2 payloads cannot include content or embeds");
618
- return (flags ?? 0) | MessageFlags.IsComponentsV2;
619
- }
620
- function serializePayload(payload) {
621
- if (typeof payload === "string") return { content: payload };
622
- const flags = normalizePayloadFlags(payload);
623
- return stripUndefinedFields({
624
- content: payload.content,
625
- embeds: payload.embeds?.map((entry) => "serialize" in entry ? entry.serialize() : entry),
626
- components: payload.components?.map((entry) => "serialize" in entry ? entry.serialize() : entry),
627
- allowed_mentions: payload.allowed_mentions ?? payload.allowedMentions,
628
- flags,
629
- tts: payload.tts,
630
- files: payload.files,
631
- poll: payload.poll,
632
- sticker_ids: payload.stickers
633
- });
634
- }
635
- //#endregion
636
- //#region extensions/discord/src/internal/component-registry.ts
637
- var ComponentRegistry = class {
638
- constructor() {
639
- this.entries = /* @__PURE__ */ new Map();
640
- this.wildcardEntries = [];
641
- }
642
- register(entry) {
643
- const key = (entry.customIdParser ?? parseCustomId)(entry.customId).key;
644
- if (key === "*") {
645
- if (!this.wildcardEntries.includes(entry)) this.wildcardEntries.push(entry);
646
- return;
647
- }
648
- const entries = this.entries.get(key) ?? [];
649
- if (!entries.includes(entry)) {
650
- entries.push(entry);
651
- this.entries.set(key, entries);
652
- }
653
- }
654
- resolve(customId, options) {
655
- for (const entries of this.entries.values()) {
656
- const match = entries.find((entry) => {
657
- if (options?.componentType !== void 0 && entry.type !== options.componentType) return false;
658
- const parser = entry.customIdParser ?? parseCustomId;
659
- return parser(entry.customId).key === parser(customId).key;
660
- });
661
- if (match) return match;
662
- }
663
- return this.wildcardEntries.find((entry) => options?.componentType === void 0 || entry.type === options.componentType);
664
- }
665
- };
666
- //#endregion
667
- //#region extensions/discord/src/internal/structures.ts
668
- var Base = class {
669
- constructor(client) {
670
- this.client = client;
671
- }
672
- };
673
- var PartialEntity = class extends Base {
674
- constructor(client, rawDataOrId) {
675
- super(client);
676
- this.rawDataValue = typeof rawDataOrId === "string" ? null : rawDataOrId;
677
- this.id = typeof rawDataOrId === "string" ? rawDataOrId : rawDataOrId.id;
678
- }
679
- };
680
- var User = class extends PartialEntity {
681
- get rawData() {
682
- if (!this.rawDataValue) throw new Error("Partial Discord user has no raw data");
683
- return this.rawDataValue;
684
- }
685
- get partial() {
686
- return this.rawDataValue === null;
687
- }
688
- get username() {
689
- return this.rawDataValue?.username ?? "";
690
- }
691
- get globalName() {
692
- return this.rawDataValue?.global_name;
693
- }
694
- get discriminator() {
695
- return this.rawDataValue?.discriminator;
696
- }
697
- get bot() {
698
- return this.rawDataValue?.bot;
699
- }
700
- get avatar() {
701
- return this.rawDataValue?.avatar;
702
- }
703
- async fetch() {
704
- return this.client.fetchUser(this.id);
705
- }
706
- };
707
- var Role = class extends PartialEntity {
708
- get name() {
709
- return this.rawDataValue?.name ?? "";
710
- }
711
- };
712
- var Guild = class extends PartialEntity {
713
- get name() {
714
- return this.rawDataValue?.name ?? "";
715
- }
716
- get icon() {
717
- return this.rawDataValue?.icon;
718
- }
719
- };
720
- var GuildMember = class extends Base {
721
- constructor(client, rawData) {
722
- super(client);
723
- this.rawData = rawData;
724
- }
725
- get user() {
726
- return this.rawData.user ? new User(this.client, this.rawData.user) : null;
727
- }
728
- get roles() {
729
- return this.rawData.roles ?? [];
730
- }
731
- get nickname() {
732
- return this.rawData.nick ?? void 0;
733
- }
734
- };
735
- var Message = class Message extends Base {
736
- constructor(client, rawDataOrIds) {
737
- super(client);
738
- this.rawDataValue = typeof rawDataOrIds === "string" || !("author" in rawDataOrIds) ? null : rawDataOrIds;
739
- this.id = typeof rawDataOrIds === "string" ? rawDataOrIds : rawDataOrIds.id;
740
- this.channelId = typeof rawDataOrIds === "string" ? "" : "channel_id" in rawDataOrIds ? rawDataOrIds.channel_id : rawDataOrIds.channelId ?? "";
741
- }
742
- get rawData() {
743
- if (!this.rawDataValue) throw new Error("Partial Discord message has no raw data");
744
- return this.rawDataValue;
745
- }
746
- get partial() {
747
- return this.rawDataValue === null;
748
- }
749
- get message() {
750
- return this;
751
- }
752
- get channel_id() {
753
- return this.channelId;
754
- }
755
- get guild_id() {
756
- return this.rawDataValue?.guild_id;
757
- }
758
- get guild() {
759
- return this.guild_id ? new Guild(this.client, this.guild_id) : null;
760
- }
761
- get webhookId() {
762
- return this.webhook_id;
763
- }
764
- get webhook_id() {
765
- return this.rawDataValue?.webhook_id ?? null;
396
+ get webhook_id() {
397
+ return this.rawDataValue?.webhook_id ?? null;
766
398
  }
767
399
  get member() {
768
400
  const member = this.rawDataValue?.member;
@@ -815,7 +447,7 @@ var Message = class Message extends Base {
815
447
  return new Message(this.client, raw);
816
448
  }
817
449
  };
818
- function channelFactory(clientForTest, channelData, _partial) {
450
+ function channelFactory(clientForTest, channelData) {
819
451
  return {
820
452
  ...channelData,
821
453
  rawData: channelData,
@@ -852,25 +484,25 @@ var DiscordEntityCache = class {
852
484
  }
853
485
  async fetchUser(id) {
854
486
  return await this.fetchCached(`user:${id}`, async () => {
855
- const raw = await getUser(this.rest, id);
487
+ const raw = await getUser(this.params.rest(), id);
856
488
  return new User(this.params.client, raw);
857
489
  });
858
490
  }
859
491
  async fetchChannel(id) {
860
492
  return await this.fetchCached(`channel:${id}`, async () => {
861
- const raw = await getChannel(this.rest, id);
493
+ const raw = await getChannel(this.params.rest(), id);
862
494
  return channelFactory(this.params.client, raw);
863
495
  });
864
496
  }
865
497
  async fetchGuild(id) {
866
498
  return await this.fetchCached(`guild:${id}`, async () => {
867
- const raw = await getGuild(this.rest, id);
499
+ const raw = await getGuild(this.params.rest(), id);
868
500
  return new Guild(this.params.client, raw);
869
501
  });
870
502
  }
871
503
  async fetchMember(guildId, userId) {
872
504
  return await this.fetchCached(`member:${guildId}:${userId}`, async () => {
873
- const raw = await getGuildMember(this.rest, guildId, userId);
505
+ const raw = await getGuildMember(this.params.rest(), guildId, userId);
874
506
  return new GuildMember(this.params.client, raw);
875
507
  });
876
508
  }
@@ -888,54 +520,34 @@ var DiscordEntityCache = class {
888
520
  this.entries.delete(`member:${guildId}:${user.id}`);
889
521
  this.entries.delete(`user:${user.id}`);
890
522
  }
891
- } else this.deleteId(kind, kind === "guild-emojis" ? raw.guild_id : raw.id);
892
- }
893
- deleteId(prefix, id) {
894
- if (typeof id === "string") this.entries.delete(`${prefix}:${id}`);
523
+ } else {
524
+ const id = kind === "guild-emojis" ? raw.guild_id : raw.id;
525
+ if (typeof id === "string") this.entries.delete(`${kind}:${id}`);
526
+ }
895
527
  }
896
528
  async fetchCached(key, fetcher) {
897
- const ttl = this.params.ttlMs ?? DEFAULT_REST_CACHE_TTL_MS;
898
529
  const rawNow = Date.now();
899
530
  const now = asDateTimestampMs(rawNow);
900
- if (ttl > 0) {
901
- const cached = this.entries.get(key);
902
- if (cached && now !== void 0 && cached.expiresAt > now) return cached.value;
903
- if (cached) this.entries.delete(key);
904
- }
531
+ const cached = this.entries.get(key);
532
+ if (cached && now !== void 0 && cached.expiresAt > now) return cached.value;
533
+ if (cached) this.entries.delete(key);
905
534
  const value = await fetcher();
906
- if (ttl > 0) {
907
- const expiresAt = resolveExpiresAtMsFromDurationMs(ttl, { nowMs: rawNow });
908
- if (expiresAt !== void 0) {
909
- if (now !== void 0) this.maybeSweepExpired(now);
910
- this.entries.set(key, {
911
- expiresAt,
912
- value
913
- });
914
- this.enforceMaxEntries();
915
- }
535
+ const expiresAt = resolveExpiresAtMsFromDurationMs(DEFAULT_REST_CACHE_TTL_MS, { nowMs: rawNow });
536
+ if (expiresAt !== void 0) {
537
+ if (now !== void 0) this.maybeSweepExpired(now);
538
+ this.entries.set(key, {
539
+ expiresAt,
540
+ value
541
+ });
542
+ if (this.entries.size > DEFAULT_MAX_ENTRIES) this.entries.delete(this.entries.keys().next().value);
916
543
  }
917
544
  return value;
918
545
  }
919
546
  maybeSweepExpired(now) {
920
- const interval = this.params.sweepIntervalMs ?? DEFAULT_SWEEP_INTERVAL_MS;
921
- if (now - this.lastSweepAt < interval) return;
547
+ if (now - this.lastSweepAt < DEFAULT_SWEEP_INTERVAL_MS) return;
922
548
  this.lastSweepAt = now;
923
549
  for (const [key, entry] of this.entries) if (entry.expiresAt <= now) this.entries.delete(key);
924
550
  }
925
- enforceMaxEntries() {
926
- const max = this.params.maxEntries ?? DEFAULT_MAX_ENTRIES;
927
- if (this.entries.size <= max) return;
928
- const toRemove = this.entries.size - max;
929
- let removed = 0;
930
- for (const key of this.entries.keys()) {
931
- if (removed >= toRemove) break;
932
- this.entries.delete(key);
933
- removed += 1;
934
- }
935
- }
936
- get rest() {
937
- return typeof this.params.rest === "function" ? this.params.rest() : this.params.rest;
938
- }
939
551
  };
940
552
  //#endregion
941
553
  //#region extensions/discord/src/internal/event-queue.ts
@@ -987,11 +599,6 @@ var DiscordEventQueue = class {
987
599
  return Math.max(0, this.queue.length - this.queueHead);
988
600
  }
989
601
  takeNextJob() {
990
- if (this.queueHead >= this.queue.length) {
991
- this.queue.length = 0;
992
- this.queueHead = 0;
993
- return;
994
- }
995
602
  const job = this.queue[this.queueHead];
996
603
  this.queueHead += 1;
997
604
  if (this.queueHead >= this.queue.length) {
@@ -1024,12 +631,14 @@ var DiscordEventQueue = class {
1024
631
  const startedAt = Date.now();
1025
632
  try {
1026
633
  await raceWithTimeout(listenerPromise, this.options.listenerTimeout, () => {
1027
- throw createListenerTimeoutError(this.options.listenerTimeout);
634
+ const error = /* @__PURE__ */ new Error(`Listener timeout after ${this.options.listenerTimeout}ms`);
635
+ error.name = "DiscordEventQueueListenerTimeoutError";
636
+ throw error;
1028
637
  }, { ref: false });
1029
638
  this.logSlowListener(job, Date.now() - startedAt);
1030
639
  return "completed";
1031
640
  } catch (error) {
1032
- if (isListenerTimeoutError(error)) {
641
+ if (error instanceof Error && error.name === "DiscordEventQueueListenerTimeoutError") {
1033
642
  this.timeoutCount += 1;
1034
643
  console.error(`[EventQueue] Listener ${job.listenerName} timed out after ${this.options.listenerTimeout}ms for event ${job.eventType}`);
1035
644
  return "timed-out";
@@ -1047,22 +656,11 @@ function normalizePositiveInteger(value, fallback) {
1047
656
  if (typeof value !== "number" || !Number.isFinite(value) || value <= 0) return fallback;
1048
657
  return Math.max(1, Math.floor(value));
1049
658
  }
1050
- function createListenerTimeoutError(timeoutMs) {
1051
- const error = /* @__PURE__ */ new Error(`Listener timeout after ${timeoutMs}ms`);
1052
- error.name = "DiscordEventQueueListenerTimeoutError";
1053
- return error;
1054
- }
1055
- function isListenerTimeoutError(error) {
1056
- return error instanceof Error && error.name === "DiscordEventQueueListenerTimeoutError";
1057
- }
1058
659
  //#endregion
1059
660
  //#region extensions/discord/src/internal/commands.ts
1060
- function resolveConditionalCommandOption(value, interaction) {
1061
- return typeof value === "function" ? value(interaction) : value;
1062
- }
1063
661
  async function deferCommandInteractionIfNeeded(command, interaction) {
1064
- if (!resolveConditionalCommandOption(command.defer, interaction)) return;
1065
- await interaction.defer({ ephemeral: resolveConditionalCommandOption(command.ephemeral, interaction) });
662
+ if (!command.defer) return;
663
+ await interaction.defer({ ephemeral: command.ephemeral });
1066
664
  }
1067
665
  function readRawCommandOptions(interaction) {
1068
666
  const options = interaction.rawData.data?.options;
@@ -1075,31 +673,29 @@ function findSelectedSubcommand(subcommands, interaction) {
1075
673
  function resolveFocusedCommandOptionAutocompleteHandler(command, interaction) {
1076
674
  const focusedName = interaction.options.getFocused()?.name;
1077
675
  const options = command.commandKind === "group" ? findSelectedSubcommand(command.subcommands, interaction)?.options : command.options;
1078
- const autocomplete = focusedName ? options?.find((option) => option.name === focusedName)?.autocomplete : void 0;
1079
- return typeof autocomplete === "function" ? autocomplete : void 0;
676
+ const option = focusedName ? options?.find((candidate) => candidate.name === focusedName) : void 0;
677
+ if (option?.type === ApplicationCommandOptionType.String || option?.type === ApplicationCommandOptionType.Integer || option?.type === ApplicationCommandOptionType.Number) return typeof option.autocomplete === "function" ? option.autocomplete : void 0;
1080
678
  }
1081
679
  var BaseCommand = class {
1082
680
  constructor() {
1083
681
  this.defer = false;
1084
682
  this.ephemeral = false;
1085
- this.integrationTypes = [0, 1];
1086
- this.contexts = [
1087
- InteractionContextType.Guild,
1088
- InteractionContextType.BotDM,
1089
- InteractionContextType.PrivateChannel
1090
- ];
683
+ this.type = ApplicationCommandType.ChatInput;
1091
684
  }
1092
685
  serialize() {
1093
686
  return stripUndefinedFields({
1094
687
  name: this.name,
1095
- name_localizations: this.nameLocalizations,
1096
- description: this.type === ApplicationCommandType.ChatInput ? this.description ?? "" : void 0,
688
+ description: this.description ?? "",
1097
689
  description_localizations: this.descriptionLocalizations,
1098
690
  type: this.type,
1099
691
  options: this.serializeOptions(),
1100
- integration_types: this.integrationTypes,
1101
- contexts: this.contexts,
1102
- default_member_permissions: Array.isArray(this.permission) ? this.permission.reduce((sum, entry) => sum | entry, 0n).toString() : this.permission ? this.permission.toString() : null
692
+ integration_types: [0, 1],
693
+ contexts: [
694
+ InteractionContextType.Guild,
695
+ InteractionContextType.BotDM,
696
+ InteractionContextType.PrivateChannel
697
+ ],
698
+ default_member_permissions: null
1103
699
  });
1104
700
  }
1105
701
  };
@@ -1107,14 +703,14 @@ var Command = class extends BaseCommand {
1107
703
  constructor(..._args) {
1108
704
  super(..._args);
1109
705
  this.commandKind = "leaf";
1110
- this.type = ApplicationCommandType.ChatInput;
1111
706
  }
1112
707
  async autocomplete(interaction) {
1113
708
  throw new Error(`The ${interaction.rawData?.data?.name ?? this.name} command does not support autocomplete`);
1114
709
  }
1115
710
  serializeOptions() {
1116
711
  return this.options?.map((option) => {
1117
- if (typeof option.autocomplete === "function") {
712
+ const type = option.type;
713
+ if ((type === ApplicationCommandOptionType.String || type === ApplicationCommandOptionType.Integer || type === ApplicationCommandOptionType.Number) && typeof option.autocomplete === "function") {
1118
714
  const { autocomplete: _autocomplete, ...rest } = option;
1119
715
  return {
1120
716
  ...rest,
@@ -1129,7 +725,6 @@ var CommandWithSubcommands = class extends BaseCommand {
1129
725
  constructor(..._args2) {
1130
726
  super(..._args2);
1131
727
  this.commandKind = "group";
1132
- this.type = ApplicationCommandType.ChatInput;
1133
728
  }
1134
729
  async run(interaction) {
1135
730
  const subcommand = findSelectedSubcommand(this.subcommands, interaction);
@@ -1143,7 +738,6 @@ var CommandWithSubcommands = class extends BaseCommand {
1143
738
  serializeOptions() {
1144
739
  return this.subcommands.map((command) => stripUndefinedFields({
1145
740
  name: command.name,
1146
- name_localizations: command.nameLocalizations,
1147
741
  description: command.description ?? "",
1148
742
  description_localizations: command.descriptionLocalizations,
1149
743
  type: ApplicationCommandOptionType.Subcommand,
@@ -1156,14 +750,10 @@ var CommandWithSubcommands = class extends BaseCommand {
1156
750
  function findOption(options, matches) {
1157
751
  for (const option of options ?? []) {
1158
752
  if (matches(option)) return option;
1159
- const child = findOption(readChildOptions(option), matches);
753
+ const child = "options" in option && Array.isArray(option.options) ? findOption(option.options, matches) : void 0;
1160
754
  if (child) return child;
1161
755
  }
1162
756
  }
1163
- function readChildOptions(option) {
1164
- if (!("options" in option) || !Array.isArray(option.options)) return;
1165
- return option.options;
1166
- }
1167
757
  var OptionsHandler = class {
1168
758
  constructor(rawOptions, client, resolvedChannels) {
1169
759
  this.rawOptions = rawOptions;
@@ -1216,16 +806,14 @@ function extractModalFields(components) {
1216
806
  }
1217
807
  return out;
1218
808
  }
1219
- function flattenModalComponents(components) {
1220
- const out = [];
809
+ function* flattenModalComponents(components) {
1221
810
  for (const entry of components) {
1222
811
  if (!entry || typeof entry !== "object") continue;
1223
812
  const component = entry;
1224
- if (component.component && typeof component.component === "object") out.push(component.component);
1225
- if (Array.isArray(component.components)) out.push(...flattenModalComponents(component.components));
1226
- out.push(entry);
813
+ if (component.component && typeof component.component === "object") yield component.component;
814
+ if (Array.isArray(component.components)) yield* flattenModalComponents(component.components);
815
+ yield entry;
1227
816
  }
1228
- return out;
1229
817
  }
1230
818
  var ModalFields = class {
1231
819
  constructor(values, resolved, client) {
@@ -1267,6 +855,53 @@ var ModalFields = class {
1267
855
  }
1268
856
  };
1269
857
  //#endregion
858
+ //#region extensions/discord/src/internal/embeds.ts
859
+ var Embed = class {
860
+ constructor(embed) {
861
+ Object.assign(this, embed);
862
+ }
863
+ serialize() {
864
+ return stripUndefinedFields({
865
+ title: this.title,
866
+ description: this.description,
867
+ url: this.url,
868
+ timestamp: this.timestamp,
869
+ color: this.color,
870
+ footer: this.footer,
871
+ image: typeof this.image === "string" ? { url: this.image } : this.image,
872
+ thumbnail: typeof this.thumbnail === "string" ? { url: this.thumbnail } : this.thumbnail,
873
+ author: this.author,
874
+ fields: this.fields
875
+ });
876
+ }
877
+ };
878
+ //#endregion
879
+ //#region extensions/discord/src/internal/payload.ts
880
+ function hasDiscordV2Components(components) {
881
+ return Boolean(components?.some((component) => "isV2" in component && component.isV2 || "type" in component && component.type !== ComponentType.ActionRow));
882
+ }
883
+ function normalizePayloadFlags(payload) {
884
+ const flags = payload.ephemeral ? (payload.flags ?? 0) | MessageFlags.Ephemeral : payload.flags;
885
+ if (!hasDiscordV2Components(payload.components)) return flags;
886
+ if (payload.content || payload.embeds?.length) throw new Error("Discord Components V2 payloads cannot include content or embeds");
887
+ return (flags ?? 0) | MessageFlags.IsComponentsV2;
888
+ }
889
+ function serializePayload(payload) {
890
+ if (typeof payload === "string") return { content: payload };
891
+ const flags = normalizePayloadFlags(payload);
892
+ return stripUndefinedFields({
893
+ content: payload.content,
894
+ embeds: payload.embeds?.map((entry) => "serialize" in entry ? entry.serialize() : entry),
895
+ components: payload.components?.map((entry) => "serialize" in entry ? entry.serialize() : entry),
896
+ allowed_mentions: payload.allowed_mentions ?? payload.allowedMentions,
897
+ flags,
898
+ tts: payload.tts,
899
+ files: payload.files,
900
+ poll: payload.poll,
901
+ sticker_ids: payload.stickers
902
+ });
903
+ }
904
+ //#endregion
1270
905
  //#region extensions/discord/src/internal/schemas.ts
1271
906
  const discordInteractionPayloadSchema = Type.Object({
1272
907
  id: Type.String({ minLength: 1 }),
@@ -1303,7 +938,7 @@ var BaseInteraction = class {
1303
938
  this.client = client;
1304
939
  this.rawData = rawData;
1305
940
  this.message = null;
1306
- this.currentResponseState = "unacknowledged";
941
+ this.responseState = "unacknowledged";
1307
942
  this.pendingResponse = Promise.resolve();
1308
943
  this.sentFollowUp = false;
1309
944
  this.id = rawData.id;
@@ -1314,13 +949,7 @@ var BaseInteraction = class {
1314
949
  this.channel = "channel" in rawData && rawData.channel ? channelFactory(client, rawData.channel) : null;
1315
950
  }
1316
951
  get acknowledged() {
1317
- return this.currentResponseState !== "unacknowledged";
1318
- }
1319
- get responseState() {
1320
- return this.currentResponseState;
1321
- }
1322
- set responseState(nextState) {
1323
- this.currentResponseState = nextState;
952
+ return this.responseState !== "unacknowledged";
1324
953
  }
1325
954
  get hasSentFollowUp() {
1326
955
  return this.sentFollowUp;
@@ -1331,12 +960,12 @@ var BaseInteraction = class {
1331
960
  return result;
1332
961
  }
1333
962
  async performCallback(type, data) {
1334
- if (this.currentResponseState !== "unacknowledged") throw new Error("Discord interaction has already been acknowledged.");
963
+ if (this.responseState !== "unacknowledged") throw new Error("Discord interaction has already been acknowledged.");
1335
964
  const result = await this.client.rest.post(Routes.interactionCallback(this.id, this.token), { body: data === void 0 ? { type } : {
1336
965
  type,
1337
966
  data
1338
967
  } });
1339
- this.currentResponseState = type === InteractionResponseType.DeferredChannelMessageWithSource ? "deferred" : type === InteractionResponseType.DeferredMessageUpdate ? "deferred-update" : "replied";
968
+ this.responseState = type === InteractionResponseType.DeferredChannelMessageWithSource ? "deferred" : type === InteractionResponseType.DeferredMessageUpdate ? "deferred-update" : "replied";
1340
969
  return result;
1341
970
  }
1342
971
  async callback(type, data) {
@@ -1344,8 +973,8 @@ var BaseInteraction = class {
1344
973
  }
1345
974
  async reply(payload) {
1346
975
  return await this.enqueueResponse(async () => {
1347
- if (this.currentResponseState === "deferred" || this.currentResponseState === "deferred-update") return await this.performReplyEdit(payload);
1348
- if (this.currentResponseState !== "unacknowledged") return await this.performFollowUp(payload);
976
+ if (this.responseState === "deferred" || this.responseState === "deferred-update") return await this.performReplyEdit(payload);
977
+ if (this.responseState !== "unacknowledged") return await this.performFollowUp(payload);
1349
978
  return await this.performCallback(InteractionResponseType.ChannelMessageWithSource, serializePayload(payload));
1350
979
  });
1351
980
  }
@@ -1369,13 +998,13 @@ var BaseInteraction = class {
1369
998
  const body = serializePayload(payload);
1370
999
  const query = needsComponentsV2Query(body) ? { with_components: true } : void 0;
1371
1000
  const result = query ? await this.client.rest.patch(this.originalReplyRoute, { body }, query) : await this.client.rest.patch(this.originalReplyRoute, { body });
1372
- this.currentResponseState = "replied";
1001
+ this.responseState = "replied";
1373
1002
  return result;
1374
1003
  }
1375
1004
  async deleteReply() {
1376
1005
  return await this.enqueueResponse(async () => {
1377
1006
  const result = await this.client.rest.delete(this.originalReplyRoute);
1378
- this.currentResponseState = "replied";
1007
+ this.responseState = "replied";
1379
1008
  return result;
1380
1009
  });
1381
1010
  }
@@ -1440,23 +1069,20 @@ var ModalInteraction = class extends BaseInteraction {
1440
1069
  return await this.callback(InteractionResponseType.DeferredMessageUpdate);
1441
1070
  }
1442
1071
  };
1072
+ const componentInteractions = /* @__PURE__ */ new Map([
1073
+ [ComponentType.Button, ButtonInteraction],
1074
+ [ComponentType.StringSelect, StringSelectMenuInteraction],
1075
+ [ComponentType.UserSelect, UserSelectMenuInteraction],
1076
+ [ComponentType.RoleSelect, RoleSelectMenuInteraction],
1077
+ [ComponentType.MentionableSelect, MentionableSelectMenuInteraction],
1078
+ [ComponentType.ChannelSelect, ChannelSelectMenuInteraction]
1079
+ ]);
1443
1080
  function createInteraction(client, rawData) {
1444
1081
  assertDiscordInteractionPayload(rawData);
1445
1082
  if (rawData.type === InteractionType.ApplicationCommandAutocomplete) return new AutocompleteInteraction(client, rawData);
1446
1083
  if (rawData.type === InteractionType.ApplicationCommand) return new CommandInteraction(client, rawData);
1447
1084
  if (rawData.type === InteractionType.ModalSubmit) return new ModalInteraction(client, rawData);
1448
- if (rawData.type === InteractionType.MessageComponent) {
1449
- const componentRawData = rawData;
1450
- switch (rawData.data?.component_type) {
1451
- case ComponentType.Button: return new ButtonInteraction(client, componentRawData);
1452
- case ComponentType.StringSelect: return new StringSelectMenuInteraction(client, componentRawData);
1453
- case ComponentType.UserSelect: return new UserSelectMenuInteraction(client, componentRawData);
1454
- case ComponentType.RoleSelect: return new RoleSelectMenuInteraction(client, componentRawData);
1455
- case ComponentType.MentionableSelect: return new MentionableSelectMenuInteraction(client, componentRawData);
1456
- case ComponentType.ChannelSelect: return new ChannelSelectMenuInteraction(client, componentRawData);
1457
- default: return new BaseComponentInteraction(client, componentRawData);
1458
- }
1459
- }
1085
+ if (rawData.type === InteractionType.MessageComponent) return new ((componentInteractions.get(rawData.data?.component_type)) ?? BaseComponentInteraction)(client, rawData);
1460
1086
  return new BaseInteraction(client, rawData);
1461
1087
  }
1462
1088
  //#endregion
@@ -1511,8 +1137,7 @@ async function dispatchAcknowledgeableInteraction(client, rawData, interaction)
1511
1137
  }
1512
1138
  const INTERACTION_FAILURE_NOTICE = "Command failed. Check the Gateway logs for details.";
1513
1139
  async function reportInteractionFailure(interaction) {
1514
- if (interaction.responseState !== "deferred") return;
1515
- if (interaction.hasSentFollowUp) return;
1140
+ if (interaction.responseState !== "deferred" || interaction.hasSentFollowUp) return;
1516
1141
  try {
1517
1142
  await interaction.editDeferredPlaceholderIfUnanswered({
1518
1143
  content: INTERACTION_FAILURE_NOTICE,
@@ -1602,8 +1227,8 @@ function serializeRequestBody(data, headers) {
1602
1227
  return formData;
1603
1228
  }
1604
1229
  }
1605
- if (!data.rawBody) headers.set("Content-Type", "application/json");
1606
- return data.rawBody ? data.body : JSON.stringify(data.body);
1230
+ headers.set("Content-Type", "application/json");
1231
+ return JSON.stringify(data.body);
1607
1232
  }
1608
1233
  //#endregion
1609
1234
  //#region extensions/discord/src/internal/rest-errors.ts
@@ -1623,9 +1248,6 @@ const DISCORD_RATE_LIMIT_SCOPES = /* @__PURE__ */ new Set([
1623
1248
  "global",
1624
1249
  "shared"
1625
1250
  ]);
1626
- function isSensitiveDiscordErrorKey(key) {
1627
- return redactSensitiveFieldValue(key, "") !== "";
1628
- }
1629
1251
  function reserveRedactedKey(key, usedKeys, collisionCounts) {
1630
1252
  let count = (collisionCounts.get(key) ?? 0) + 1;
1631
1253
  let candidate = count === 1 ? key : `${key} [${count}]`;
@@ -1667,7 +1289,7 @@ function redactDiscordErrorBody(body, fieldKey = "", sensitiveAncestorKey, state
1667
1289
  const appendEntry = (nestedKey) => {
1668
1290
  if (state.remainingNodes <= 0) return false;
1669
1291
  const outputKey = reserveRedactedKey(redactSensitiveFieldValue(sensitiveAncestorKey ?? "", nestedKey), usedKeys, collisionCounts);
1670
- const nestedSensitiveKey = isSensitiveDiscordErrorKey(nestedKey) ? nestedKey : sensitiveAncestorKey;
1292
+ const nestedSensitiveKey = redactSensitiveFieldValue(nestedKey, "") !== "" ? nestedKey : sensitiveAncestorKey;
1671
1293
  entries.push([outputKey, redactDiscordErrorBody(body[nestedKey], nestedKey, nestedSensitiveKey, state, depth + 1)]);
1672
1294
  return true;
1673
1295
  };
@@ -1789,7 +1411,6 @@ function appendQuery(path, query) {
1789
1411
  }
1790
1412
  //#endregion
1791
1413
  //#region extensions/discord/src/internal/rest-scheduler.ts
1792
- const INVALID_REQUEST_WINDOW_MS = 6e5;
1793
1414
  const MAX_QUEUE_SIZE = 1e3;
1794
1415
  const MAX_CONCURRENT_WORKERS = 4;
1795
1416
  const MAX_RATE_LIMIT_RETRIES = 3;
@@ -1811,13 +1432,6 @@ const laneSchedule = [
1811
1432
  "standard",
1812
1433
  "background"
1813
1434
  ];
1814
- function createLaneQueues() {
1815
- return {
1816
- critical: [],
1817
- standard: [],
1818
- background: []
1819
- };
1820
- }
1821
1435
  function countPending(bucket) {
1822
1436
  return requestPriorities.reduce((count, lane) => count + bucket.pending[lane].length, 0);
1823
1437
  }
@@ -1827,13 +1441,7 @@ var RestScheduler = class {
1827
1441
  this.activeWorkers = 0;
1828
1442
  this.buckets = /* @__PURE__ */ new Map();
1829
1443
  this.globalRateLimitUntil = 0;
1830
- this.invalidRequestTimestamps = [];
1831
1444
  this.laneCursor = 0;
1832
- this.laneDropped = {
1833
- critical: 0,
1834
- standard: 0,
1835
- background: 0
1836
- };
1837
1445
  this.queuedByLane = {
1838
1446
  critical: 0,
1839
1447
  standard: 0,
@@ -1862,10 +1470,6 @@ var RestScheduler = class {
1862
1470
  this.drainQueues();
1863
1471
  });
1864
1472
  }
1865
- recordResponse(routeKey, path, response, parsed) {
1866
- this.updateRateLimitState(routeKey, path, response, parsed);
1867
- this.recordInvalidRequest(routeKey, path, response);
1868
- }
1869
1473
  clearQueue() {
1870
1474
  this.queueGeneration += 1;
1871
1475
  if (this.drainTimer) {
@@ -1881,45 +1485,16 @@ var RestScheduler = class {
1881
1485
  get queueSize() {
1882
1486
  return this.queuedRequests;
1883
1487
  }
1884
- getMetrics() {
1885
- this.pruneInvalidRequests();
1886
- return {
1887
- globalRateLimitUntil: this.globalRateLimitUntil,
1888
- activeBuckets: this.buckets.size,
1889
- routeBucketMappings: this.routeBuckets.size,
1890
- buckets: Array.from(this.buckets.entries()).map(([key, bucket]) => ({
1891
- key,
1892
- active: bucket.active,
1893
- bucket: bucket.bucket,
1894
- invalidRequests: bucket.invalidRequests,
1895
- pending: countPending(bucket),
1896
- pendingByLane: Object.fromEntries(requestPriorities.map((lane) => [lane, bucket.pending[lane].length])),
1897
- rateLimitHits: bucket.rateLimitHits,
1898
- remaining: bucket.remaining,
1899
- resetAt: bucket.resetAt,
1900
- routeKeyCount: bucket.routeKeys.size
1901
- })),
1902
- invalidRequestCount: this.invalidRequestTimestamps.length,
1903
- invalidRequestCountByStatus: this.invalidRequestTimestamps.reduce((counts, entry) => {
1904
- counts[entry.status] = (counts[entry.status] ?? 0) + 1;
1905
- return counts;
1906
- }, {}),
1907
- queueSize: this.queueSize,
1908
- queueSizeByLane: { ...this.queuedByLane },
1909
- droppedByLane: { ...this.laneDropped },
1910
- oldestQueuedByLane: Object.fromEntries(requestPriorities.map((lane) => [lane, this.getOldestQueuedAge(lane)])),
1911
- activeWorkers: this.activeWorkers,
1912
- maxConcurrentWorkers: MAX_CONCURRENT_WORKERS
1913
- };
1914
- }
1915
1488
  getBucket(key) {
1916
1489
  const existing = this.buckets.get(key);
1917
1490
  if (existing) return existing;
1918
1491
  const bucket = {
1919
1492
  active: 0,
1920
- invalidRequests: 0,
1921
- pending: createLaneQueues(),
1922
- rateLimitHits: 0,
1493
+ pending: {
1494
+ critical: [],
1495
+ standard: [],
1496
+ background: []
1497
+ },
1923
1498
  resetAt: 0,
1924
1499
  routeKeys: /* @__PURE__ */ new Set([key])
1925
1500
  };
@@ -1947,10 +1522,9 @@ var RestScheduler = class {
1947
1522
  }
1948
1523
  return target;
1949
1524
  }
1950
- updateRateLimitState(routeKey, path, response, parsed) {
1525
+ recordResponse(routeKey, path, response, parsed) {
1951
1526
  const bucketHeader = readDiscordRateLimitBucket(response);
1952
1527
  const bucket = bucketHeader ? this.bindRouteToBucket(routeKey, createBucketKey(bucketHeader, path)) : this.getBucket(this.routeBuckets.get(routeKey) ?? routeKey);
1953
- bucket.bucket = bucketHeader ?? bucket.bucket;
1954
1528
  const limit = readHeaderNumber(response.headers, "X-RateLimit-Limit");
1955
1529
  if (limit !== void 0) bucket.limit = limit;
1956
1530
  const remaining = readHeaderNumber(response.headers, "X-RateLimit-Remaining");
@@ -1958,7 +1532,6 @@ var RestScheduler = class {
1958
1532
  const resetAt = readResetAt(response);
1959
1533
  if (resetAt !== void 0) bucket.resetAt = resetAt;
1960
1534
  if (response.status !== 429) return;
1961
- bucket.rateLimitHits += 1;
1962
1535
  const retryAt = resolveRateLimitResetAt(Math.max(0, readRetryAfter(parsed, response, 1) * 1e3));
1963
1536
  if (retryAt === void 0) return;
1964
1537
  if (response.headers.get("X-RateLimit-Global") === "true" || isGlobalRateLimit(parsed)) {
@@ -1968,24 +1541,6 @@ var RestScheduler = class {
1968
1541
  bucket.remaining = 0;
1969
1542
  bucket.resetAt = Math.max(bucket.resetAt, retryAt);
1970
1543
  }
1971
- recordInvalidRequest(routeKey, path, response) {
1972
- if (response.status !== 401 && response.status !== 403 && response.status !== 429) return;
1973
- if (response.status === 429 && response.headers.get("X-RateLimit-Scope") === "shared") return;
1974
- const now = Date.now();
1975
- this.invalidRequestTimestamps.push({
1976
- at: now,
1977
- status: response.status
1978
- });
1979
- this.pruneInvalidRequests(now);
1980
- const bucketHeader = readDiscordRateLimitBucket(response);
1981
- const bucketKey = bucketHeader ? createBucketKey(bucketHeader, path) : this.routeBuckets.get(routeKey) ?? routeKey;
1982
- const bucket = this.buckets.get(bucketKey);
1983
- if (bucket) bucket.invalidRequests += 1;
1984
- }
1985
- pruneInvalidRequests(now = Date.now()) {
1986
- const cutoff = now - INVALID_REQUEST_WINDOW_MS;
1987
- while (this.invalidRequestTimestamps.length > 0 && (this.invalidRequestTimestamps[0]?.at ?? 0) <= cutoff) this.invalidRequestTimestamps.shift();
1988
- }
1989
1544
  getBucketWaitMs(bucket, now) {
1990
1545
  if (bucket.remaining === 0 && bucket.resetAt > now) return bucket.resetAt - now;
1991
1546
  if (bucket.remaining === 0 && bucket.resetAt <= now) bucket.remaining = bucket.limit;
@@ -2000,11 +1555,10 @@ var RestScheduler = class {
2000
1555
  this.drainTimer.unref?.();
2001
1556
  }
2002
1557
  drainQueues() {
2003
- let nextDelayMs = Number.POSITIVE_INFINITY;
2004
1558
  while (this.activeWorkers < MAX_CONCURRENT_WORKERS) {
2005
1559
  const next = this.takeNextQueuedRequest();
2006
1560
  if (!next.queued) {
2007
- if (next.waitMs !== void 0) nextDelayMs = Math.min(nextDelayMs, next.waitMs);
1561
+ if (next.waitMs !== void 0 && Number.isFinite(next.waitMs)) this.scheduleDrain(next.waitMs);
2008
1562
  break;
2009
1563
  }
2010
1564
  const { bucket, queued } = next;
@@ -2013,7 +1567,6 @@ var RestScheduler = class {
2013
1567
  this.activeWorkers += 1;
2014
1568
  this.runQueuedRequest(queued, bucket);
2015
1569
  }
2016
- if (Number.isFinite(nextDelayMs)) this.scheduleDrain(nextDelayMs);
2017
1570
  }
2018
1571
  takeNextQueuedRequest() {
2019
1572
  const now = Date.now();
@@ -2028,8 +1581,7 @@ var RestScheduler = class {
2028
1581
  for (const bucket of buckets) {
2029
1582
  const queue = bucket.pending[lane];
2030
1583
  this.dropStaleHeadRequests(queue, lane, now);
2031
- if (queue.length === 0) continue;
2032
- if (bucket.active > 0) continue;
1584
+ if (queue.length === 0 || bucket.active > 0) continue;
2033
1585
  const waitMs = this.getBucketWaitMs(bucket, now);
2034
1586
  if (waitMs > 0) {
2035
1587
  nextDelayMs = Math.min(nextDelayMs ?? waitMs, waitMs);
@@ -2054,7 +1606,6 @@ var RestScheduler = class {
2054
1606
  if (!stale) continue;
2055
1607
  this.queuedRequests = Math.max(0, this.queuedRequests - 1);
2056
1608
  this.queuedByLane[lane] = Math.max(0, this.queuedByLane[lane] - 1);
2057
- this.laneDropped[lane] += 1;
2058
1609
  stale.reject(/* @__PURE__ */ new Error(`Dropped stale ${lane} request after ${now - stale.enqueuedAt}ms`));
2059
1610
  }
2060
1611
  }
@@ -2107,16 +1658,6 @@ var RestScheduler = class {
2107
1658
  this.queuedByLane[lane] = Math.max(0, this.queuedByLane[lane] - 1);
2108
1659
  }
2109
1660
  }
2110
- getOldestQueuedAge(lane) {
2111
- const now = Date.now();
2112
- let oldest = 0;
2113
- for (const bucket of this.buckets.values()) {
2114
- const queued = bucket.pending[lane][0];
2115
- if (!queued) continue;
2116
- oldest = Math.max(oldest, now - queued.enqueuedAt);
2117
- }
2118
- return oldest;
2119
- }
2120
1661
  };
2121
1662
  function isGlobalRateLimit(parsed) {
2122
1663
  return parsed && typeof parsed === "object" && "global" in parsed ? Boolean(parsed.global) : false;
@@ -2124,10 +1665,7 @@ function isGlobalRateLimit(parsed) {
2124
1665
  //#endregion
2125
1666
  //#region extensions/discord/src/internal/rest.ts
2126
1667
  const defaultOptions = {
2127
- tokenHeader: "Bot",
2128
1668
  baseUrl: "https://discord.com/api",
2129
- apiVersion: 10,
2130
- userAgent: "OpenClaw Discord",
2131
1669
  timeout: 15e3,
2132
1670
  queueRequests: true
2133
1671
  };
@@ -2137,32 +1675,27 @@ function createResponseBodyOverflowError(size) {
2137
1675
  return /* @__PURE__ */ new Error(`Discord REST response body exceeds ${DISCORD_REST_RESPONSE_BODY_MAX_BYTES} bytes (received ${size})`);
2138
1676
  }
2139
1677
  async function readResponseBodyText(response, idleTimeoutMs) {
2140
- return decodeResponseBody(await readResponseWithLimit(response, DISCORD_REST_RESPONSE_BODY_MAX_BYTES, {
1678
+ const buffer = await readResponseWithLimit(response, DISCORD_REST_RESPONSE_BODY_MAX_BYTES, {
2141
1679
  chunkTimeoutMs: idleTimeoutMs,
2142
1680
  onOverflow: ({ size }) => createResponseBodyOverflowError(size),
2143
1681
  onIdleTimeout: ({ chunkTimeoutMs }) => /* @__PURE__ */ new Error(`Discord REST response stalled: no data received for ${chunkTimeoutMs}ms`)
2144
- }));
2145
- }
2146
- function coerceResponseBody(raw) {
2147
- if (!raw) return;
2148
- try {
2149
- return JSON.parse(raw);
2150
- } catch {
2151
- return raw;
2152
- }
2153
- }
2154
- function decodeResponseBody(buffer) {
1682
+ });
2155
1683
  if (!buffer.byteLength) return "";
2156
1684
  if (buffer[0] === GZIP_MAGIC[0] && buffer[1] === GZIP_MAGIC[1]) try {
2157
1685
  return gunzipSync(buffer, { maxOutputLength: DISCORD_REST_RESPONSE_BODY_MAX_BYTES }).toString("utf8");
2158
1686
  } catch (err) {
2159
- if (isZlibMaxOutputLengthError(err)) throw createResponseBodyOverflowError("decompressed output");
1687
+ if (err instanceof RangeError && "code" in err && err.code === "ERR_BUFFER_TOO_LARGE") throw createResponseBodyOverflowError("decompressed output");
2160
1688
  throw err;
2161
1689
  }
2162
- return buffer.toString("utf8");
2163
- }
2164
- function isZlibMaxOutputLengthError(err) {
2165
- return err instanceof RangeError && "code" in err && err.code === "ERR_BUFFER_TOO_LARGE";
1690
+ return buffer.toString("utf8");
1691
+ }
1692
+ function coerceResponseBody(raw) {
1693
+ if (!raw) return;
1694
+ try {
1695
+ return JSON.parse(raw);
1696
+ } catch {
1697
+ return raw;
1698
+ }
2166
1699
  }
2167
1700
  var RequestClient = class {
2168
1701
  constructor(token, options) {
@@ -2175,11 +1708,12 @@ var RequestClient = class {
2175
1708
  } : options;
2176
1709
  this.token = token.replace(/^Bot\s+/i, "");
2177
1710
  this.customFetch = resolvedOptions?.fetch;
1711
+ this.guardedEndpoint = endpoint !== void 0;
2178
1712
  this.options = normalizeRequestClientOptions(resolvedOptions);
2179
1713
  this.scheduler = new RestScheduler(async (request) => await this.executeRequest(request.method, request.path, {
2180
1714
  data: request.data?.data,
2181
1715
  query: request.query
2182
- }, request.routeKey, request.data?.assertCurrent));
1716
+ }, request.routeKey, request.data?.assertCurrent, request.data?.effect));
2183
1717
  }
2184
1718
  async get(path, query) {
2185
1719
  return await this.request("GET", path, { query });
@@ -2212,12 +1746,13 @@ var RequestClient = class {
2212
1746
  const routeKey = createRouteKey(method, path);
2213
1747
  const assertActionAuthority = captureDiscordRequestAuthority();
2214
1748
  const assertReadAuthority = captureChannelReadAuthority();
1749
+ const effect = captureEffectAuthority();
2215
1750
  const assertCurrent = assertActionAuthority ? () => {
2216
1751
  assertActionAuthority();
2217
1752
  assertReadAuthority?.();
2218
1753
  } : assertReadAuthority;
2219
1754
  assertCurrent?.();
2220
- if (!this.options.queueRequests) return await this.executeRequest(method, path, params, routeKey, assertCurrent);
1755
+ if (!this.options.queueRequests) return await this.executeRequest(method, path, params, routeKey, assertCurrent, effect);
2221
1756
  return await this.scheduler.enqueue({
2222
1757
  method,
2223
1758
  path,
@@ -2225,17 +1760,18 @@ var RequestClient = class {
2225
1760
  query: params.query,
2226
1761
  data: {
2227
1762
  data: params.data,
2228
- assertCurrent
1763
+ assertCurrent,
1764
+ effect
2229
1765
  }
2230
1766
  });
2231
1767
  }
2232
- async executeRequest(method, path, params, routeKey = createRouteKey(method, path), assertCurrent) {
1768
+ async executeRequest(method, path, params, routeKey = createRouteKey(method, path), assertCurrent, effect = captureEffectAuthority()) {
2233
1769
  const url = `${this.options.apiBaseUrl}${appendQuery(path, params.query)}`;
2234
- const headers = new Headers({ "User-Agent": this.options.userAgent ?? defaultOptions.userAgent });
2235
- if (this.token !== "webhook") headers.set("Authorization", `${this.options.tokenHeader ?? "Bot"} ${this.token}`);
1770
+ const headers = new Headers({ "User-Agent": "OpenClaw Discord" });
1771
+ if (this.token !== "webhook") headers.set("Authorization", `Bot ${this.token}`);
2236
1772
  const body = serializeRequestBody(params.data, headers);
2237
1773
  const controller = new AbortController();
2238
- const timeout = setTimeout(() => controller.abort(), this.options.timeout ?? 15e3);
1774
+ const timeout = setTimeout(() => controller.abort(), this.options.timeout);
2239
1775
  timeout.unref?.();
2240
1776
  const signal = this.options.signal ? AbortSignal.any([this.options.signal, controller.signal]) : controller.signal;
2241
1777
  this.requestControllers.add(controller);
@@ -2247,8 +1783,15 @@ var RequestClient = class {
2247
1783
  body,
2248
1784
  signal
2249
1785
  };
2250
- const response = this.customFetch && assertCurrent ? await this.customFetch(url, init, assertCurrent) : await (this.customFetch ?? fetch)(url, init);
2251
- const parsed = coerceResponseBody(await readResponseBodyText(response, this.options.timeout ?? 15e3));
1786
+ const request = () => {
1787
+ assertCurrent?.();
1788
+ return this.customFetch && assertCurrent ? this.customFetch(url, init, assertCurrent) : (this.customFetch ?? fetch)(url, init);
1789
+ };
1790
+ const response = this.guardedEndpoint ? await effect.run(request) : await effect.initiate(request);
1791
+ const parsed = coerceResponseBody(await readResponseBodyText(response, this.options.timeout).catch((error) => {
1792
+ if (response.ok) throw error;
1793
+ return "";
1794
+ }));
2252
1795
  this.scheduler.recordResponse(routeKey, path, response, parsed);
2253
1796
  if (response.status === 204) return;
2254
1797
  if (response.status === 429) {
@@ -2270,118 +1813,417 @@ var RequestClient = class {
2270
1813
  this.requestControllers.delete(controller);
2271
1814
  }
2272
1815
  }
2273
- clearQueue() {
2274
- this.scheduler.clearQueue();
1816
+ clearQueue() {
1817
+ this.scheduler.clearQueue();
1818
+ }
1819
+ get queueSize() {
1820
+ return this.scheduler.queueSize;
1821
+ }
1822
+ abortAllRequests() {
1823
+ this.scheduler.abortPending();
1824
+ for (const controller of this.requestControllers) controller.abort();
1825
+ this.requestControllers.clear();
1826
+ }
1827
+ };
1828
+ function normalizeRequestClientOptions(options) {
1829
+ const merged = {
1830
+ ...defaultOptions,
1831
+ ...options
1832
+ };
1833
+ return {
1834
+ ...merged,
1835
+ apiBaseUrl: options?.apiBaseUrl ?? `${options?.baseUrl ?? defaultOptions.baseUrl}/v10`,
1836
+ timeout: clampTimerTimeoutMs(merged.timeout, 1) ?? resolveTimerTimeoutMs(defaultOptions.timeout, 1)
1837
+ };
1838
+ }
1839
+ function getRequestPriority(method, path) {
1840
+ const normalizedMethod = method.toUpperCase();
1841
+ const normalizedPath = path.toLowerCase();
1842
+ if (/^\/interactions\/\d+\/[^/]+\/callback$/.test(normalizedPath)) return "critical";
1843
+ return normalizedMethod === "GET" ? "background" : "standard";
1844
+ }
1845
+ //#endregion
1846
+ //#region extensions/discord/src/internal/client.ts
1847
+ var Plugin = class {};
1848
+ var Client = class {
1849
+ constructor(options, handlers, plugins = []) {
1850
+ this.plugins = [];
1851
+ this.componentHandler = new ComponentRegistry();
1852
+ this.modalHandler = new ComponentRegistry();
1853
+ if (!options.clientId) throw new Error("Missing Discord application ID");
1854
+ if (!options.token) throw new Error("Missing Discord bot token");
1855
+ this.options = { ...options };
1856
+ this.commands = handlers.commands ?? [];
1857
+ this.listeners = handlers.listeners ?? [];
1858
+ this.rest = new RequestClient(options.token, options.requestOptions);
1859
+ this.eventQueue = this.options.eventQueue ? new DiscordEventQueue(this.options.eventQueue) : void 0;
1860
+ this.entityCache = new DiscordEntityCache({
1861
+ client: this,
1862
+ rest: () => this.rest
1863
+ });
1864
+ this.commandDeployer = new DiscordCommandDeployer({
1865
+ clientId: this.options.clientId,
1866
+ commands: this.commands,
1867
+ hashStore: this.options.commandDeployHashStore,
1868
+ rest: () => this.rest
1869
+ });
1870
+ for (const component of handlers.components ?? []) this.componentHandler.register(component);
1871
+ for (const modal of handlers.modals ?? []) this.modalHandler.register(modal);
1872
+ for (const plugin of plugins) {
1873
+ plugin.registerClient?.(this);
1874
+ this.plugins.push(plugin);
1875
+ }
1876
+ }
1877
+ getPlugin(id) {
1878
+ return this.plugins.find((plugin) => plugin.id === id);
1879
+ }
1880
+ getRuntimeMetrics() {
1881
+ return { eventQueue: this.eventQueue?.getMetrics() };
1882
+ }
1883
+ async fetchUser(id) {
1884
+ return await this.entityCache.fetchUser(id);
1885
+ }
1886
+ async fetchChannel(id) {
1887
+ return await this.entityCache.fetchChannel(id);
1888
+ }
1889
+ async fetchGuild(id) {
1890
+ return await this.entityCache.fetchGuild(id);
1891
+ }
1892
+ async fetchMember(guildId, userId) {
1893
+ return await this.entityCache.fetchMember(guildId, userId);
1894
+ }
1895
+ async fetchGuildEmojis(guildId, fetcher) {
1896
+ return await this.entityCache.fetchGuildEmojis(guildId, fetcher);
1897
+ }
1898
+ async deployCommands() {
1899
+ return await this.commandDeployer.deploy();
1900
+ }
1901
+ async handleInteraction(rawData) {
1902
+ await dispatchInteraction(this, rawData);
1903
+ }
1904
+ async dispatchGatewayEvent(type, data) {
1905
+ this.entityCache.invalidateForGatewayEvent(type, data);
1906
+ const listeners = this.listeners.filter((entry) => entry.type === type);
1907
+ if (!this.eventQueue) {
1908
+ for (const listener of listeners) await listener.handle(data, this);
1909
+ return;
1910
+ }
1911
+ await Promise.all(listeners.map((listener) => this.eventQueue.enqueue({
1912
+ eventType: type,
1913
+ listenerName: listener.constructor.name || "AnonymousListener",
1914
+ run: async () => {
1915
+ await listener.handle(data, this);
1916
+ }
1917
+ })));
1918
+ }
1919
+ };
1920
+ //#endregion
1921
+ //#region extensions/discord/src/internal/components.message.ts
1922
+ var BaseButton = class extends BaseMessageInteractiveComponent {
1923
+ constructor(..._args) {
1924
+ super(..._args);
1925
+ this.type = ComponentType.Button;
1926
+ this.style = ButtonStyle.Primary;
1927
+ this.disabled = false;
1928
+ }
1929
+ serialize() {
1930
+ const link = this instanceof LinkButton;
1931
+ return stripUndefinedFields({
1932
+ type: this.type,
1933
+ style: this.style,
1934
+ custom_id: link ? void 0 : this.customId,
1935
+ label: this.label,
1936
+ emoji: this.emoji,
1937
+ disabled: this.disabled || void 0,
1938
+ url: link ? this.url : void 0
1939
+ });
1940
+ }
1941
+ };
1942
+ var Button = class extends BaseButton {};
1943
+ var LinkButton = class extends BaseButton {
1944
+ constructor(..._args2) {
1945
+ super(..._args2);
1946
+ this.customId = "";
1947
+ this.style = ButtonStyle.Link;
1948
+ }
1949
+ async run() {
1950
+ throw new Error("Link buttons do not run handlers");
1951
+ }
1952
+ };
1953
+ var AnySelectMenu = class extends BaseMessageInteractiveComponent {
1954
+ constructor(..._args3) {
1955
+ super(..._args3);
1956
+ this.disabled = false;
1957
+ }
1958
+ serializeOptions() {
1959
+ return {
1960
+ type: this.type,
1961
+ default_values: this.defaultValues
1962
+ };
1963
+ }
1964
+ serialize() {
1965
+ return stripUndefinedFields({
1966
+ ...this.serializeOptions(),
1967
+ custom_id: this.customId,
1968
+ placeholder: this.placeholder,
1969
+ min_values: this.minValues,
1970
+ max_values: this.maxValues,
1971
+ disabled: this.disabled || void 0,
1972
+ required: this.required
1973
+ });
1974
+ }
1975
+ };
1976
+ var StringSelectMenu = class extends AnySelectMenu {
1977
+ constructor(..._args4) {
1978
+ super(..._args4);
1979
+ this.type = ComponentType.StringSelect;
1980
+ }
1981
+ serializeOptions() {
1982
+ return {
1983
+ type: this.type,
1984
+ options: this.options
1985
+ };
1986
+ }
1987
+ };
1988
+ var UserSelectMenu = class extends AnySelectMenu {
1989
+ constructor(..._args5) {
1990
+ super(..._args5);
1991
+ this.type = ComponentType.UserSelect;
1992
+ }
1993
+ };
1994
+ var RoleSelectMenu = class extends AnySelectMenu {
1995
+ constructor(..._args6) {
1996
+ super(..._args6);
1997
+ this.type = ComponentType.RoleSelect;
1998
+ }
1999
+ };
2000
+ var MentionableSelectMenu = class extends AnySelectMenu {
2001
+ constructor(..._args7) {
2002
+ super(..._args7);
2003
+ this.type = ComponentType.MentionableSelect;
2004
+ }
2005
+ };
2006
+ var ChannelSelectMenu = class extends AnySelectMenu {
2007
+ constructor(..._args8) {
2008
+ super(..._args8);
2009
+ this.type = ComponentType.ChannelSelect;
2010
+ }
2011
+ serializeOptions() {
2012
+ return {
2013
+ type: this.type,
2014
+ default_values: this.defaultValues,
2015
+ channel_types: this.channelTypes
2016
+ };
2017
+ }
2018
+ };
2019
+ var Row = class extends BaseComponent {
2020
+ constructor(components = []) {
2021
+ super();
2022
+ this.components = components;
2023
+ this.type = ComponentType.ActionRow;
2024
+ this.isV2 = false;
2025
+ }
2026
+ addComponent(component) {
2027
+ this.components.push(component);
2028
+ }
2029
+ serialize() {
2030
+ return {
2031
+ type: this.type,
2032
+ components: this.components.map((entry) => entry.serialize())
2033
+ };
2034
+ }
2035
+ };
2036
+ var V2Component = class extends BaseComponent {
2037
+ constructor(..._args9) {
2038
+ super(..._args9);
2039
+ this.isV2 = true;
2040
+ }
2041
+ };
2042
+ var TextDisplay = class extends V2Component {
2043
+ constructor(content) {
2044
+ super();
2045
+ this.content = content;
2046
+ this.type = ComponentType.TextDisplay;
2047
+ }
2048
+ serialize() {
2049
+ return stripUndefinedFields({
2050
+ type: this.type,
2051
+ content: this.content
2052
+ });
2053
+ }
2054
+ };
2055
+ var Separator = class extends V2Component {
2056
+ constructor(options) {
2057
+ super();
2058
+ this.type = ComponentType.Separator;
2059
+ this.divider = true;
2060
+ this.spacing = "small";
2061
+ this.spacing = options?.spacing ?? this.spacing;
2062
+ this.divider = options?.divider ?? this.divider;
2063
+ }
2064
+ serialize() {
2065
+ return stripUndefinedFields({
2066
+ type: this.type,
2067
+ divider: this.divider,
2068
+ spacing: this.spacing === "large" ? 2 : this.spacing === "small" ? 1 : this.spacing
2069
+ });
2070
+ }
2071
+ };
2072
+ var Thumbnail = class extends V2Component {
2073
+ constructor(url) {
2074
+ super();
2075
+ this.url = url;
2076
+ this.type = ComponentType.Thumbnail;
2077
+ }
2078
+ serialize() {
2079
+ return stripUndefinedFields({
2080
+ type: this.type,
2081
+ media: this.url ? { url: this.url } : void 0
2082
+ });
2275
2083
  }
2276
- get queueSize() {
2277
- return this.scheduler.queueSize;
2084
+ };
2085
+ var Section = class extends V2Component {
2086
+ constructor(components = [], accessory) {
2087
+ super();
2088
+ this.components = components;
2089
+ this.accessory = accessory;
2090
+ this.type = ComponentType.Section;
2278
2091
  }
2279
- getSchedulerMetrics() {
2280
- return this.scheduler.getMetrics();
2092
+ serialize() {
2093
+ return stripUndefinedFields({
2094
+ type: this.type,
2095
+ components: this.components.map((entry) => entry.serialize()),
2096
+ accessory: this.accessory?.serialize()
2097
+ });
2281
2098
  }
2282
- abortAllRequests() {
2283
- this.scheduler.abortPending();
2284
- for (const controller of this.requestControllers) controller.abort();
2285
- this.requestControllers.clear();
2099
+ };
2100
+ var MediaGallery = class extends V2Component {
2101
+ constructor(items = []) {
2102
+ super();
2103
+ this.items = items;
2104
+ this.type = ComponentType.MediaGallery;
2105
+ }
2106
+ serialize() {
2107
+ return {
2108
+ type: this.type,
2109
+ items: this.items.map((entry) => ({
2110
+ media: { url: entry.url },
2111
+ description: entry.description,
2112
+ spoiler: entry.spoiler
2113
+ }))
2114
+ };
2286
2115
  }
2287
2116
  };
2288
- function normalizeRequestClientOptions(options) {
2289
- const merged = {
2290
- ...defaultOptions,
2291
- ...options
2292
- };
2293
- const apiVersion = resolveIntegerOption(merged.apiVersion, defaultOptions.apiVersion, { min: 1 });
2294
- return {
2295
- ...merged,
2296
- apiBaseUrl: options?.apiBaseUrl ?? `${options?.baseUrl ?? defaultOptions.baseUrl}/v${apiVersion}`,
2297
- apiVersion,
2298
- timeout: clampTimerTimeoutMs(merged.timeout, 1) ?? resolveTimerTimeoutMs(defaultOptions.timeout, 1)
2299
- };
2300
- }
2301
- function getRequestPriority(method, path) {
2302
- const normalizedMethod = method.toUpperCase();
2303
- const normalizedPath = path.toLowerCase();
2304
- if (/^\/interactions\/\d+\/[^/]+\/callback$/.test(normalizedPath)) return "critical";
2305
- return normalizedMethod === "GET" ? "background" : "standard";
2306
- }
2307
- //#endregion
2308
- //#region extensions/discord/src/internal/client.ts
2309
- var Plugin = class {};
2310
- var Client = class {
2311
- constructor(options, handlers, plugins = []) {
2312
- this.plugins = [];
2313
- this.componentHandler = new ComponentRegistry();
2314
- this.modalHandler = new ComponentRegistry();
2315
- if (!options.clientId) throw new Error("Missing Discord application ID");
2316
- if (!options.token) throw new Error("Missing Discord bot token");
2317
- this.options = { ...options };
2318
- this.commands = handlers.commands ?? [];
2319
- this.listeners = handlers.listeners ?? [];
2320
- this.rest = new RequestClient(options.token, options.requestOptions);
2321
- this.eventQueue = this.options.eventQueue ? new DiscordEventQueue(this.options.eventQueue) : void 0;
2322
- this.entityCache = new DiscordEntityCache({
2323
- client: this,
2324
- rest: () => this.rest,
2325
- ttlMs: this.options.restCacheTtlMs
2117
+ var File = class extends V2Component {
2118
+ constructor(file, spoiler = false) {
2119
+ super();
2120
+ this.file = file;
2121
+ this.spoiler = spoiler;
2122
+ this.type = ComponentType.File;
2123
+ }
2124
+ serialize() {
2125
+ return stripUndefinedFields({
2126
+ type: this.type,
2127
+ file: this.file ? { url: this.file } : void 0,
2128
+ spoiler: this.spoiler || void 0
2326
2129
  });
2327
- this.commandDeployer = new DiscordCommandDeployer({
2328
- clientId: this.options.clientId,
2329
- commands: this.commands,
2330
- hashStore: this.options.commandDeployHashStore,
2331
- rest: () => this.rest
2130
+ }
2131
+ };
2132
+ var Container = class extends V2Component {
2133
+ constructor(components = [], options) {
2134
+ super();
2135
+ this.components = components;
2136
+ this.type = ComponentType.Container;
2137
+ this.spoiler = false;
2138
+ this.accentColor = options?.accentColor;
2139
+ this.spoiler = options?.spoiler ?? false;
2140
+ }
2141
+ serialize() {
2142
+ return stripUndefinedFields({
2143
+ type: this.type,
2144
+ components: this.components.map((entry) => entry.serialize()),
2145
+ accent_color: colorToNumber(this.accentColor),
2146
+ spoiler: this.spoiler || void 0
2332
2147
  });
2333
- for (const component of handlers.components ?? []) this.componentHandler.register(component);
2334
- for (const command of this.commands) for (const component of command.components ?? []) this.componentHandler.register(component);
2335
- for (const modal of handlers.modals ?? []) this.modalHandler.register(modal);
2336
- for (const plugin of plugins) {
2337
- plugin.registerClient?.(this);
2338
- this.plugins.push(plugin);
2339
- }
2340
2148
  }
2341
- getPlugin(id) {
2342
- return this.plugins.find((plugin) => plugin.id === id);
2149
+ };
2150
+ //#endregion
2151
+ //#region extensions/discord/src/internal/components.modal.ts
2152
+ var TextInput = class extends BaseModalComponent {
2153
+ constructor(..._args) {
2154
+ super(..._args);
2155
+ this.type = ComponentType.TextInput;
2156
+ this.customIdParser = parseCustomId;
2157
+ this.style = TextInputStyle.Short;
2343
2158
  }
2344
- getRuntimeMetrics() {
2345
- return {
2346
- request: this.rest.getSchedulerMetrics(),
2347
- eventQueue: this.eventQueue?.getMetrics()
2348
- };
2159
+ serialize() {
2160
+ return stripUndefinedFields({
2161
+ type: this.type,
2162
+ custom_id: this.customId,
2163
+ style: this.style,
2164
+ min_length: this.minLength,
2165
+ max_length: this.maxLength,
2166
+ required: this.required,
2167
+ value: this.value,
2168
+ placeholder: this.placeholder
2169
+ });
2349
2170
  }
2350
- async fetchUser(id) {
2351
- return await this.entityCache.fetchUser(id);
2171
+ };
2172
+ var ModalChoiceGroup = class extends BaseModalComponent {
2173
+ constructor(..._args2) {
2174
+ super(..._args2);
2175
+ this.options = [];
2352
2176
  }
2353
- async fetchChannel(id) {
2354
- return await this.entityCache.fetchChannel(id);
2177
+ serialize() {
2178
+ return stripUndefinedFields({
2179
+ type: this.type,
2180
+ custom_id: this.customId,
2181
+ options: this.options,
2182
+ required: this.required,
2183
+ min_values: this.minValues,
2184
+ max_values: this.maxValues
2185
+ });
2355
2186
  }
2356
- async fetchGuild(id) {
2357
- return await this.entityCache.fetchGuild(id);
2187
+ };
2188
+ var CheckboxGroup = class extends ModalChoiceGroup {
2189
+ constructor(..._args3) {
2190
+ super(..._args3);
2191
+ this.type = 22;
2358
2192
  }
2359
- async fetchMember(guildId, userId) {
2360
- return await this.entityCache.fetchMember(guildId, userId);
2193
+ };
2194
+ var RadioGroup = class extends ModalChoiceGroup {
2195
+ constructor(..._args4) {
2196
+ super(..._args4);
2197
+ this.type = 21;
2361
2198
  }
2362
- async fetchGuildEmojis(guildId, fetcher) {
2363
- return await this.entityCache.fetchGuildEmojis(guildId, fetcher);
2199
+ };
2200
+ var Label = class extends BaseModalComponent {
2201
+ constructor(component) {
2202
+ super();
2203
+ this.component = component;
2204
+ this.type = ComponentType.Label;
2205
+ this.customId = "";
2364
2206
  }
2365
- async deployCommands() {
2366
- return await this.commandDeployer.deploy();
2207
+ serialize() {
2208
+ return stripUndefinedFields({
2209
+ type: this.type,
2210
+ label: this.label,
2211
+ description: this.description,
2212
+ component: this.component?.serialize()
2213
+ });
2367
2214
  }
2368
- async handleInteraction(rawData) {
2369
- await dispatchInteraction(this, rawData);
2215
+ };
2216
+ var Modal = class {
2217
+ constructor() {
2218
+ this.components = [];
2219
+ this.customIdParser = parseCustomId;
2370
2220
  }
2371
- async dispatchGatewayEvent(type, data) {
2372
- this.entityCache.invalidateForGatewayEvent(type, data);
2373
- const listeners = this.listeners.filter((entry) => entry.type === type);
2374
- if (!this.eventQueue) {
2375
- for (const listener of listeners) await listener.handle(data, this);
2376
- return;
2377
- }
2378
- await Promise.all(listeners.map((listener) => this.eventQueue.enqueue({
2379
- eventType: type,
2380
- listenerName: listener.constructor.name || "AnonymousListener",
2381
- run: async () => {
2382
- await listener.handle(data, this);
2383
- }
2384
- })));
2221
+ serialize() {
2222
+ return {
2223
+ title: this.title,
2224
+ custom_id: this.customId,
2225
+ components: this.components.map((entry) => entry.serialize())
2226
+ };
2385
2227
  }
2386
2228
  };
2387
2229
  //#endregion
@@ -2393,69 +2235,63 @@ var ReadyListener = class extends BaseListener {
2393
2235
  this.type = GatewayDispatchEvents.Ready;
2394
2236
  }
2395
2237
  };
2396
- var ResumedListener = class extends BaseListener {
2238
+ var GuildCreateListener = class extends BaseListener {
2397
2239
  constructor(..._args2) {
2398
2240
  super(..._args2);
2399
- this.type = GatewayDispatchEvents.Resumed;
2400
- }
2401
- };
2402
- var GuildCreateListener = class extends BaseListener {
2403
- constructor(..._args3) {
2404
- super(..._args3);
2405
2241
  this.type = GatewayDispatchEvents.GuildCreate;
2406
2242
  }
2407
2243
  };
2408
2244
  var GuildDeleteListener = class extends BaseListener {
2409
- constructor(..._args4) {
2410
- super(..._args4);
2245
+ constructor(..._args3) {
2246
+ super(..._args3);
2411
2247
  this.type = GatewayDispatchEvents.GuildDelete;
2412
2248
  }
2413
2249
  };
2414
2250
  var MessageCreateListener = class extends BaseListener {
2415
- constructor(..._args5) {
2416
- super(..._args5);
2251
+ constructor(..._args4) {
2252
+ super(..._args4);
2417
2253
  this.type = GatewayDispatchEvents.MessageCreate;
2418
2254
  }
2419
2255
  };
2420
2256
  var InteractionCreateListener = class extends BaseListener {
2421
- constructor(..._args6) {
2422
- super(..._args6);
2257
+ constructor(..._args5) {
2258
+ super(..._args5);
2423
2259
  this.type = GatewayDispatchEvents.InteractionCreate;
2424
2260
  }
2425
2261
  };
2426
2262
  var MessageReactionAddListener = class extends BaseListener {
2427
- constructor(..._args7) {
2428
- super(..._args7);
2263
+ constructor(..._args6) {
2264
+ super(..._args6);
2429
2265
  this.type = GatewayDispatchEvents.MessageReactionAdd;
2430
2266
  }
2431
2267
  };
2432
2268
  var MessageReactionRemoveListener = class extends BaseListener {
2433
- constructor(..._args8) {
2434
- super(..._args8);
2269
+ constructor(..._args7) {
2270
+ super(..._args7);
2435
2271
  this.type = GatewayDispatchEvents.MessageReactionRemove;
2436
2272
  }
2437
2273
  };
2438
2274
  var PresenceUpdateListener = class extends BaseListener {
2439
- constructor(..._args9) {
2440
- super(..._args9);
2275
+ constructor(..._args8) {
2276
+ super(..._args8);
2441
2277
  this.type = GatewayDispatchEvents.PresenceUpdate;
2442
2278
  }
2443
2279
  };
2444
2280
  var VoiceStateUpdateListener = class extends BaseListener {
2445
- constructor(..._args10) {
2446
- super(..._args10);
2281
+ constructor(..._args9) {
2282
+ super(..._args9);
2447
2283
  this.type = GatewayDispatchEvents.VoiceStateUpdate;
2448
2284
  }
2449
2285
  };
2450
2286
  var ThreadUpdateListener = class extends BaseListener {
2451
- constructor(..._args11) {
2452
- super(..._args11);
2287
+ constructor(..._args10) {
2288
+ super(..._args10);
2453
2289
  this.type = GatewayDispatchEvents.ThreadUpdate;
2454
2290
  }
2455
2291
  };
2456
2292
  var ThreadDeleteListener = class extends BaseListener {
2457
- constructor(..._args12) {
2458
- super(..._args12);
2293
+ constructor(..._args11) {
2294
+ super(..._args11);
2459
2295
  this.type = GatewayDispatchEvents.ThreadDelete;
2460
2296
  }
2461
2297
  };
@@ -2469,7 +2305,6 @@ var discord_exports = /* @__PURE__ */ __exportAll({
2469
2305
  Button: () => Button,
2470
2306
  ButtonInteraction: () => ButtonInteraction,
2471
2307
  ChannelSelectMenu: () => ChannelSelectMenu,
2472
- ChannelSelectMenuInteraction: () => ChannelSelectMenuInteraction,
2473
2308
  CheckboxGroup: () => CheckboxGroup,
2474
2309
  Client: () => Client,
2475
2310
  Command: () => Command,
@@ -2488,7 +2323,6 @@ var discord_exports = /* @__PURE__ */ __exportAll({
2488
2323
  LinkButton: () => LinkButton,
2489
2324
  MediaGallery: () => MediaGallery,
2490
2325
  MentionableSelectMenu: () => MentionableSelectMenu,
2491
- MentionableSelectMenuInteraction: () => MentionableSelectMenuInteraction,
2492
2326
  Message: () => Message,
2493
2327
  MessageCreateListener: () => MessageCreateListener,
2494
2328
  MessageReactionAddListener: () => MessageReactionAddListener,
@@ -2501,10 +2335,8 @@ var discord_exports = /* @__PURE__ */ __exportAll({
2501
2335
  RateLimitError: () => RateLimitError,
2502
2336
  ReadyListener: () => ReadyListener,
2503
2337
  RequestClient: () => RequestClient,
2504
- ResumedListener: () => ResumedListener,
2505
2338
  Role: () => Role,
2506
2339
  RoleSelectMenu: () => RoleSelectMenu,
2507
- RoleSelectMenuInteraction: () => RoleSelectMenuInteraction,
2508
2340
  Row: () => Row,
2509
2341
  Section: () => Section,
2510
2342
  Separator: () => Separator,
@@ -2517,9 +2349,9 @@ var discord_exports = /* @__PURE__ */ __exportAll({
2517
2349
  Thumbnail: () => Thumbnail,
2518
2350
  User: () => User,
2519
2351
  UserSelectMenu: () => UserSelectMenu,
2520
- UserSelectMenuInteraction: () => UserSelectMenuInteraction,
2521
2352
  VoiceStateUpdateListener: () => VoiceStateUpdateListener,
2522
2353
  channelFactory: () => channelFactory,
2354
+ createChannelMessage: () => createChannelMessage,
2523
2355
  createChannelWebhook: () => createChannelWebhook,
2524
2356
  createInteraction: () => createInteraction,
2525
2357
  createOwnMessageReaction: () => createOwnMessageReaction,
@@ -2551,4 +2383,4 @@ var discord_exports = /* @__PURE__ */ __exportAll({
2551
2383
  import * as import_discord_api_types_v10 from "discord-api-types/v10";
2552
2384
  __reExport(discord_exports, import_discord_api_types_v10);
2553
2385
  //#endregion
2554
- export { BaseMessageInteractiveComponent as $, serializePayload as A, Container as B, withDiscordRequestAuthority as C, Message as D, Guild as E, RadioGroup as F, RoleSelectMenu as G, LinkButton as H, TextInput as I, Separator as J, Row as K, AnySelectMenu as L, CheckboxGroup as M, Label as N, User as O, Modal as P, UserSelectMenu as Q, Button as R, readRetryAfter as S, CommandWithSubcommands as T, MediaGallery as U, File as V, MentionableSelectMenu as W, TextDisplay as X, StringSelectMenu as Y, Thumbnail as Z, DiscordError as _, getGuildVoiceState as _t, MessageCreateListener as a, deleteOwnMessageReaction as at, readDiscordCode as b, PresenceUpdateListener as c, deleteChannelMessage as ct, ThreadDeleteListener as d, getChannelMessage as dt, parseCustomId as et, ThreadUpdateListener as f, getThreadMember as ft, RequestClient as g, getGuildMember as gt, Plugin as h, getGuild as ht, InteractionCreateListener as i, createOwnMessageReaction as it, Embed as j, hasDiscordV2Components as k, ReadyListener as l, editChannelMessage as lt, Client as m, unpinChannelMessage as mt, GuildCreateListener as n, createUserDmChannel as nt, MessageReactionAddListener as o, listMessageReactionUsers as ot, VoiceStateUpdateListener as p, pinChannelMessage as pt, Section as q, GuildDeleteListener as r, getCurrentUser as rt, MessageReactionRemoveListener as s, createThread as st, discord_exports as t, createChannelWebhook as tt, ResumedListener as u, getChannel as ut, RateLimitError as v, listGuildEmojis as vt, Command as w, readDiscordMessage as x, isUnknownDiscordVoiceStateError as y, stripUndefinedFields as yt, ChannelSelectMenu as z };
2386
+ export { BaseMessageInteractiveComponent as $, StringSelectMenu as A, readDiscordCode as B, LinkButton as C, Row as D, RoleSelectMenu as E, Plugin as F, hasDiscordV2Components as G, readRetryAfter as H, RequestClient as I, Command as J, serializePayload as K, DiscordError as L, Thumbnail as M, UserSelectMenu as N, Section as O, Client as P, User as Q, RateLimitError as R, File as S, MentionableSelectMenu as T, captureDiscordRequestAuthority as U, readDiscordMessage as V, withDiscordRequestAuthority as W, Guild as X, CommandWithSubcommands as Y, Message as Z, TextInput as _, getGuildMember as _t, MessageCreateListener as a, deleteOwnMessageReaction as at, ChannelSelectMenu as b, stripUndefinedFields as bt, PresenceUpdateListener as c, createThread as ct, ThreadUpdateListener as d, getChannel as dt, parseCustomId as et, VoiceStateUpdateListener as f, getChannelMessage as ft, RadioGroup as g, getGuild as gt, Modal as h, unpinChannelMessage as ht, InteractionCreateListener as i, createOwnMessageReaction as it, TextDisplay as j, Separator as k, ReadyListener as l, deleteChannelMessage as lt, Label as m, pinChannelMessage as mt, GuildCreateListener as n, createUserDmChannel as nt, MessageReactionAddListener as o, listMessageReactionUsers as ot, CheckboxGroup as p, getThreadMember as pt, Embed as q, GuildDeleteListener as r, getCurrentUser as rt, MessageReactionRemoveListener as s, createChannelMessage as st, discord_exports as t, createChannelWebhook as tt, ThreadDeleteListener as u, editChannelMessage as ut, AnySelectMenu as v, getGuildVoiceState as vt, MediaGallery as w, Container as x, Button as y, listGuildEmojis as yt, isUnknownDiscordVoiceStateError as z };