commandkit 1.2.0-rc.1 → 1.2.0-rc.10

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 (252) hide show
  1. package/README.md +4 -12
  2. package/dist/{ActionRow-CmTHbo2t.js → ActionRow-CbdGFWMT.js} +3 -2
  3. package/dist/{ActionRow-CmTHbo2t.js.map → ActionRow-CbdGFWMT.js.map} +1 -1
  4. package/dist/{CommandKitEventsChannel-Bgw0XCOl.js → CommandKitEventsChannel-BtRzr3Tz.js} +3 -2
  5. package/dist/{CommandKitEventsChannel-Bgw0XCOl.js.map → CommandKitEventsChannel-BtRzr3Tz.js.map} +1 -1
  6. package/dist/{CommandsRouter-Ci1Pe8Vd.js → CommandsRouter-Dmzw-ikm.js} +18 -13
  7. package/dist/{CommandsRouter-Ci1Pe8Vd.js.map → CommandsRouter-Dmzw-ikm.js.map} +1 -1
  8. package/dist/{CompilerPlugin-CjoZAAR8.js → CompilerPlugin-M8r3yNAl.js} +2 -2
  9. package/dist/{CompilerPlugin-CjoZAAR8.js.map → CompilerPlugin-M8r3yNAl.js.map} +1 -1
  10. package/dist/{DefaultLogger-Cy55-uPl.d.ts → DefaultLogger-XCOl5nLd.d.ts} +19 -12
  11. package/dist/{EventInterceptor-CQ4PBpBJ.js → EventInterceptor-CQEXyUTp.js} +3 -5
  12. package/dist/{EventInterceptor-CQ4PBpBJ.js.map → EventInterceptor-CQEXyUTp.js.map} +1 -1
  13. package/dist/{EventWorkerContext-DJUi1W3T.d.ts → EventWorkerContext-DNWfsE1t.d.ts} +2 -2
  14. package/dist/{EventWorkerContext-CSlD9rbx.js → EventWorkerContext-Dq29tieI.js} +3 -2
  15. package/dist/{EventWorkerContext-CSlD9rbx.js.map → EventWorkerContext-Dq29tieI.js.map} +1 -1
  16. package/dist/{EventsRouter-C_J0M3uO.js → EventsRouter-3Gygh-km.js} +9 -5
  17. package/dist/{EventsRouter-C_J0M3uO.js.map → EventsRouter-3Gygh-km.js.map} +1 -1
  18. package/dist/ILogger-BW8GM-YZ.d.ts +64 -0
  19. package/dist/{Logger-iSjA-DWN.d.ts → Logger-DyfkPk7u.d.ts} +2 -2
  20. package/dist/{MessageCommandParser-ROLibZPX.d.ts → MessageCommandParser-BsGMOTDo.d.ts} +3 -3
  21. package/dist/{MessageCommandParser-B_BEQ3p8.js → MessageCommandParser-Dl0xxtdr.js} +9 -4
  22. package/dist/MessageCommandParser-Dl0xxtdr.js.map +1 -0
  23. package/dist/{PluginCommon-Di1xIa8d.js → PluginCommon-Cvl5yYM_.js} +3 -2
  24. package/dist/{PluginCommon-Di1xIa8d.js.map → PluginCommon-Cvl5yYM_.js.map} +1 -1
  25. package/dist/{RuntimePlugin-CBgBLXTG.js → RuntimePlugin-BUecuBIU.js} +3 -2
  26. package/dist/RuntimePlugin-BUecuBIU.js.map +1 -0
  27. package/dist/analytics/analytics-engine.d.ts +6 -6
  28. package/dist/analytics/analytics-engine.js +29 -28
  29. package/dist/analytics/analytics-provider.d.ts +6 -6
  30. package/dist/analytics/constants.js +1 -1
  31. package/dist/analytics/utils.js +29 -28
  32. package/dist/{analytics-engine-vA4MaJYx.d.ts → analytics-engine-jVeSoxEk.d.ts} +113 -32
  33. package/dist/app/commands/AppCommandRunner.d.ts +6 -6
  34. package/dist/app/commands/AppCommandRunner.js +29 -28
  35. package/dist/app/commands/Context.d.ts +6 -6
  36. package/dist/app/commands/Context.js +29 -28
  37. package/dist/app/commands/MessageCommandParser.d.ts +1 -1
  38. package/dist/app/commands/MessageCommandParser.js +2 -2
  39. package/dist/app/commands/helpers.js +1 -1
  40. package/dist/app/events/EventWorkerContext.d.ts +7 -7
  41. package/dist/app/events/EventWorkerContext.js +1 -1
  42. package/dist/app/handlers/AppCommandHandler.d.ts +6 -6
  43. package/dist/app/handlers/AppCommandHandler.js +29 -28
  44. package/dist/app/handlers/AppEventsHandler.d.ts +6 -6
  45. package/dist/app/handlers/AppEventsHandler.js +29 -28
  46. package/dist/app/index.d.ts +7 -7
  47. package/dist/app/index.js +31 -31
  48. package/dist/app/interrupt/signals.d.ts +2 -2
  49. package/dist/app/interrupt/signals.js +5 -5
  50. package/dist/app/middlewares/permissions.d.ts +42 -0
  51. package/dist/app/middlewares/permissions.js +39 -0
  52. package/dist/app/register/CommandRegistrar.d.ts +6 -6
  53. package/dist/app/register/CommandRegistrar.js +29 -28
  54. package/dist/app/router/CommandsRouter.js +1 -1
  55. package/dist/app/router/EventsRouter.js +1 -1
  56. package/dist/app/router/index.d.ts +1 -1
  57. package/dist/app/router/index.js +3 -3
  58. package/dist/{app-process-CjMovpoZ.js → app-process-cj2vF12T.js} +8 -5
  59. package/dist/{app-process-CjMovpoZ.js.map → app-process-cj2vF12T.js.map} +1 -1
  60. package/dist/{build-DXl8uEv4.js → build-DB_aX5xt.js} +18 -14
  61. package/dist/build-DB_aX5xt.js.map +1 -0
  62. package/dist/cli/app-process.js +4 -4
  63. package/dist/cli/build.d.ts +6 -6
  64. package/dist/cli/build.js +31 -30
  65. package/dist/cli/common.d.ts +13 -7
  66. package/dist/cli/common.js +4 -3
  67. package/dist/cli/development.js +45 -44
  68. package/dist/cli/development.js.map +1 -1
  69. package/dist/cli/generators.js +42 -11
  70. package/dist/cli/generators.js.map +1 -1
  71. package/dist/cli/information.js +14 -19
  72. package/dist/cli/information.js.map +1 -1
  73. package/dist/cli/init.js +30 -29
  74. package/dist/cli/production.js +34 -32
  75. package/dist/cli/production.js.map +1 -1
  76. package/dist/cli/type-checker.js +4 -4
  77. package/dist/{colors-Cd4Oz-r-.js → colors-DL3ucTiT.js} +3 -2
  78. package/dist/{colors-Cd4Oz-r-.js.map → colors-DL3ucTiT.js.map} +1 -1
  79. package/dist/{commandkit-DMEW0kJg.js → commandkit-lhbfAyX9.js} +523 -353
  80. package/dist/commandkit-lhbfAyX9.js.map +1 -0
  81. package/dist/commandkit.d.ts +6 -6
  82. package/dist/commandkit.js +29 -28
  83. package/dist/{common-DNADUU3_.js → common-CrqwC-sx.js} +33 -18
  84. package/dist/common-CrqwC-sx.js.map +1 -0
  85. package/dist/common-vnMIelAE.js.map +1 -1
  86. package/dist/components/common/EventInterceptor.js +1 -1
  87. package/dist/components/index.d.ts +2 -2
  88. package/dist/components/index.js +29 -28
  89. package/dist/components/v1/action-row/ActionRow.js +1 -1
  90. package/dist/components/v1/button/Button.js +29 -28
  91. package/dist/components/v1/button/ButtonKit.js +29 -28
  92. package/dist/components/v1/modal/Modal.js +29 -28
  93. package/dist/components/v1/modal/ModalKit.js +29 -28
  94. package/dist/components/v1/select-menu/ChannelSelectMenuKit.js +29 -28
  95. package/dist/components/v1/select-menu/MentionableSelectMenuKit.js +29 -28
  96. package/dist/components/v1/select-menu/RoleSelectMenuKit.js +29 -28
  97. package/dist/components/v1/select-menu/SelectMenu.js +29 -28
  98. package/dist/components/v1/select-menu/StringSelectMenuKit.js +29 -28
  99. package/dist/components/v1/select-menu/UserSelectMenuKit.js +29 -28
  100. package/dist/components/v2/container.js +1 -1
  101. package/dist/components/v2/file.js +1 -1
  102. package/dist/components/v2/index.d.ts +1 -1
  103. package/dist/components/v2/index.js +6 -6
  104. package/dist/components/v2/media-gallery.js +1 -1
  105. package/dist/components/v2/section.js +1 -1
  106. package/dist/components/v2/separator.js +1 -1
  107. package/dist/components/v2/text-display.js +1 -1
  108. package/dist/config/config.d.ts +7 -7
  109. package/dist/config/config.js +29 -28
  110. package/dist/config/default.d.ts +6 -6
  111. package/dist/config/default.js +29 -28
  112. package/dist/config/loader.d.ts +6 -6
  113. package/dist/config/loader.js +29 -28
  114. package/dist/config/types.d.ts +6 -6
  115. package/dist/config/utils.d.ts +6 -6
  116. package/dist/config/utils.js +1 -1
  117. package/dist/{config-CcWJ-vz5.d.ts → config-YAQdMBqh.d.ts} +2 -2
  118. package/dist/constants-4oxxvaJA.js.map +1 -1
  119. package/dist/constants-B5_Ta7PR.js.map +1 -1
  120. package/dist/{constants-CUND8XkG.js → constants-BOOGN85p.js} +3 -2
  121. package/dist/{constants-CUND8XkG.js.map → constants-BOOGN85p.js.map} +1 -1
  122. package/dist/{constants-DrjIvQd6.d.ts → constants-D8PMA9on.d.ts} +1 -1
  123. package/dist/{container-z621KfH5.js → container-C6GtfAPW.js} +3 -2
  124. package/dist/{container-z621KfH5.js.map → container-C6GtfAPW.js.map} +1 -1
  125. package/dist/context/async-context.d.ts +7 -7
  126. package/dist/context/async-context.js +31 -29
  127. package/dist/context/environment.d.ts +6 -6
  128. package/dist/context/environment.js +29 -28
  129. package/dist/{dotprops-C_4L7RPD.js → dotprops-tnhpnszJ.js} +2 -2
  130. package/dist/{dotprops-C_4L7RPD.js.map → dotprops-tnhpnszJ.js.map} +1 -1
  131. package/dist/element-Bak9llw_.js.map +1 -1
  132. package/dist/env-_68PRRoA.js.map +1 -1
  133. package/dist/error-codes-B4TyW4Ct.d.ts +54 -0
  134. package/dist/{error-codes-C-ViHyu-.js → error-codes-Ds0bnPvT.js} +2 -2
  135. package/dist/error-codes-Ds0bnPvT.js.map +1 -0
  136. package/dist/events/CommandKitEventsChannel.d.ts +6 -6
  137. package/dist/events/CommandKitEventsChannel.js +1 -1
  138. package/dist/{feature-flags-Cxl9JtVG.js → feature-flags-DnnKABHf.js} +11 -16
  139. package/dist/{feature-flags-Cxl9JtVG.js.map → feature-flags-DnnKABHf.js.map} +1 -1
  140. package/dist/{file-DVZC0QXI.js → file-DVOELoNv.js} +3 -2
  141. package/dist/{file-DVZC0QXI.js.map → file-DVOELoNv.js.map} +1 -1
  142. package/dist/flags/FlagProvider.d.ts +6 -6
  143. package/dist/flags/FlagProvider.js.map +1 -1
  144. package/dist/flags/feature-flags.d.ts +6 -6
  145. package/dist/flags/feature-flags.js +30 -29
  146. package/dist/flags/store.d.ts +6 -6
  147. package/dist/flags/store.js +1 -1
  148. package/dist/{helpers-BUlN3lIz.js → helpers-Dl8wW6aO.js} +3 -2
  149. package/dist/{helpers-BUlN3lIz.js.map → helpers-Dl8wW6aO.js.map} +1 -1
  150. package/dist/index-CUPkUUOR.d.ts +1 -0
  151. package/dist/index-Dw5cCt-A.d.ts +1 -0
  152. package/dist/index-E7Wvm5uX.d.ts +1 -0
  153. package/dist/index.d.ts +13 -12
  154. package/dist/index.js +47 -38
  155. package/dist/index.js.map +1 -0
  156. package/dist/{init-DTBFphOg.js → init-CY7OJPF-.js} +11 -8
  157. package/dist/{init-DTBFphOg.js.map → init-CY7OJPF-.js.map} +1 -1
  158. package/dist/kv/constants.d.ts +1 -1
  159. package/dist/kv/dotprops.js +1 -1
  160. package/dist/kv/kv.d.ts +2 -2
  161. package/dist/kv/kv.js +8 -10
  162. package/dist/kv/kv.js.map +1 -1
  163. package/dist/kv/serde.d.ts +2 -2
  164. package/dist/kv/serde.js +1 -1
  165. package/dist/logger/DefaultLogger.d.ts +2 -2
  166. package/dist/logger/DefaultLogger.js +29 -28
  167. package/dist/logger/ILogger.d.ts +1 -1
  168. package/dist/logger/Logger.d.ts +2 -2
  169. package/dist/logger/Logger.js +29 -28
  170. package/dist/logger/NoopLogger.d.ts +41 -11
  171. package/dist/logger/NoopLogger.js +5 -25
  172. package/dist/logger/NoopLogger.js.map +1 -1
  173. package/dist/{media-gallery-CIKypjbJ.js → media-gallery-zDtJ3kxb.js} +3 -2
  174. package/dist/{media-gallery-CIKypjbJ.js.map → media-gallery-zDtJ3kxb.js.map} +1 -1
  175. package/dist/plugins/CompilerPlugin.d.ts +6 -6
  176. package/dist/plugins/CompilerPlugin.js +2 -2
  177. package/dist/plugins/PluginCommon.d.ts +6 -6
  178. package/dist/plugins/PluginCommon.js +1 -1
  179. package/dist/plugins/RuntimePlugin.d.ts +6 -6
  180. package/dist/plugins/RuntimePlugin.js +2 -2
  181. package/dist/plugins/index.d.ts +6 -6
  182. package/dist/plugins/index.js +29 -28
  183. package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.d.ts +6 -6
  184. package/dist/plugins/plugin-runtime/CommandKitPluginRuntime.js +29 -28
  185. package/dist/plugins/plugin-runtime/CompilerPluginRuntime.d.ts +6 -6
  186. package/dist/plugins/plugin-runtime/CompilerPluginRuntime.js +29 -28
  187. package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.d.ts +6 -6
  188. package/dist/plugins/plugin-runtime/builtin/CommonDirectiveTransformer.js +29 -28
  189. package/dist/plugins/plugin-runtime/builtin/MacroPlugin.d.ts +6 -6
  190. package/dist/plugins/plugin-runtime/builtin/MacroPlugin.js +29 -28
  191. package/dist/plugins/plugin-runtime/runtime.d.ts +6 -6
  192. package/dist/plugins/plugin-runtime/runtime.js +1 -1
  193. package/dist/plugins/types.d.ts +6 -6
  194. package/dist/{resolve-file-url-DHTQj2mU.js → resolve-file-url-ChIyw-Vf.js} +4 -4
  195. package/dist/{resolve-file-url-DHTQj2mU.js.map → resolve-file-url-ChIyw-Vf.js.map} +1 -1
  196. package/dist/{section-CuYr0Inu.js → section-DlvrDoJK.js} +4 -4
  197. package/dist/{section-CuYr0Inu.js.map → section-DlvrDoJK.js.map} +1 -1
  198. package/dist/{separator-DLdWBjSN.js → separator-DL6QH5H1.js} +4 -4
  199. package/dist/{separator-DLdWBjSN.js.map → separator-DL6QH5H1.js.map} +1 -1
  200. package/dist/{serde-BUDI03pX.d.ts → serde-BYaKrsOV.d.ts} +2 -2
  201. package/dist/{serde-CHySNpFr.js → serde-Cc8iUa9J.js} +2 -2
  202. package/dist/{serde-CHySNpFr.js.map → serde-Cc8iUa9J.js.map} +1 -1
  203. package/dist/{signals-DHdYrd-n.js → signals-ChFMD7mB.js} +12 -15
  204. package/dist/signals-ChFMD7mB.js.map +1 -0
  205. package/dist/{signals-BQbEfy3X.d.ts → signals-SHg7J1U_.d.ts} +4 -7
  206. package/dist/{store-CiqLHedg.js → store-CM6pWVZh.js} +3 -2
  207. package/dist/{store-CiqLHedg.js.map → store-CM6pWVZh.js.map} +1 -1
  208. package/dist/{text-display--p2-BoUa.js → text-display-DbMumig_.js} +3 -2
  209. package/dist/{text-display--p2-BoUa.js.map → text-display-DbMumig_.js.map} +1 -1
  210. package/dist/{type-checker-1Iu1jJcy.js → type-checker-ocNSZh0W.js} +7 -5
  211. package/dist/{type-checker-1Iu1jJcy.js.map → type-checker-ocNSZh0W.js.map} +1 -1
  212. package/dist/{types-package-DrnIdWLg.js → types-package-BWArjyBF.js} +7 -4
  213. package/dist/{types-package-DrnIdWLg.js.map → types-package-BWArjyBF.js.map} +1 -1
  214. package/dist/types.d.ts +7 -7
  215. package/dist/utils/colors.js +1 -1
  216. package/dist/utils/dev-hooks.d.ts +6 -6
  217. package/dist/utils/dev-hooks.js +29 -28
  218. package/dist/utils/error-codes.d.ts +2 -54
  219. package/dist/utils/error-codes.js +1 -1
  220. package/dist/utils/resolve-file-url.js +1 -1
  221. package/dist/utils/types-package.js +1 -1
  222. package/dist/utils/useful-stuff/async-queue.js.map +1 -1
  223. package/dist/utils/useful-stuff/mutex.js +1 -2
  224. package/dist/utils/useful-stuff/mutex.js.map +1 -1
  225. package/dist/utils/useful-stuff/ratelimiter.js +2 -4
  226. package/dist/utils/useful-stuff/ratelimiter.js.map +1 -1
  227. package/dist/utils/useful-stuff/semaphore.js +2 -4
  228. package/dist/utils/useful-stuff/semaphore.js.map +1 -1
  229. package/dist/utils/utilities.js +29 -28
  230. package/dist/utils/warn-unstable.js.map +1 -1
  231. package/dist/utils-DCSnVAZ6.js.map +1 -1
  232. package/dist/{utils-BnXM4eKk.js → utils-KsNof0Xz.js} +1 -1
  233. package/dist/{utils-BnXM4eKk.js.map → utils-KsNof0Xz.js.map} +1 -1
  234. package/dist/{version-rfStvlqX.js → version-BCILNeQb.js} +2 -2
  235. package/dist/{version-rfStvlqX.js.map → version-BCILNeQb.js.map} +1 -1
  236. package/dist/version.js +1 -1
  237. package/hooks.cjs +2 -0
  238. package/hooks.d.ts +3 -1
  239. package/package.json +60 -59
  240. package/dist/ILogger-DBGON5wx.d.ts +0 -34
  241. package/dist/MessageCommandParser-B_BEQ3p8.js.map +0 -1
  242. package/dist/RuntimePlugin-CBgBLXTG.js.map +0 -1
  243. package/dist/build-DXl8uEv4.js.map +0 -1
  244. package/dist/commandkit-DMEW0kJg.js.map +0 -1
  245. package/dist/common-DNADUU3_.js.map +0 -1
  246. package/dist/error-codes-C-ViHyu-.js.map +0 -1
  247. package/dist/index-DKcmsWXw.d.ts +0 -1
  248. package/dist/index-DSBMRX9A.d.ts +0 -1
  249. package/dist/index-DdqikUQD.d.ts +0 -1
  250. package/dist/signals-DHdYrd-n.js.map +0 -1
  251. /package/dist/{router-DHnFRADH.js → router-Dn35v30f.js} +0 -0
  252. /package/dist/{runtime-5fxB4uhe.js → runtime-DB9CiPfe.js} +0 -0
@@ -0,0 +1 @@
1
+ {"version":3,"file":"MessageCommandParser-Dl0xxtdr.js","names":[],"sources":["../src/app/commands/MessageCommandParser.ts"],"sourcesContent":["import { Channel } from 'diagnostics_channel';\nimport {\n Message,\n ApplicationCommandOptionType,\n GuildMember,\n Attachment,\n User,\n Role,\n CommandInteractionOption,\n} from 'discord.js';\nimport {\n CommandKitErrorCodes,\n createCommandKitError,\n} from '../../utils/error-codes';\n\n/**\n * Represents a parsed message command with its components.\n */\nexport interface ParsedMessageCommand {\n command: string;\n options: { name: string; value: unknown }[];\n subcommand?: string;\n subcommandGroup?: string;\n}\n\n/**\n * Schema defining the types of options for a message command.\n */\nexport type MessageCommandOptionsSchema = Record<\n string,\n ApplicationCommandOptionType\n>;\n\n/**\n * Parses message content into structured command data with options and subcommands.\n */\nexport class MessageCommandParser {\n /**\n * @private\n * @internal\n */\n #parsed: ParsedMessageCommand | null = null;\n\n /**\n * @private\n * @internal\n */\n #options: MessageCommandOptions | null = null;\n\n /**\n * @private\n * @internal\n */\n #args: string[] = [];\n\n /**\n * Creates a new message command parser.\n * @param message - The Discord message to parse\n * @param prefix - Array of valid command prefixes or a regular expression\n * @param schema - Function that returns the options schema for a command\n */\n public constructor(\n public message: Message,\n private prefix: string[] | RegExp,\n private schema: (command: string) => MessageCommandOptionsSchema,\n ) {}\n\n /**\n * Gets the parsed command arguments.\n * @returns Array of command arguments\n */\n public getArgs() {\n void this.parse();\n return this.#args;\n }\n\n /**\n * Gets the message command options object for easy access to typed option values.\n */\n public get options() {\n if (!this.#options) {\n this.#options = new MessageCommandOptions(this);\n }\n\n return this.#options;\n }\n\n /**\n * Gets a specific option value by name.\n * @param name - The option name\n * @returns The option value or undefined if not found\n */\n public getOption<T>(name: string): T | undefined {\n return this.parse().options.find((o) => o.name === name)?.value as T;\n }\n\n /**\n * Gets the main command name.\n * @returns The command name\n */\n public getCommand(): string {\n return this.parse().command;\n }\n\n /**\n * Gets the subcommand name if present.\n * @returns The subcommand name or undefined\n */\n public getSubcommand(): string | undefined {\n return this.parse().subcommand;\n }\n\n /**\n * Gets the subcommand group name if present.\n * @returns The subcommand group name or undefined\n */\n public getSubcommandGroup(): string | undefined {\n return this.parse().subcommandGroup;\n }\n\n /**\n * Gets the prefix used in the message.\n * @returns The matched prefix or undefined\n */\n public getPrefix() {\n if (this.prefix instanceof RegExp) {\n const match = this.message.content.match(this.prefix);\n return match?.[0];\n }\n\n for (const p of this.prefix) {\n if (this.message.content.startsWith(p)) {\n return p;\n }\n }\n }\n\n /**\n * Gets the full command including subcommand group and subcommand.\n * @returns The complete command string\n */\n public getFullCommand() {\n return [this.getCommand(), this.getSubcommandGroup(), this.getSubcommand()]\n .filter((v) => v)\n .join(' ');\n }\n\n /**\n * Parses the message content into structured command data.\n * @returns The parsed command data\n */\n public parse(): ParsedMessageCommand {\n if (this.#parsed) {\n return this.#parsed;\n }\n\n const content = this.message.content;\n\n const prefix = this.getPrefix();\n\n if (!prefix) {\n throw createCommandKitError(CommandKitErrorCodes.InvalidCommandPrefix);\n }\n\n const parts = content.slice(prefix.length).trim().split(' ');\n const command = parts.shift();\n\n this.#args = parts;\n\n let subcommandGroup: string | undefined;\n let subcommand: string | undefined;\n\n if (command?.includes(':')) {\n const [, group, cmd] = command.split(':');\n\n if (!cmd && group) {\n subcommand = group;\n } else if (cmd && group) {\n subcommandGroup = group;\n subcommand = cmd;\n }\n }\n\n const schema = this.schema(\n [command, subcommandGroup, subcommand].filter(Boolean).join(' ').trim(),\n );\n\n const options = parts\n .map((part) => {\n try {\n const [name, value] = part.split(':');\n\n if (!(name in schema)) return null;\n\n switch (schema[name]) {\n case ApplicationCommandOptionType.Boolean:\n return { name, value: value === 'true' };\n case ApplicationCommandOptionType.Integer:\n return { name, value: parseInt(value, 10) };\n case ApplicationCommandOptionType.Number:\n return { name, value: parseFloat(value) };\n case ApplicationCommandOptionType.String:\n return { name, value };\n case ApplicationCommandOptionType.User:\n return {\n name,\n value: this.message.mentions.users.find((u) => {\n return u.id === value.replace(/[<@!>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Channel:\n return {\n name,\n value: this.message.mentions.channels.find((c) => {\n return c.id === value.replace(/[<#>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Role:\n return {\n name,\n value: this.message.mentions.roles.find((r) => {\n return r.id === value.replace(/[<@&>]/g, '');\n }),\n };\n case ApplicationCommandOptionType.Attachment:\n return {\n name,\n value: this.message.attachments.find((a) => {\n return a.name === value;\n }),\n };\n default:\n return null;\n }\n } catch {\n // Invalid option\n return null;\n }\n })\n .filter((v) => v !== null);\n\n this.#parsed = {\n command: command!,\n options,\n subcommand,\n subcommandGroup,\n };\n\n return this.#parsed;\n }\n}\n\n/**\n * Provides typed access to message command options with methods similar to Discord.js interaction options.\n */\nexport class MessageCommandOptions {\n /**\n * Creates a new message command options instance.\n * @param parser - The message command parser instance\n */\n public constructor(private parser: MessageCommandParser) {}\n\n /**\n * @private\n * @internal\n */\n private assertOption<T>(name: string, required = false) {\n const option = this.parser.getOption<T>(name);\n\n if (required && option === undefined) {\n throw new Error(`Option \"${name}\" is required.`);\n }\n\n return option ?? null;\n }\n\n /**\n * Gets a guild member from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The guild member or null if not found\n */\n getMember(name: string): GuildMember | null;\n getMember(name: string, required: true): GuildMember;\n getMember(name: string, required = false) {\n const user = this.assertOption<User>(name, required);\n const member = this.parser.message.guild?.members.cache.get(user?.id!);\n\n if (required && !member) {\n throw new Error(`Member \"${name}\" is required.`);\n }\n\n return member ?? null;\n }\n\n /**\n * Gets an attachment from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The attachment or null if not found\n */\n getAttachment(name: string): Attachment | null;\n getAttachment(name: string, required: true): Attachment;\n getAttachment(name: string, required = false) {\n return this.assertOption<Attachment>(name, required);\n }\n\n /**\n * Gets a boolean value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The boolean value or null if not found\n */\n getBoolean(name: string): boolean | null;\n getBoolean(name: string, required: true): boolean;\n getBoolean(name: string, required = false) {\n return this.assertOption<boolean>(name, required);\n }\n\n /**\n * Gets a number value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The number value or null if not found\n */\n getNumber(name: string): number | null;\n getNumber(name: string, required: true): number;\n getNumber(name: string, required = false) {\n return this.assertOption<number>(name, required);\n }\n\n /**\n * Gets a string value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The string value or null if not found\n */\n getString(name: string): string | null;\n getString(name: string, required: true): string;\n getString(name: string, required = false) {\n return this.assertOption<string>(name, required);\n }\n\n /**\n * Gets an integer value from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The integer value or null if not found\n */\n getInteger(name: string): number | null;\n getInteger(name: string, required: true): number;\n getInteger(name: string, required = false) {\n return this.assertOption<number>(name, required);\n }\n\n /**\n * Gets a user from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The user or null if not found\n */\n getUser(name: string): User | null;\n getUser(name: string, required: true): User;\n getUser(name: string, required = false) {\n return this.assertOption<User>(name, required);\n }\n\n /**\n * Gets a channel from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The channel or null if not found\n */\n getChannel(name: string): Channel | null;\n getChannel(name: string, required: true): Channel;\n getChannel(name: string, required = false) {\n return this.assertOption<Channel>(name, required);\n }\n\n /**\n * Gets a role from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The role or null if not found\n */\n getRole(name: string): Role | null;\n getRole(name: string, required: true): Role;\n getRole(name: string, required = false) {\n return this.assertOption<Role>(name, required);\n }\n\n /**\n * Gets a mentionable (user, member, or role) from the command options.\n * @param name - The option name\n * @param required - Whether the option is required\n * @returns The mentionable or null if not found\n */\n getMentionable(\n name: string,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']> | null;\n getMentionable(\n name: string,\n required: true,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']>;\n getMentionable(\n name: string,\n required = false,\n ): NonNullable<CommandInteractionOption['member' | 'role' | 'user']> | null {\n const target = this.assertOption(name, required);\n\n if (\n target instanceof GuildMember ||\n target instanceof User ||\n target instanceof Role\n ) {\n return target;\n }\n\n if (required) {\n throw new Error(`Mentionable \"${name}\" is required.`);\n }\n\n return null;\n }\n\n /**\n * Gets the subcommand name from the command.\n * @param required - Whether the subcommand is required\n * @returns The subcommand name or null if not found\n */\n getSubcommand(): string | null;\n getSubcommand(required: true): string;\n getSubcommand(required = false) {\n const sub = this.parser.getSubcommand();\n\n if (required && sub === undefined) {\n throw new Error('Subcommand is required.');\n }\n\n return sub ?? null;\n }\n\n /**\n * Gets the subcommand group name from the command.\n * @param required - Whether the subcommand group is required\n * @returns The subcommand group name or null if not found\n */\n getSubcommandGroup(): string | null;\n getSubcommandGroup(required: true): string;\n getSubcommandGroup(required = false) {\n const sub = this.parser.getSubcommandGroup();\n\n if (required && sub === undefined) {\n throw new Error('Subcommand group is required.');\n }\n\n return sub ?? null;\n }\n}\n"],"mappings":"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"}
@@ -1,5 +1,6 @@
1
1
  const require_chunk = require('./chunk-nOFOJqeH.js');
2
- const node_crypto = require_chunk.__toESM(require("node:crypto"));
2
+ let node_crypto = require("node:crypto");
3
+ node_crypto = require_chunk.__toESM(node_crypto);
3
4
 
4
5
  //#region src/plugins/PluginCommon.ts
5
6
  /**
@@ -67,4 +68,4 @@ Object.defineProperty(exports, 'isPlugin', {
67
68
  return isPlugin;
68
69
  }
69
70
  });
70
- //# sourceMappingURL=PluginCommon-Di1xIa8d.js.map
71
+ //# sourceMappingURL=PluginCommon-Cvl5yYM_.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"PluginCommon-Di1xIa8d.js","names":[],"sources":["../src/plugins/PluginCommon.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { CommonPluginRuntime } from './plugin-runtime/runtime';\n\n/**\n * The options for a CommandKit plugin.\n */\nexport type PluginOptions = Record<string, any>;\n\n/**\n * Enum representing the type of plugin.\n * - Compiler: A plugin that runs at compile time.\n * - Runtime: A plugin that runs at runtime.\n */\nexport enum PluginType {\n Compiler = 'compiler',\n Runtime = 'runtime',\n}\n\n/**\n * Base class for CommandKit plugins.\n */\nexport abstract class PluginCommon<\n T extends PluginOptions = PluginOptions,\n C extends CommonPluginRuntime = CommonPluginRuntime,\n> {\n /**\n * The type of the plugin, either Compiler or Runtime.\n */\n public abstract readonly type: PluginType;\n /**\n * Unique identifier for the plugin instance.\n */\n public readonly id = randomUUID();\n /**\n * The time when the plugin was loaded, in milliseconds since the Unix epoch.\n */\n public readonly loadedAt = Date.now();\n /**\n * The name of the plugin.\n */\n public abstract readonly name: string;\n\n /**\n * Creates a new instance of the plugin.\n */\n public constructor(protected readonly options: T) {}\n\n /**\n * Called when this plugin is activated\n */\n public async activate(ctx: C): Promise<void> {}\n\n /**\n * Called when this plugin is deactivated\n */\n public async deactivate(ctx: C): Promise<void> {}\n}\n\n/**\n * Whether the given object is a CommandKit plugin.\n * @param plugin The object to check.\n * @returns Boolean indicating whether the object is a plugin.\n */\nexport function isPlugin(\n plugin: unknown,\n): plugin is PluginCommon<PluginOptions> {\n return plugin instanceof PluginCommon;\n}\n"],"mappings":";;;;;;;;;AAaA,IAAY,oDAAL;AACL;AACA;;AACF;;;;AAKA,IAAsB,eAAtB,MAGA;;;;CAQE,AAAgB;;;;CAIhB,AAAgB,WAAW,KAAK;;;;CAShC,AAAO,YAAY,AAAmB,SAAY;EAAZ;CAAa;;;;CAKnD,MAAa,SAAS,KAAuB,CAAC;;;;CAK9C,MAAa,WAAW,KAAuB,CAAC;AAClD;;;;;;AAOA,SAAgB,SAChB,QACwC;AACtC,QAAO,kBAAkB;AAC3B"}
1
+ {"version":3,"file":"PluginCommon-Cvl5yYM_.js","names":[],"sources":["../src/plugins/PluginCommon.ts"],"sourcesContent":["import { randomUUID } from 'node:crypto';\nimport { CommonPluginRuntime } from './plugin-runtime/runtime';\n\n/**\n * The options for a CommandKit plugin.\n */\nexport type PluginOptions = Record<string, any>;\n\n/**\n * Enum representing the type of plugin.\n * - Compiler: A plugin that runs at compile time.\n * - Runtime: A plugin that runs at runtime.\n */\nexport enum PluginType {\n Compiler = 'compiler',\n Runtime = 'runtime',\n}\n\n/**\n * Base class for CommandKit plugins.\n */\nexport abstract class PluginCommon<\n T extends PluginOptions = PluginOptions,\n C extends CommonPluginRuntime = CommonPluginRuntime,\n> {\n /**\n * The type of the plugin, either Compiler or Runtime.\n */\n public abstract readonly type: PluginType;\n /**\n * Unique identifier for the plugin instance.\n */\n public readonly id = randomUUID();\n /**\n * The time when the plugin was loaded, in milliseconds since the Unix epoch.\n */\n public readonly loadedAt = Date.now();\n /**\n * The name of the plugin.\n */\n public abstract readonly name: string;\n\n /**\n * Creates a new instance of the plugin.\n */\n public constructor(protected readonly options: T) {}\n\n /**\n * Called when this plugin is activated\n */\n public async activate(ctx: C): Promise<void> {}\n\n /**\n * Called when this plugin is deactivated\n */\n public async deactivate(ctx: C): Promise<void> {}\n}\n\n/**\n * Whether the given object is a CommandKit plugin.\n * @param plugin The object to check.\n * @returns Boolean indicating whether the object is a plugin.\n */\nexport function isPlugin(\n plugin: unknown,\n): plugin is PluginCommon<PluginOptions> {\n return plugin instanceof PluginCommon;\n}\n"],"mappings":";;;;;;;;;;AAaA,IAAY,oDAAL;AACL;AACA;;;;;;AAMF,IAAsB,eAAtB,MAGA;;;;CAQE,AAAgB,kCAAiB;;;;CAIjC,AAAgB,WAAW,KAAK,KAAK;;;;CASrC,AAAO,YAAY,AAAmB,SAAY;EAAZ;;;;;CAKtC,MAAa,SAAS,KAAuB;;;;CAK7C,MAAa,WAAW,KAAuB;;;;;;;AAQjD,SAAgB,SAChB,QACwC;AACtC,QAAO,kBAAkB"}
@@ -1,4 +1,4 @@
1
- const require_PluginCommon = require('./PluginCommon-Di1xIa8d.js');
1
+ const require_PluginCommon = require('./PluginCommon-Cvl5yYM_.js');
2
2
 
3
3
  //#region src/plugins/RuntimePlugin.ts
4
4
  /**
@@ -6,6 +6,7 @@ const require_PluginCommon = require('./PluginCommon-Di1xIa8d.js');
6
6
  */
7
7
  var RuntimePlugin = class extends require_PluginCommon.PluginCommon {
8
8
  type = require_PluginCommon.PluginType.Runtime;
9
+ preload = /* @__PURE__ */ new Set();
9
10
  /**
10
11
  * Called before commands are loaded
11
12
  */
@@ -130,4 +131,4 @@ Object.defineProperty(exports, 'isRuntimePlugin', {
130
131
  return isRuntimePlugin;
131
132
  }
132
133
  });
133
- //# sourceMappingURL=RuntimePlugin-CBgBLXTG.js.map
134
+ //# sourceMappingURL=RuntimePlugin-BUecuBIU.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"RuntimePlugin-BUecuBIU.js","names":[],"sources":["../src/plugins/RuntimePlugin.ts"],"sourcesContent":["import { Interaction, Message } from 'discord.js';\nimport {\n isPlugin,\n PluginCommon,\n PluginOptions,\n PluginType,\n} from './PluginCommon';\nimport type { CommandKitPluginRuntime } from './plugin-runtime/CommandKitPluginRuntime';\nimport { CommandBuilderLike, PreparedAppCommandExecution } from '../app';\nimport { CommandKitEnvironment } from '../context/environment';\nimport { CommandKitHMREvent } from '../utils/dev-hooks';\nimport { PreRegisterCommandsEvent } from '../app/register/CommandRegistrar';\nimport { CommandKitEventDispatch } from './types';\n\n/**\n * CommandKit plugin that runs at the runtime.\n */\nexport abstract class RuntimePlugin<\n T extends PluginOptions = PluginOptions,\n> extends PluginCommon<T, CommandKitPluginRuntime> {\n public readonly type = PluginType.Runtime;\n public readonly preload = new Set<string>();\n\n /**\n * Called before commands are loaded\n */\n public async onBeforeCommandsLoad(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after commands are loaded\n */\n public async onAfterCommandsLoad(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called before events are loaded\n */\n public async onBeforeEventsLoad(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after events are loaded\n */\n public async onAfterEventsLoad(ctx: CommandKitPluginRuntime): Promise<void> {}\n\n /**\n * Called before the client logs in\n */\n public async onBeforeClientLogin(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after the client logs in\n */\n public async onAfterClientLogin(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called before interaction is handled\n * @param interaction The interaction\n */\n public async onBeforeInteraction(\n ctx: CommandKitPluginRuntime,\n interaction: Interaction,\n ): Promise<void> {}\n\n /**\n * Called before message command is processed\n * @param message The message\n */\n public async onBeforeMessageCommand(\n ctx: CommandKitPluginRuntime,\n message: Message,\n ): Promise<void> {}\n\n /**\n * Called before command is executed. This method can execute the command itself.\n * @param source The source that triggered the command\n * @param command The command\n * @param execute The function that executes the command\n */\n public async executeCommand(\n ctx: CommandKitPluginRuntime,\n env: CommandKitEnvironment,\n source: Interaction | Message,\n command: PreparedAppCommandExecution,\n execute: () => Promise<any>,\n ): Promise<boolean> {\n return false;\n }\n\n /**\n * Called after events router is initialized\n * @param ctx The context\n */\n public async onEventsRouterInit(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called after commands router is initialized\n * @param ctx The context\n */\n public async onCommandsRouterInit(\n ctx: CommandKitPluginRuntime,\n ): Promise<void> {}\n\n /**\n * Called when HMR event is received\n * @param ctx The context\n * @param event The event\n */\n public async performHMR(\n ctx: CommandKitPluginRuntime,\n event: CommandKitHMREvent,\n ): Promise<void> {}\n\n /**\n * Called before command is loaded for registration. This method can be used to modify the command data before it is loaded.\n * @param ctx The context\n * @param commands The command that is being loaded. This is a CommandBuilderLike object which represents Discord's command\n */\n async prepareCommand(\n ctx: CommandKitPluginRuntime,\n commands: CommandBuilderLike,\n ): Promise<CommandBuilderLike | null> {\n return null;\n }\n\n /**\n * Called before command is registered to discord. This method can cancel the registration of the command and handle it manually.\n * @param ctx The context\n * @param data The command registration data\n */\n async onBeforeRegisterCommands(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called before global commands registration. This method can cancel the registration of the command and handle it manually.\n * This method is called after `onBeforeRegisterCommands` if that stage was not handled.\n * @param ctx The context\n * @param event The command registration data\n */\n async onBeforeRegisterGlobalCommands(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called before guild commands registration. This method can cancel the registration of the command and handle it manually.\n * This method is called before guilds of the command are resolved. It is called after `onBeforeRegisterCommands` if that stage was not handled.\n * @param ctx The context\n * @param event The command registration data\n */\n async onBeforePrepareGuildCommandsRegistration(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called before guild commands registration. This method can cancel the registration of the command and handle it manually.\n * This method is called after guilds of the command are resolved. It is called after `onBeforePrepareGuildCommandsRegistration` if that stage was not handled.\n * @param ctx The context\n * @param event The command registration data\n */\n async onBeforeRegisterGuildCommands(\n ctx: CommandKitPluginRuntime,\n event: PreRegisterCommandsEvent,\n ): Promise<void> {}\n\n /**\n * Called after command and all of its deferred functions are executed.\n * @param ctx The context\n * @param env The environment of the command. This environment contains the command execution data such as command context and more.\n */\n async onAfterCommand(\n ctx: CommandKitPluginRuntime,\n env: CommandKitEnvironment,\n ) {}\n\n /**\n * Called before emitting an event\n * @param ctx The context\n * @param event The event that is being emitted\n */\n public async willEmitEvent(\n ctx: CommandKitPluginRuntime,\n event: CommandKitEventDispatch,\n ) {}\n}\n\nexport function isRuntimePlugin(plugin: unknown): plugin is RuntimePlugin {\n return (\n plugin instanceof RuntimePlugin ||\n (isPlugin(plugin) && plugin.type === PluginType.Runtime)\n );\n}\n"],"mappings":";;;;;;AAiBA,IAAsB,gBAAtB,cAEA,kCAAyC;CACvC,AAAgB,OAAO,gCAAW;CAClC,AAAgB,0BAAU,IAAI,KAAa;;;;CAK3C,MAAa,qBACb,KACgB;;;;CAKhB,MAAa,oBACb,KACgB;;;;CAKhB,MAAa,mBACb,KACgB;;;;CAKhB,MAAa,kBAAkB,KAA6C;;;;CAK5E,MAAa,oBACb,KACgB;;;;CAKhB,MAAa,mBACb,KACgB;;;;;CAMhB,MAAa,oBACb,KACA,aACgB;;;;;CAMhB,MAAa,uBACb,KACA,SACgB;;;;;;;CAQhB,MAAa,eACb,KACA,KACA,QACA,SACA,SACmB;AACjB,SAAO;;;;;;CAOT,MAAa,mBACb,KACgB;;;;;CAMhB,MAAa,qBACb,KACgB;;;;;;CAOhB,MAAa,WACb,KACA,OACgB;;;;;;CAOhB,MAAM,eACN,KACA,UACqC;AACnC,SAAO;;;;;;;CAQT,MAAM,yBACN,KACA,OACgB;;;;;;;CAQhB,MAAM,+BACN,KACA,OACgB;;;;;;;CAQhB,MAAM,yCACN,KACA,OACgB;;;;;;;CAQhB,MAAM,8BACN,KACA,OACgB;;;;;;CAOhB,MAAM,eACN,KACA,KACA;;;;;;CAOA,MAAa,cACb,KACA,OACA;;AAGF,SAAgB,gBAAgB,QAA0C;AACxE,QACE,kBAAkB,iBAClB,8BAAS,OAAO,IAAI,OAAO,SAAS,gCAAW"}
@@ -1,4 +1,4 @@
1
- import { AnalyticsEngine, FilterFunction } from "../analytics-engine-vA4MaJYx.js";
1
+ import { AnalyticsEngine, FilterFunction } from "../analytics-engine-jVeSoxEk.js";
2
2
  import "../EventInterceptor-x-R2qshQ.js";
3
3
  import "../ButtonKit-C7r7RPNf.js";
4
4
  import "../ModalKit-Btz58KYn.js";
@@ -20,13 +20,13 @@ import "../media-gallery-BMsXSot3.js";
20
20
  import "../section-Dh_FhPeC.js";
21
21
  import "../separator-CMf6Cyy5.js";
22
22
  import "../text-display-DRw3r_lK.js";
23
- import "../index-DSBMRX9A.js";
24
- import "../index-DdqikUQD.js";
25
- import "../MessageCommandParser-ROLibZPX.js";
26
- import "../signals-BQbEfy3X.js";
23
+ import "../index-Dw5cCt-A.js";
24
+ import "../index-E7Wvm5uX.js";
25
+ import "../MessageCommandParser-BsGMOTDo.js";
26
+ import "../signals-SHg7J1U_.js";
27
27
  import "../helpers-Wg6P5fRQ.js";
28
28
  import "../CommandsRouter-CoOA7hkf.js";
29
29
  import "../EventsRouter-BacqK6z3.js";
30
- import "../index-DKcmsWXw.js";
30
+ import "../index-CUPkUUOR.js";
31
31
  import "../constants-MKu-Q1jh.js";
32
32
  export { AnalyticsEngine, FilterFunction };
@@ -1,37 +1,38 @@
1
- require('../colors-Cd4Oz-r-.js');
2
- require('../ActionRow-CmTHbo2t.js');
3
- require('../error-codes-C-ViHyu-.js');
4
- const require_commandkit = require('../commandkit-DMEW0kJg.js');
1
+ require('../colors-DL3ucTiT.js');
2
+ require('../ActionRow-CbdGFWMT.js');
3
+ require('../error-codes-Ds0bnPvT.js');
4
+ const require_commandkit = require('../commandkit-lhbfAyX9.js');
5
5
  require('../common-CcfjYnPG.js');
6
6
  require('../common-vnMIelAE.js');
7
- require('../container-z621KfH5.js');
8
- require('../file-DVZC0QXI.js');
9
- require('../media-gallery-CIKypjbJ.js');
10
- require('../section-CuYr0Inu.js');
11
- require('../separator-DLdWBjSN.js');
12
- require('../text-display--p2-BoUa.js');
7
+ require('../container-C6GtfAPW.js');
8
+ require('../file-DVOELoNv.js');
9
+ require('../media-gallery-zDtJ3kxb.js');
10
+ require('../section-DlvrDoJK.js');
11
+ require('../separator-DL6QH5H1.js');
12
+ require('../text-display-DbMumig_.js');
13
13
  require('../v2-DofkPKHs.js');
14
14
  require('../element-Bak9llw_.js');
15
15
  require('../types-CUZOquUl.js');
16
- require('../EventInterceptor-CQ4PBpBJ.js');
16
+ require('../EventInterceptor-CQEXyUTp.js');
17
17
  require('../constants-B5_Ta7PR.js');
18
- require('../PluginCommon-Di1xIa8d.js');
19
- require('../CompilerPlugin-CjoZAAR8.js');
20
- require('../RuntimePlugin-CBgBLXTG.js');
18
+ require('../PluginCommon-Cvl5yYM_.js');
19
+ require('../CompilerPlugin-M8r3yNAl.js');
20
+ require('../RuntimePlugin-BUecuBIU.js');
21
21
  require('../types-q0Nm882H.js');
22
- require('../runtime-5fxB4uhe.js');
23
- require('../utils-BnXM4eKk.js');
24
- require('../resolve-file-url-DHTQj2mU.js');
25
- require('../types-package-DrnIdWLg.js');
26
- require('../EventWorkerContext-CSlD9rbx.js');
27
- require('../signals-DHdYrd-n.js');
28
- require('../constants-CUND8XkG.js');
29
- require('../MessageCommandParser-B_BEQ3p8.js');
30
- require('../CommandsRouter-Ci1Pe8Vd.js');
31
- require('../EventsRouter-C_J0M3uO.js');
32
- require('../router-DHnFRADH.js');
33
- require('../common-DNADUU3_.js');
34
- require('../CommandKitEventsChannel-Bgw0XCOl.js');
35
- require('../store-CiqLHedg.js');
22
+ require('../resolve-file-url-ChIyw-Vf.js');
23
+ require('../runtime-DB9CiPfe.js');
24
+ require('../utils-KsNof0Xz.js');
25
+ require('../types-package-BWArjyBF.js');
26
+ require('../constants-BOOGN85p.js');
27
+ require('../EventWorkerContext-Dq29tieI.js');
28
+ require('../signals-ChFMD7mB.js');
29
+ require('../helpers-Dl8wW6aO.js');
30
+ require('../MessageCommandParser-Dl0xxtdr.js');
31
+ require('../CommandsRouter-Dmzw-ikm.js');
32
+ require('../EventsRouter-3Gygh-km.js');
33
+ require('../router-Dn35v30f.js');
34
+ require('../common-CrqwC-sx.js');
35
+ require('../CommandKitEventsChannel-BtRzr3Tz.js');
36
+ require('../store-CM6pWVZh.js');
36
37
 
37
38
  exports.AnalyticsEngine = require_commandkit.AnalyticsEngine;
@@ -1,4 +1,4 @@
1
- import { AnalyticsEvent, AnalyticsProvider, IdentifyEvent } from "../analytics-engine-vA4MaJYx.js";
1
+ import { AnalyticsEvent, AnalyticsProvider, IdentifyEvent } from "../analytics-engine-jVeSoxEk.js";
2
2
  import "../EventInterceptor-x-R2qshQ.js";
3
3
  import "../ButtonKit-C7r7RPNf.js";
4
4
  import "../ModalKit-Btz58KYn.js";
@@ -20,13 +20,13 @@ import "../media-gallery-BMsXSot3.js";
20
20
  import "../section-Dh_FhPeC.js";
21
21
  import "../separator-CMf6Cyy5.js";
22
22
  import "../text-display-DRw3r_lK.js";
23
- import "../index-DSBMRX9A.js";
24
- import "../index-DdqikUQD.js";
25
- import "../MessageCommandParser-ROLibZPX.js";
26
- import "../signals-BQbEfy3X.js";
23
+ import "../index-Dw5cCt-A.js";
24
+ import "../index-E7Wvm5uX.js";
25
+ import "../MessageCommandParser-BsGMOTDo.js";
26
+ import "../signals-SHg7J1U_.js";
27
27
  import "../helpers-Wg6P5fRQ.js";
28
28
  import "../CommandsRouter-CoOA7hkf.js";
29
29
  import "../EventsRouter-BacqK6z3.js";
30
- import "../index-DKcmsWXw.js";
30
+ import "../index-CUPkUUOR.js";
31
31
  import "../constants-MKu-Q1jh.js";
32
32
  export { AnalyticsEvent, AnalyticsProvider, IdentifyEvent };
@@ -1,4 +1,4 @@
1
- const require_constants = require('../constants-CUND8XkG.js');
1
+ const require_constants = require('../constants-BOOGN85p.js');
2
2
 
3
3
  exports.AnalyticsEvents = require_constants.AnalyticsEvents;
4
4
  exports.DO_NOT_TRACK_KEY = require_constants.DO_NOT_TRACK_KEY;
@@ -1,38 +1,39 @@
1
- require('../colors-Cd4Oz-r-.js');
2
- require('../ActionRow-CmTHbo2t.js');
3
- require('../error-codes-C-ViHyu-.js');
4
- const require_commandkit = require('../commandkit-DMEW0kJg.js');
1
+ require('../colors-DL3ucTiT.js');
2
+ require('../ActionRow-CbdGFWMT.js');
3
+ require('../error-codes-Ds0bnPvT.js');
4
+ const require_commandkit = require('../commandkit-lhbfAyX9.js');
5
5
  require('../common-CcfjYnPG.js');
6
6
  require('../common-vnMIelAE.js');
7
- require('../container-z621KfH5.js');
8
- require('../file-DVZC0QXI.js');
9
- require('../media-gallery-CIKypjbJ.js');
10
- require('../section-CuYr0Inu.js');
11
- require('../separator-DLdWBjSN.js');
12
- require('../text-display--p2-BoUa.js');
7
+ require('../container-C6GtfAPW.js');
8
+ require('../file-DVOELoNv.js');
9
+ require('../media-gallery-zDtJ3kxb.js');
10
+ require('../section-DlvrDoJK.js');
11
+ require('../separator-DL6QH5H1.js');
12
+ require('../text-display-DbMumig_.js');
13
13
  require('../v2-DofkPKHs.js');
14
14
  require('../element-Bak9llw_.js');
15
15
  require('../types-CUZOquUl.js');
16
- require('../EventInterceptor-CQ4PBpBJ.js');
16
+ require('../EventInterceptor-CQEXyUTp.js');
17
17
  require('../constants-B5_Ta7PR.js');
18
- require('../PluginCommon-Di1xIa8d.js');
19
- require('../CompilerPlugin-CjoZAAR8.js');
20
- require('../RuntimePlugin-CBgBLXTG.js');
18
+ require('../PluginCommon-Cvl5yYM_.js');
19
+ require('../CompilerPlugin-M8r3yNAl.js');
20
+ require('../RuntimePlugin-BUecuBIU.js');
21
21
  require('../types-q0Nm882H.js');
22
- require('../runtime-5fxB4uhe.js');
23
- require('../utils-BnXM4eKk.js');
24
- require('../resolve-file-url-DHTQj2mU.js');
25
- require('../types-package-DrnIdWLg.js');
26
- require('../EventWorkerContext-CSlD9rbx.js');
27
- require('../signals-DHdYrd-n.js');
28
- require('../constants-CUND8XkG.js');
29
- require('../MessageCommandParser-B_BEQ3p8.js');
30
- require('../CommandsRouter-Ci1Pe8Vd.js');
31
- require('../EventsRouter-C_J0M3uO.js');
32
- require('../router-DHnFRADH.js');
33
- require('../common-DNADUU3_.js');
34
- require('../CommandKitEventsChannel-Bgw0XCOl.js');
35
- require('../store-CiqLHedg.js');
22
+ require('../resolve-file-url-ChIyw-Vf.js');
23
+ require('../runtime-DB9CiPfe.js');
24
+ require('../utils-KsNof0Xz.js');
25
+ require('../types-package-BWArjyBF.js');
26
+ require('../constants-BOOGN85p.js');
27
+ require('../EventWorkerContext-Dq29tieI.js');
28
+ require('../signals-ChFMD7mB.js');
29
+ require('../helpers-Dl8wW6aO.js');
30
+ require('../MessageCommandParser-Dl0xxtdr.js');
31
+ require('../CommandsRouter-Dmzw-ikm.js');
32
+ require('../EventsRouter-3Gygh-km.js');
33
+ require('../router-Dn35v30f.js');
34
+ require('../common-CrqwC-sx.js');
35
+ require('../CommandKitEventsChannel-BtRzr3Tz.js');
36
+ require('../store-CM6pWVZh.js');
36
37
 
37
38
  exports.getDoNotTrack = require_commandkit.getDoNotTrack;
38
39
  exports.noAnalytics = require_commandkit.noAnalytics;
@@ -1,12 +1,12 @@
1
1
  import { EventInterceptor } from "./EventInterceptor-x-R2qshQ.js";
2
2
  import { Fragment, createElement } from "./element-CAXu1XtK.js";
3
3
  import { MaybeArray } from "./types-CJ-XvOFN.js";
4
- import { MessageCommandOptions, MessageCommandParser } from "./MessageCommandParser-ROLibZPX.js";
4
+ import { MessageCommandOptions, MessageCommandParser } from "./MessageCommandParser-BsGMOTDo.js";
5
5
  import { Command, CommandsRouter, Middleware } from "./CommandsRouter-CoOA7hkf.js";
6
6
  import { EventsRouter, ParsedEvent } from "./EventsRouter-BacqK6z3.js";
7
7
  import { HMREventType } from "./constants-MKu-Q1jh.js";
8
8
  import EventEmitter from "node:events";
9
- import { AutocompleteInteraction, Awaitable, CacheType, ChatInputCommandInteraction, Client, ClientEvents, Collection, Constructable, ContextMenuCommandBuilder, ContextMenuCommandInteraction, Guild, Interaction, Locale, Message, MessageContextMenuCommandInteraction, RESTPostAPIApplicationCommandsJSONBody, SlashCommandBuilder, TextBasedChannel, UserContextMenuCommandInteraction } from "discord.js";
9
+ import { AutocompleteInteraction, Awaitable, CacheType, ChatInputCommandInteraction, Client, ClientEvents, Collection, Constructable, ContextMenuCommandBuilder, ContextMenuCommandInteraction, Guild, Interaction, Locale, Message, MessageContextMenuCommandInteraction, PermissionsString, RESTPostAPIApplicationCommandsJSONBody, SlashCommandBuilder, TextBasedChannel, UserContextMenuCommandInteraction } from "discord.js";
10
10
  import { DirectiveTransformerOptions } from "directive-to-hof";
11
11
  import { Options } from "tsdown";
12
12
 
@@ -38,18 +38,63 @@ interface CommandContext<T extends Interaction, Cached extends CacheType> {
38
38
  */
39
39
  handler: CommandKit;
40
40
  }
41
+ /**
42
+ * Represents the command metadata.
43
+ */
44
+ interface CommandMetadata {
45
+ /**
46
+ * The guilds that the command is available in.
47
+ */
48
+ guilds?: string[];
49
+ /**
50
+ * The aliases of the command.
51
+ */
52
+ aliases?: string[];
53
+ /**
54
+ * The user permissions required to execute the command.
55
+ */
56
+ userPermissions?: PermissionsString | PermissionsString[];
57
+ /**
58
+ * The bot permissions required to execute the command.
59
+ */
60
+ botPermissions?: PermissionsString | PermissionsString[];
61
+ /**
62
+ * The name aliases for the `user` and `message` context menu commands. When i18n plugin is in use, this option will be ignored if the translation for the context menu command name is provided.
63
+ */
64
+ nameAliases?: Record<'user' | 'message', string>;
65
+ }
66
+ /**
67
+ * @deprecated Use `CommandMetadata` instead.
68
+ */
69
+ interface LegacyCommandMetadata {
70
+ /**
71
+ * The aliases of the command.
72
+ * @deprecated Use `metadata.aliases` or `generateMetadata` instead.
73
+ */
74
+ aliases?: string[];
75
+ /**
76
+ * The guilds that the command is available in.
77
+ * @deprecated Use `metadata.guilds` or `generateMetadata` instead.
78
+ */
79
+ guilds?: string[];
80
+ }
41
81
  /**
42
82
  * Represents a command that can be executed by CommandKit.
43
83
  */
44
84
  type CommandData = Prettify<Omit<RESTPostAPIApplicationCommandsJSONBody, 'description'> & {
85
+ /**
86
+ * The description of the command.
87
+ */
45
88
  description?: string;
46
- guilds?: string[];
47
- aliases?: string[];
48
- }>;
89
+ } & LegacyCommandMetadata>;
49
90
  /**
50
91
  * Represents an event handler for a specific event.
51
92
  */
52
- type EventHandler<K extends keyof ClientEvents> = (...args: ClientEvents[K]) => void | Promise<void>;
93
+ type EventHandler<K extends keyof ClientEvents> = (...args: [...ClientEvents[K], Client<true>, CommandKit]) => void | Promise<void>;
94
+ /**
95
+ * The command metadata function
96
+ */
97
+ type CommandMetadataFunction = () => Promise<CommandMetadata> | CommandMetadata;
53
98
  //#endregion
54
99
  //#region src/app/commands/Context.d.ts
55
100
  /**
@@ -77,7 +122,7 @@ interface ContextParameters<T extends CommandExecutionMode, Args = Record<string
77
122
  message: T extends 'message' ? Message : never;
78
123
  forwarded?: boolean;
79
124
  messageCommandParser?: T extends 'message' ? MessageCommandParser : never;
80
- store?: Map<string, any>;
125
+ store?: Collection<string, any>;
81
126
  customArgs?: Args;
82
127
  }
83
128
  /**
@@ -217,7 +262,7 @@ declare class Context<ExecutionMode extends CommandExecutionMode = CommandExecut
217
262
  * The shared key-value store for this context. This can be used to store data that needs to be shared between middlewares or commands.
218
263
  * This store is shared across all contexts in the same command execution, including the cloned contexts and middleware contexts.
219
264
  */
220
- get store(): Map<string, any>;
265
+ get store(): Collection<any, any>;
221
266
  /**
222
267
  * Gets the name of the current command.
223
268
  */
@@ -300,27 +345,11 @@ declare class Context<ExecutionMode extends CommandExecutionMode = CommandExecut
300
345
  * @returns Array of command arguments
301
346
  */
302
347
  args(): string[];
303
- /**
304
- * Stops upcoming middleware or current command execution.
305
- * If this is called inside pre-stage middleware, the next run will be the actual command, skipping all other pre-stage middlewares.
306
- * If this is called inside a command itself, it will skip all post-stage middlewares.
307
- * If this is called inside post-stage middleware, it will skip all other post-stage middlewares.
308
- */
309
- exit(): never;
310
348
  }
311
349
  /**
312
350
  * Extended context class for middleware execution with additional control methods.
313
351
  */
314
352
  declare class MiddlewareContext<T extends CommandExecutionMode = CommandExecutionMode> extends Context<T, MiddlewareContextArgs> {
315
- #private;
316
- /**
317
- * Whether the command execution was cancelled.
318
- */
319
- get cancelled(): boolean;
320
- /**
321
- * Cancels the command execution.
322
- */
323
- cancel(): void;
324
353
  /**
325
354
  * Sets command runner function to wrap the command execution.
326
355
  * @param fn The function to set.
@@ -359,7 +388,9 @@ declare class CommandRegistrar {
359
388
  /**
360
389
  * Gets the commands data.
361
390
  */
362
- getCommandsData(): CommandData[];
391
+ getCommandsData(): (CommandData & {
392
+ __metadata?: CommandMetadata;
393
+ })[];
363
394
  /**
364
395
  * Registers loaded commands.
365
396
  */
@@ -367,11 +398,15 @@ declare class CommandRegistrar {
367
398
  /**
368
399
  * Updates the global commands.
369
400
  */
370
- updateGlobalCommands(commands: CommandData[]): Promise<void>;
401
+ updateGlobalCommands(commands: (CommandData & {
402
+ __metadata?: CommandMetadata;
403
+ })[]): Promise<void>;
371
404
  /**
372
405
  * Updates the guild commands.
373
406
  */
374
- updateGuildCommands(commands: CommandData[]): Promise<void>;
407
+ updateGuildCommands(commands: (CommandData & {
408
+ __metadata?: CommandMetadata;
409
+ })[]): Promise<void>;
375
410
  }
376
411
  //#endregion
377
412
  //#region src/context/environment.d.ts
@@ -417,6 +452,10 @@ interface CommandKitEnvironmentInternalData {
417
452
  * This can be used to access request-specific data or application state.
418
453
  */
419
454
  context: Context | null;
455
+ /**
456
+ * Shared collection instance for arbitrary data storage
457
+ */
458
+ store: Collection<any, any>;
420
459
  }
421
460
  /**
422
461
  * Represents the execution environment for CommandKit commands.
@@ -464,6 +503,10 @@ declare class CommandKitEnvironment {
464
503
  * The variables store for this environment.
465
504
  */
466
505
  get variables(): Map<string, any>;
506
+ /**
507
+ * The shared store for this environment
508
+ */
509
+ get store(): Collection<any, any>;
467
510
  /**
468
511
  * Register a deferred function.
469
512
  * @param fn - The deferred function to register.
@@ -594,6 +637,10 @@ declare function getContext(): CommandKitEnvironment | undefined;
594
637
  * Use current commandkit context. Throws an error if no context is found.
595
638
  */
596
639
  declare function useEnvironment(): CommandKitEnvironment;
640
+ /**
641
+ * Use the shared data store in the current environment. Throws an error if no context is found.
642
+ */
643
+ declare function useStore(): Collection<any, any>;
597
644
  //#endregion
598
645
  //#region src/app/commands/AppCommandRunner.d.ts
599
646
  /**
@@ -631,6 +678,7 @@ declare class AppCommandRunner {
631
678
  * Handles the complete command lifecycle including before/after middleware execution.
632
679
  * @param prepared - The prepared command execution data
633
680
  * @param source - The source interaction or message that triggered the command
681
+ * @param options - The options for running the command
634
682
  */
635
683
  runCommand(prepared: PreparedAppCommandExecution, source: Interaction | Message, options?: RunCommandOptions): Promise<any>;
636
684
  /**
@@ -653,6 +701,8 @@ type RunCommand = <T extends AsyncFunction>(fn: T) => T;
653
701
  */
654
702
  interface AppCommandNative {
655
703
  command: CommandData | Record<string, any>;
704
+ generateMetadata?: CommandMetadataFunction;
705
+ metadata?: CommandMetadata;
656
706
  chatInput?: (ctx: Context) => Awaitable<unknown>;
657
707
  autocomplete?: (ctx: Context) => Awaitable<unknown>;
658
708
  message?: (ctx: Context) => Awaitable<unknown>;
@@ -684,8 +734,8 @@ interface AppCommandMiddleware {
684
734
  */
685
735
  interface LoadedCommand {
686
736
  command: Command;
737
+ metadata: CommandMetadata;
687
738
  data: AppCommand;
688
- guilds?: string[];
689
739
  }
690
740
  /**
691
741
  * Type representing command data identifier.
@@ -727,8 +777,20 @@ declare const commandDataSchema: {
727
777
  messageContextMenu: (c: unknown) => c is Function;
728
778
  userContextMenu: (c: unknown) => c is Function;
729
779
  };
780
+ /**
781
+ * @private
782
+ * @internal
783
+ */
730
784
  type CommandDataSchema = typeof commandDataSchema;
785
+ /**
786
+ * @private
787
+ * @internal
788
+ */
731
789
  type CommandDataSchemaKey = keyof CommandDataSchema;
790
+ /**
791
+ * @private
792
+ * @internal
793
+ */
732
794
  type CommandDataSchemaValue = CommandDataSchema[CommandDataSchemaKey];
733
795
  /**
734
796
  * Handles application commands for CommandKit, including loading, registration, and execution.
@@ -800,6 +862,7 @@ declare class AppCommandHandler {
800
862
  /**
801
863
  * Finds a command by name.
802
864
  * @param name - The command name to search for
865
+ * @param hint - The hint for the command type (user or message)
803
866
  * @returns The loaded command or null if not found
804
867
  */
805
868
  private findCommandByName;
@@ -841,6 +904,13 @@ declare class AppCommandHandler {
841
904
  * @internal
842
905
  */
843
906
  private loadCommand;
907
+ /**
908
+ * Gets the metadata for a command.
909
+ * @param command - The command name to get metadata for
910
+ * @param hint - The hint for the command type (user or message)
911
+ * @returns The command metadata or null if not found
912
+ */
913
+ getMetadataFor(command: string, hint?: 'user' | 'message'): CommandMetadata | null;
844
914
  }
845
915
  //#endregion
846
916
  //#region src/events/CommandKitEventsChannel.d.ts
@@ -1039,6 +1109,7 @@ declare function registerDevHooks(commandkit: CommandKit): void;
1039
1109
  */
1040
1110
  declare abstract class RuntimePlugin<T extends PluginOptions = PluginOptions> extends PluginCommon<T, CommandKitPluginRuntime> {
1041
1111
  readonly type = PluginType.Runtime;
1112
+ readonly preload: Set<string>;
1042
1113
  /**
1043
1114
  * Called before commands are loaded
1044
1115
  */
@@ -1426,6 +1497,11 @@ declare class CommandKitPluginRuntime {
1426
1497
  * @param plugin The plugin to be fetched.
1427
1498
  */
1428
1499
  get<T extends Constructable<any>>(plugin: T): InstanceType<T> | null;
1500
+ /**
1501
+ * Pre-loads the specified entrypoints for the given plugin.
1502
+ * @param plugin The plugin to pre-load.
1503
+ */
1504
+ preload(plugin: RuntimePlugin): Promise<void>;
1429
1505
  /**
1430
1506
  * Soft registers a plugin in the runtime.
1431
1507
  * @param plugin The plugin to be registered.
@@ -1864,6 +1940,11 @@ interface CommandKitConfig {
1864
1940
  * @default false
1865
1941
  */
1866
1942
  disablePrefixCommands?: boolean;
1943
+ /**
1944
+ * Whether or not to disable the built-in permissions middleware. This only affects `botPermissions` and `userPermissions` in the command metadata.
1945
+ * @default false
1946
+ */
1947
+ disablePermissionsMiddleware?: boolean;
1867
1948
  /**
1868
1949
  * Whether or not to show a warning when a prefix command is not found. This only affects development mode.
1869
1950
  * @default true
@@ -1909,7 +1990,7 @@ interface CommandKitConfiguration {
1909
1990
  * @param message The message to get the command prefix for.
1910
1991
  * @returns The command prefix or an array of prefixes.
1911
1992
  */
1912
- getMessageCommandPrefix: (message: Message) => Awaitable<string | string[]>;
1993
+ getMessageCommandPrefix: (message: Message) => Awaitable<string | string[] | RegExp>;
1913
1994
  }
1914
1995
  /**
1915
1996
  * Represents the function executed during the bootstrap phase of CommandKit.
@@ -2034,7 +2115,7 @@ declare class CommandKit extends EventEmitter {
2034
2115
  * Sets the prefix resolver for the command handler.
2035
2116
  * @param resolver The resolver function.
2036
2117
  */
2037
- setPrefixResolver(resolver: (message: Message) => Awaitable<string | string[]>): this;
2118
+ setPrefixResolver(resolver: (message: Message) => Awaitable<string | string[] | RegExp>): this;
2038
2119
  /**
2039
2120
  * Sets the default locale for the command handler.
2040
2121
  * @param locale The default locale.
@@ -2179,5 +2260,5 @@ declare class AnalyticsEngine {
2179
2260
  track(event: AnalyticsEvent): Promise<void>;
2180
2261
  }
2181
2262
  //#endregion
2182
- export { AnalyticsEngine, AnalyticsEvent, AnalyticsProvider, AnyCommandExecute, AppCommand, AppCommandHandler, AppCommandNative, AppCommandRunner, AppEventsHandler, AppEventsHandlerLoadedData, AsyncFunction, AutocompleteCommand, AutocompleteCommandContext, AutocompleteCommandMiddlewareContext, BootstrapFunction, ChatInputCommand, ChatInputCommandContext, CommandBuilderLike, CommandContext, CommandContextOptions, CommandData, CommandDataSchema, CommandDataSchemaKey, CommandDataSchemaValue, CommandExecutionMode, CommandFlagContext, CommandKit, CommandKitCompilerOptions, CommandKitConfig, CommandKitConfiguration, CommandKitEnvironment, CommandKitEnvironmentInternalData, CommandKitEnvironmentType, CommandKitEventDispatch, CommandKitEventsChannel, CommandKitHMREvent, CommandKitOptions, CommandKitPlugin, CommandKitPluginRuntime, CommandRegistrar, CommandTypeData, CommonDirectiveTransformer, CommonDirectiveTransformerOptions, CommonPluginRuntime, CompilerPlugin, CompilerPluginRuntime, Context, ContextParameters, CustomAppCommandProps, CustomEvaluationContext, CustomEvaluationFunction, DecideFunction, DeepPartial, DeepRequired, EvaluationContext, EventFlagContext, EventHandler, EventListener, FeatureFlag, FeatureFlagDefinition, FilterFunction, FlagConfiguration, FlagProvider, FlagRunner, FlagStore, GenericFunction, IdentifyEvent, IdentifyFunction, InteractionCommandContext, InteractionCommandMiddlewareContext, IpcMessageCommand, JsonFlagProvider, ListenerFunction, LoadedCommand, LoadedEvent, MaybeFalsey, MaybePromise, MessageCommand, MessageCommandContext, MessageCommandMiddlewareContext, MessageContextMenuCommand, MessageContextMenuCommandContext, MessageContextMenuCommandMiddlewareContext, MiddlewareContext, MiddlewareContextArgs, PluginCommon, PluginOptions, PluginTransformParameters, PluginType, PreRegisterCommandsEvent, PreparedAppCommandExecution, ResolvableCommand, ResolvedCommandKitConfig, RunCommand, RunCommandOptions, RuntimePlugin, SlashCommandMiddlewareContext, TemplateHandler, TransformedResult, UserContextMenuCommand, UserContextMenuCommandContext, UserContextMenuCommandMiddlewareContext, after, cancelAfter, commandkit, exitContext, flag, getCommandKit, getContext, isCommandWorkerContext, isCompilerPlugin, isPlugin, isRuntimePlugin, makeContextAwareFunction, mergeDeep, onApplicationBootstrap, onBootstrap, provideContext, registerDevHooks, setFlagProvider, useEnvironment };
2183
- //# sourceMappingURL=analytics-engine-vA4MaJYx.d.ts.map
2263
+ export { AnalyticsEngine, AnalyticsEvent, AnalyticsProvider, AnyCommandExecute, AppCommand, AppCommandHandler, AppCommandNative, AppCommandRunner, AppEventsHandler, AppEventsHandlerLoadedData, AsyncFunction, AutocompleteCommand, AutocompleteCommandContext, AutocompleteCommandMiddlewareContext, BootstrapFunction, ChatInputCommand, ChatInputCommandContext, CommandBuilderLike, CommandContext, CommandContextOptions, CommandData, CommandDataSchema, CommandDataSchemaKey, CommandDataSchemaValue, CommandExecutionMode, CommandFlagContext, CommandKit, CommandKitCompilerOptions, CommandKitConfig, CommandKitConfiguration, CommandKitEnvironment, CommandKitEnvironmentInternalData, CommandKitEnvironmentType, CommandKitEventDispatch, CommandKitEventsChannel, CommandKitHMREvent, CommandKitOptions, CommandKitPlugin, CommandKitPluginRuntime, CommandMetadata, CommandMetadataFunction, CommandRegistrar, CommandTypeData, CommonDirectiveTransformer, CommonDirectiveTransformerOptions, CommonPluginRuntime, CompilerPlugin, CompilerPluginRuntime, Context, ContextParameters, CustomAppCommandProps, CustomEvaluationContext, CustomEvaluationFunction, DecideFunction, DeepPartial, DeepRequired, EvaluationContext, EventFlagContext, EventHandler, EventListener, FeatureFlag, FeatureFlagDefinition, FilterFunction, FlagConfiguration, FlagProvider, FlagRunner, FlagStore, GenericFunction, IdentifyEvent, IdentifyFunction, InteractionCommandContext, InteractionCommandMiddlewareContext, IpcMessageCommand, JsonFlagProvider, LegacyCommandMetadata, ListenerFunction, LoadedCommand, LoadedEvent, MaybeFalsey, MaybePromise, MessageCommand, MessageCommandContext, MessageCommandMiddlewareContext, MessageContextMenuCommand, MessageContextMenuCommandContext, MessageContextMenuCommandMiddlewareContext, MiddlewareContext, MiddlewareContextArgs, PluginCommon, PluginOptions, PluginTransformParameters, PluginType, PreRegisterCommandsEvent, PreparedAppCommandExecution, ResolvableCommand, ResolvedCommandKitConfig, RunCommand, RunCommandOptions, RuntimePlugin, SlashCommandMiddlewareContext, TemplateHandler, TransformedResult, UserContextMenuCommand, UserContextMenuCommandContext, UserContextMenuCommandMiddlewareContext, after, cancelAfter, commandkit, exitContext, flag, getCommandKit, getContext, isCommandWorkerContext, isCompilerPlugin, isPlugin, isRuntimePlugin, makeContextAwareFunction, mergeDeep, onApplicationBootstrap, onBootstrap, provideContext, registerDevHooks, setFlagProvider, useEnvironment, useStore };
2264
+ //# sourceMappingURL=analytics-engine-jVeSoxEk.d.ts.map