commandkit 0.1.10-dev.20240128000000 → 0.1.10-dev.20240131174628

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 (328) hide show
  1. package/bin/index.cjs +3 -0
  2. package/dist/CommandKit--SA9LcIq.d.mts +452 -0
  3. package/dist/CommandKit-GIHMEeqf.d.ts +452 -0
  4. package/dist/CommandKit.d.mts +5 -0
  5. package/dist/CommandKit.d.ts +5 -0
  6. package/dist/CommandKit.js +11 -0
  7. package/dist/CommandKit.js.map +1 -0
  8. package/dist/CommandKit.mjs +2 -0
  9. package/dist/CommandKit.mjs.map +1 -0
  10. package/dist/bootstrap/client.d.mts +13 -0
  11. package/dist/bootstrap/client.d.ts +13 -0
  12. package/dist/bootstrap/client.js +2 -0
  13. package/dist/bootstrap/client.js.map +1 -0
  14. package/dist/bootstrap/client.mjs +2 -0
  15. package/dist/bootstrap/client.mjs.map +1 -0
  16. package/dist/bootstrap/loadEnv.d.mts +3 -0
  17. package/dist/bootstrap/loadEnv.d.ts +3 -0
  18. package/dist/bootstrap/loadEnv.js +2 -0
  19. package/dist/bootstrap/loadEnv.js.map +1 -0
  20. package/dist/bootstrap/loadEnv.mjs +2 -0
  21. package/dist/bootstrap/loadEnv.mjs.map +1 -0
  22. package/dist/chunk-3RMN5A5C.mjs +2 -0
  23. package/dist/chunk-3RMN5A5C.mjs.map +1 -0
  24. package/dist/chunk-47OCM32X.mjs +2 -0
  25. package/dist/chunk-47OCM32X.mjs.map +1 -0
  26. package/dist/chunk-4M5YKUGX.mjs +2 -0
  27. package/dist/chunk-4M5YKUGX.mjs.map +1 -0
  28. package/dist/chunk-5A7S2KUP.mjs +2 -0
  29. package/dist/chunk-5A7S2KUP.mjs.map +1 -0
  30. package/dist/chunk-5NCNVJD5.mjs +4 -0
  31. package/dist/chunk-5NCNVJD5.mjs.map +1 -0
  32. package/dist/chunk-67SR2RRV.mjs +2 -0
  33. package/dist/chunk-67SR2RRV.mjs.map +1 -0
  34. package/dist/chunk-6I5SY5IL.mjs +2 -0
  35. package/dist/chunk-6I5SY5IL.mjs.map +1 -0
  36. package/dist/chunk-7KD7ZCH6.mjs +2 -0
  37. package/dist/chunk-7KD7ZCH6.mjs.map +1 -0
  38. package/dist/chunk-BWCE2PU3.mjs +2 -0
  39. package/dist/chunk-BWCE2PU3.mjs.map +1 -0
  40. package/dist/chunk-CCTUTTKF.mjs +2 -0
  41. package/dist/chunk-CCTUTTKF.mjs.map +1 -0
  42. package/dist/chunk-DJGEQTVH.mjs +2 -0
  43. package/dist/chunk-DJGEQTVH.mjs.map +1 -0
  44. package/dist/chunk-GLH4FCGA.mjs +2 -0
  45. package/dist/chunk-GLH4FCGA.mjs.map +1 -0
  46. package/dist/chunk-KWPUAQ7H.mjs +2 -0
  47. package/dist/chunk-KWPUAQ7H.mjs.map +1 -0
  48. package/dist/chunk-LVMZYYYQ.mjs +2 -0
  49. package/dist/chunk-LVMZYYYQ.mjs.map +1 -0
  50. package/dist/chunk-M5FMJETI.mjs +1 -0
  51. package/dist/chunk-M5FMJETI.mjs.map +1 -0
  52. package/dist/chunk-NAGAOZDU.mjs +2 -0
  53. package/dist/chunk-NAGAOZDU.mjs.map +1 -0
  54. package/dist/chunk-P22KPISA.mjs +2 -0
  55. package/dist/chunk-P22KPISA.mjs.map +1 -0
  56. package/dist/chunk-PFU3PH6M.mjs +1 -0
  57. package/dist/chunk-PFU3PH6M.mjs.map +1 -0
  58. package/dist/chunk-QVM3SASI.mjs +2 -0
  59. package/dist/chunk-QVM3SASI.mjs.map +1 -0
  60. package/dist/chunk-R4SUPDLH.mjs +2 -0
  61. package/dist/chunk-R4SUPDLH.mjs.map +1 -0
  62. package/dist/chunk-RWJJP4OR.mjs +2 -0
  63. package/dist/chunk-RWJJP4OR.mjs.map +1 -0
  64. package/dist/chunk-UWPC5P4C.mjs +2 -0
  65. package/dist/chunk-UWPC5P4C.mjs.map +1 -0
  66. package/dist/chunk-VURGPMLB.mjs +2 -0
  67. package/dist/chunk-VURGPMLB.mjs.map +1 -0
  68. package/dist/chunk-WTRDOPQV.mjs +2 -0
  69. package/dist/chunk-WTRDOPQV.mjs.map +1 -0
  70. package/dist/chunk-XFI3OAJH.mjs +2 -0
  71. package/dist/chunk-XFI3OAJH.mjs.map +1 -0
  72. package/dist/chunk-YVVGY7EA.mjs +7 -0
  73. package/dist/chunk-YVVGY7EA.mjs.map +1 -0
  74. package/dist/chunk-ZBUBSPF6.mjs +4 -0
  75. package/dist/chunk-ZBUBSPF6.mjs.map +1 -0
  76. package/dist/components/ButtonKit.d.mts +55 -0
  77. package/dist/components/ButtonKit.d.ts +55 -0
  78. package/dist/components/ButtonKit.js +2 -0
  79. package/dist/components/ButtonKit.js.map +1 -0
  80. package/dist/components/ButtonKit.mjs +2 -0
  81. package/dist/components/ButtonKit.mjs.map +1 -0
  82. package/dist/components/index.d.mts +2 -0
  83. package/dist/components/index.d.ts +2 -0
  84. package/dist/components/index.js +2 -0
  85. package/dist/components/index.js.map +1 -0
  86. package/dist/components/index.mjs +2 -0
  87. package/dist/components/index.mjs.map +1 -0
  88. package/dist/config.d.mts +55 -0
  89. package/dist/config.d.ts +55 -0
  90. package/dist/config.js +2 -0
  91. package/dist/config.js.map +1 -0
  92. package/dist/config.mjs +2 -0
  93. package/dist/config.mjs.map +1 -0
  94. package/dist/environment/actions/development.d.mts +8 -0
  95. package/dist/environment/actions/development.d.ts +8 -0
  96. package/dist/environment/actions/development.js +2 -0
  97. package/dist/environment/actions/development.js.map +1 -0
  98. package/dist/environment/actions/development.mjs +2 -0
  99. package/dist/environment/actions/development.mjs.map +1 -0
  100. package/dist/environment/bundler/bundle.d.mts +3 -0
  101. package/dist/environment/bundler/bundle.d.ts +3 -0
  102. package/dist/environment/bundler/bundle.js +2 -0
  103. package/dist/environment/bundler/bundle.js.map +1 -0
  104. package/dist/environment/bundler/bundle.mjs +2 -0
  105. package/dist/environment/bundler/bundle.mjs.map +1 -0
  106. package/dist/environment/bundler/shims.d.mts +3 -0
  107. package/dist/environment/bundler/shims.d.ts +3 -0
  108. package/dist/environment/bundler/shims.js +11 -0
  109. package/dist/environment/bundler/shims.js.map +1 -0
  110. package/dist/environment/bundler/shims.mjs +11 -0
  111. package/dist/environment/bundler/shims.mjs.map +1 -0
  112. package/dist/environment/cli.d.mts +2 -0
  113. package/dist/environment/cli.d.ts +2 -0
  114. package/dist/environment/cli.js +2 -0
  115. package/dist/environment/cli.js.map +1 -0
  116. package/dist/environment/cli.mjs +2 -0
  117. package/dist/environment/cli.mjs.map +1 -0
  118. package/dist/environment/common/config.d.mts +7 -0
  119. package/dist/environment/common/config.d.ts +7 -0
  120. package/dist/environment/common/config.js +2 -0
  121. package/dist/environment/common/config.js.map +1 -0
  122. package/dist/environment/common/config.mjs +2 -0
  123. package/dist/environment/common/config.mjs.map +1 -0
  124. package/dist/environment/common/logger.d.mts +9 -0
  125. package/dist/environment/common/logger.d.ts +9 -0
  126. package/dist/environment/common/logger.js +2 -0
  127. package/dist/environment/common/logger.js.map +1 -0
  128. package/dist/environment/common/logger.mjs +2 -0
  129. package/dist/environment/common/logger.mjs.map +1 -0
  130. package/dist/handlers/command-handler/CommandHandler.d.mts +5 -0
  131. package/dist/handlers/command-handler/CommandHandler.d.ts +5 -0
  132. package/dist/handlers/command-handler/CommandHandler.js +11 -0
  133. package/dist/handlers/command-handler/CommandHandler.js.map +1 -0
  134. package/dist/handlers/command-handler/CommandHandler.mjs +2 -0
  135. package/dist/handlers/command-handler/CommandHandler.mjs.map +1 -0
  136. package/dist/handlers/command-handler/functions/loadCommandsWithRest.d.mts +35 -0
  137. package/dist/handlers/command-handler/functions/loadCommandsWithRest.d.ts +35 -0
  138. package/dist/handlers/command-handler/functions/loadCommandsWithRest.js +4 -0
  139. package/dist/handlers/command-handler/functions/loadCommandsWithRest.js.map +1 -0
  140. package/dist/handlers/command-handler/functions/loadCommandsWithRest.mjs +2 -0
  141. package/dist/handlers/command-handler/functions/loadCommandsWithRest.mjs.map +1 -0
  142. package/dist/handlers/command-handler/functions/registerCommands.d.mts +20 -0
  143. package/dist/handlers/command-handler/functions/registerCommands.d.ts +20 -0
  144. package/dist/handlers/command-handler/functions/registerCommands.js +7 -0
  145. package/dist/handlers/command-handler/functions/registerCommands.js.map +1 -0
  146. package/dist/handlers/command-handler/functions/registerCommands.mjs +2 -0
  147. package/dist/handlers/command-handler/functions/registerCommands.mjs.map +1 -0
  148. package/dist/handlers/command-handler/typings.d.mts +5 -0
  149. package/dist/handlers/command-handler/typings.d.ts +5 -0
  150. package/dist/handlers/command-handler/typings.js +2 -0
  151. package/dist/handlers/command-handler/typings.js.map +1 -0
  152. package/dist/handlers/command-handler/typings.mjs +1 -0
  153. package/dist/handlers/command-handler/typings.mjs.map +1 -0
  154. package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.d.mts +9 -0
  155. package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.d.ts +9 -0
  156. package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.js +2 -0
  157. package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.js.map +1 -0
  158. package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.mjs +2 -0
  159. package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.mjs.map +1 -0
  160. package/dist/handlers/command-handler/validations/devOnly.d.mts +9 -0
  161. package/dist/handlers/command-handler/validations/devOnly.d.ts +9 -0
  162. package/dist/handlers/command-handler/validations/devOnly.js +2 -0
  163. package/dist/handlers/command-handler/validations/devOnly.js.map +1 -0
  164. package/dist/handlers/command-handler/validations/devOnly.mjs +2 -0
  165. package/dist/handlers/command-handler/validations/devOnly.mjs.map +1 -0
  166. package/dist/handlers/command-handler/validations/index.d.mts +10 -0
  167. package/dist/handlers/command-handler/validations/index.d.ts +10 -0
  168. package/dist/handlers/command-handler/validations/index.js +4 -0
  169. package/dist/handlers/command-handler/validations/index.js.map +1 -0
  170. package/dist/handlers/command-handler/validations/index.mjs +2 -0
  171. package/dist/handlers/command-handler/validations/index.mjs.map +1 -0
  172. package/dist/handlers/command-handler/validations/permissions.d.mts +9 -0
  173. package/dist/handlers/command-handler/validations/permissions.d.ts +9 -0
  174. package/dist/handlers/command-handler/validations/permissions.js +4 -0
  175. package/dist/handlers/command-handler/validations/permissions.js.map +1 -0
  176. package/dist/handlers/command-handler/validations/permissions.mjs +2 -0
  177. package/dist/handlers/command-handler/validations/permissions.mjs.map +1 -0
  178. package/dist/handlers/event-handler/EventHandler.d.mts +5 -0
  179. package/dist/handlers/event-handler/EventHandler.d.ts +5 -0
  180. package/dist/handlers/event-handler/EventHandler.js +2 -0
  181. package/dist/handlers/event-handler/EventHandler.js.map +1 -0
  182. package/dist/handlers/event-handler/EventHandler.mjs +2 -0
  183. package/dist/handlers/event-handler/EventHandler.mjs.map +1 -0
  184. package/dist/handlers/event-handler/typings.d.mts +5 -0
  185. package/dist/handlers/event-handler/typings.d.ts +5 -0
  186. package/dist/handlers/event-handler/typings.js +2 -0
  187. package/dist/handlers/event-handler/typings.js.map +1 -0
  188. package/dist/handlers/event-handler/typings.mjs +1 -0
  189. package/dist/handlers/event-handler/typings.mjs.map +1 -0
  190. package/dist/handlers/index.d.mts +5 -0
  191. package/dist/handlers/index.d.ts +5 -0
  192. package/dist/handlers/index.js +11 -0
  193. package/dist/handlers/index.js.map +1 -0
  194. package/dist/handlers/index.mjs +2 -0
  195. package/dist/handlers/index.mjs.map +1 -0
  196. package/dist/handlers/validation-handler/ValidationHandler.d.mts +14 -0
  197. package/dist/handlers/validation-handler/ValidationHandler.d.ts +14 -0
  198. package/dist/handlers/validation-handler/ValidationHandler.js +2 -0
  199. package/dist/handlers/validation-handler/ValidationHandler.js.map +1 -0
  200. package/dist/handlers/validation-handler/ValidationHandler.mjs +2 -0
  201. package/dist/handlers/validation-handler/ValidationHandler.mjs.map +1 -0
  202. package/dist/handlers/validation-handler/typings.d.mts +14 -0
  203. package/dist/handlers/validation-handler/typings.d.ts +14 -0
  204. package/dist/handlers/validation-handler/typings.js +2 -0
  205. package/dist/handlers/validation-handler/typings.js.map +1 -0
  206. package/dist/handlers/validation-handler/typings.mjs +1 -0
  207. package/dist/handlers/validation-handler/typings.mjs.map +1 -0
  208. package/dist/hooks/common.d.mts +12 -0
  209. package/dist/hooks/common.d.ts +12 -0
  210. package/dist/hooks/common.js +11 -0
  211. package/dist/hooks/common.js.map +1 -0
  212. package/dist/hooks/common.mjs +2 -0
  213. package/dist/hooks/common.mjs.map +1 -0
  214. package/dist/hooks/index.d.mts +14 -0
  215. package/dist/hooks/index.d.ts +14 -0
  216. package/dist/hooks/index.js +11 -0
  217. package/dist/hooks/index.js.map +1 -0
  218. package/dist/hooks/index.mjs +2 -0
  219. package/dist/hooks/index.mjs.map +1 -0
  220. package/dist/hooks/response.d.mts +7 -0
  221. package/dist/hooks/response.d.ts +7 -0
  222. package/dist/hooks/response.js +11 -0
  223. package/dist/hooks/response.js.map +1 -0
  224. package/dist/hooks/response.mjs +2 -0
  225. package/dist/hooks/response.mjs.map +1 -0
  226. package/dist/hooks/useChannel.d.mts +5 -0
  227. package/dist/hooks/useChannel.d.ts +5 -0
  228. package/dist/hooks/useChannel.js +11 -0
  229. package/dist/hooks/useChannel.js.map +1 -0
  230. package/dist/hooks/useChannel.mjs +2 -0
  231. package/dist/hooks/useChannel.mjs.map +1 -0
  232. package/dist/hooks/useClient.d.mts +5 -0
  233. package/dist/hooks/useClient.d.ts +5 -0
  234. package/dist/hooks/useClient.js +11 -0
  235. package/dist/hooks/useClient.js.map +1 -0
  236. package/dist/hooks/useClient.mjs +2 -0
  237. package/dist/hooks/useClient.mjs.map +1 -0
  238. package/dist/hooks/useCommandData.d.mts +5 -0
  239. package/dist/hooks/useCommandData.d.ts +5 -0
  240. package/dist/hooks/useCommandData.js +11 -0
  241. package/dist/hooks/useCommandData.js.map +1 -0
  242. package/dist/hooks/useCommandData.mjs +2 -0
  243. package/dist/hooks/useCommandData.mjs.map +1 -0
  244. package/dist/hooks/useCommandKit.d.mts +9 -0
  245. package/dist/hooks/useCommandKit.d.ts +9 -0
  246. package/dist/hooks/useCommandKit.js +11 -0
  247. package/dist/hooks/useCommandKit.js.map +1 -0
  248. package/dist/hooks/useCommandKit.mjs +2 -0
  249. package/dist/hooks/useCommandKit.mjs.map +1 -0
  250. package/dist/hooks/useGuild.d.mts +5 -0
  251. package/dist/hooks/useGuild.d.ts +5 -0
  252. package/dist/hooks/useGuild.js +11 -0
  253. package/dist/hooks/useGuild.js.map +1 -0
  254. package/dist/hooks/useGuild.mjs +2 -0
  255. package/dist/hooks/useGuild.mjs.map +1 -0
  256. package/dist/hooks/useInteraction.d.mts +9 -0
  257. package/dist/hooks/useInteraction.d.ts +9 -0
  258. package/dist/hooks/useInteraction.js +11 -0
  259. package/dist/hooks/useInteraction.js.map +1 -0
  260. package/dist/hooks/useInteraction.mjs +2 -0
  261. package/dist/hooks/useInteraction.mjs.map +1 -0
  262. package/dist/hooks/useMember.d.mts +5 -0
  263. package/dist/hooks/useMember.d.ts +5 -0
  264. package/dist/hooks/useMember.js +11 -0
  265. package/dist/hooks/useMember.js.map +1 -0
  266. package/dist/hooks/useMember.mjs +2 -0
  267. package/dist/hooks/useMember.mjs.map +1 -0
  268. package/dist/hooks/useUser.d.mts +5 -0
  269. package/dist/hooks/useUser.d.ts +5 -0
  270. package/dist/hooks/useUser.js +11 -0
  271. package/dist/hooks/useUser.js.map +1 -0
  272. package/dist/hooks/useUser.mjs +2 -0
  273. package/dist/hooks/useUser.mjs.map +1 -0
  274. package/dist/index.d.mts +25 -535
  275. package/dist/index.d.ts +25 -535
  276. package/dist/index.js +6 -5
  277. package/dist/index.js.map +1 -0
  278. package/dist/index.mjs +2 -10
  279. package/dist/index.mjs.map +1 -0
  280. package/dist/types/index.d.mts +5 -0
  281. package/dist/types/index.d.ts +5 -0
  282. package/dist/types/index.js +2 -0
  283. package/dist/types/index.js.map +1 -0
  284. package/dist/types/index.mjs +2 -0
  285. package/dist/types/index.mjs.map +1 -0
  286. package/dist/typings.d.mts +5 -0
  287. package/dist/typings.d.ts +5 -0
  288. package/dist/typings.js +2 -0
  289. package/dist/typings.js.map +1 -0
  290. package/dist/typings.mjs +1 -0
  291. package/dist/typings.mjs.map +1 -0
  292. package/dist/utils/clone.d.mts +3 -0
  293. package/dist/utils/clone.d.ts +3 -0
  294. package/dist/utils/clone.js +2 -0
  295. package/dist/utils/clone.js.map +1 -0
  296. package/dist/utils/clone.mjs +2 -0
  297. package/dist/utils/clone.mjs.map +1 -0
  298. package/dist/utils/colors.d.mts +27 -0
  299. package/dist/utils/colors.d.ts +27 -0
  300. package/dist/utils/colors.js +2 -0
  301. package/dist/utils/colors.js.map +1 -0
  302. package/dist/utils/colors.mjs +2 -0
  303. package/dist/utils/colors.mjs.map +1 -0
  304. package/dist/utils/get-paths.d.mts +4 -0
  305. package/dist/utils/get-paths.d.ts +4 -0
  306. package/dist/utils/get-paths.js +2 -0
  307. package/dist/utils/get-paths.js.map +1 -0
  308. package/dist/utils/get-paths.mjs +2 -0
  309. package/dist/utils/get-paths.mjs.map +1 -0
  310. package/dist/utils/resolve-file-url.d.mts +8 -0
  311. package/dist/utils/resolve-file-url.d.ts +8 -0
  312. package/dist/utils/resolve-file-url.js +2 -0
  313. package/dist/utils/resolve-file-url.js.map +1 -0
  314. package/dist/utils/resolve-file-url.mjs +2 -0
  315. package/dist/utils/resolve-file-url.mjs.map +1 -0
  316. package/dist/utils/signal.d.mts +21 -0
  317. package/dist/utils/signal.d.ts +21 -0
  318. package/dist/utils/signal.js +2 -0
  319. package/dist/utils/signal.js.map +1 -0
  320. package/dist/utils/signal.mjs +2 -0
  321. package/dist/utils/signal.mjs.map +1 -0
  322. package/package.json +67 -57
  323. package/bin/build.mjs +0 -107
  324. package/bin/common.mjs +0 -102
  325. package/bin/development.mjs +0 -168
  326. package/bin/index.mjs +0 -39
  327. package/bin/parse-env.mjs +0 -61
  328. package/bin/production.mjs +0 -83
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/environment/bundler/bundle.ts","../../../src/config.ts"],"sourcesContent":["import { build } from 'tsup';\nimport { getConfig } from '../../config';\nimport { join } from 'path';\n\nexport function bundle(mode: 'development' | 'production') {\n switch (mode) {\n case 'development':\n return buildDevelopment();\n default:\n throw new Error('Not implemented');\n }\n}\n\nfunction buildDevelopment() {\n const { watch } = getConfig();\n\n const outDir = join(process.cwd(), '.commandkit');\n\n return build({\n clean: true,\n format: ['esm'],\n bundle: false,\n dts: false,\n skipNodeModulesBundle: true,\n minify: false,\n shims: true,\n sourcemap: 'inline',\n keepNames: true,\n outDir: '.commandkit',\n silent: true,\n entry: ['src'],\n watch,\n async onSuccess() {\n // return await injectShims('.commandkit', main, false, requirePolyfill);\n },\n }).then(() => {\n return join(outDir, 'client.mjs');\n });\n}\n","import type { ClientOptions } from 'discord.js';\n\nexport interface CommandKitConfig {\n /**\n * The Discord client options.\n */\n clientOptions: ClientOptions;\n /**\n * The Discord bot token. Defaults to `process.env.DISCORD_TOKEN`.\n */\n token?: string;\n /**\n * Whether or not to use the watch mode. Defaults to `true`.\n */\n watch: boolean;\n /**\n * The output directory of the project. Defaults to `dist`.\n */\n outDir: string;\n /**\n * Whether or not to include extra env utilities. Defaults to `true`.\n */\n envExtra: boolean;\n /**\n * Node.js cli options.\n */\n nodeOptions: string[];\n /**\n * Whether or not to clear default restart logs. Defaults to `true`.\n */\n clearRestartLogs: boolean;\n /**\n * Whether or not to minify the output. Defaults to `false`.\n */\n minify: boolean;\n /**\n * Whether or not to include sourcemaps in production build. Defaults to `false`.\n */\n sourcemap: boolean | 'inline';\n /**\n * Whether or not to include anti-crash handler in production. Defaults to `true`.\n */\n antiCrash: boolean;\n /**\n * Whether or not to polyfill `require` function. Defaults to `true`.\n */\n requirePolyfill: boolean;\n}\n\nlet globalConfig: Partial<CommandKitConfig> = {\n envExtra: true,\n outDir: 'dist',\n watch: true,\n clearRestartLogs: true,\n minify: false,\n sourcemap: false,\n nodeOptions: [],\n antiCrash: true,\n requirePolyfill: true,\n token: process.env.DISCORD_TOKEN,\n};\n\nexport function getConfig(): CommandKitConfig {\n return globalConfig as CommandKitConfig;\n}\n\nconst requiredProps = ['clientOptions'] as const;\n\ntype R = (typeof requiredProps)[number];\n\ntype PartialConfig<T extends CommandKitConfig> = Partial<Omit<T, R>> & Pick<T, R>;\n\nexport function defineConfig(config: PartialConfig<CommandKitConfig>) {\n for (const prop of requiredProps) {\n if (!config[prop]) {\n throw new Error(`[CommandKit Config] Missing required config property: ${prop}`);\n }\n }\n\n globalConfig = {\n ...globalConfig,\n ...config,\n };\n\n return globalConfig;\n}\n"],"mappings":"ouBAAA,+GAAA,gBAAsB,gBCiDtB,IAAI,aAA0C,CAC1C,SAAU,GACV,OAAQ,OACR,MAAO,GACP,iBAAkB,GAClB,OAAQ,GACR,UAAW,GACX,YAAa,CAAC,EACd,UAAW,GACX,gBAAiB,GACjB,MAAO,QAAQ,IAAI,aACvB,EAEO,SAAS,WAA8B,CAC1C,OAAO,YACX,CAFgB,8BD5DhB,gBAAqB,gBAEd,SAAS,OAAO,KAAoC,CACvD,OAAQ,KAAM,CACV,IAAK,cACD,OAAO,iBAAiB,EAC5B,QACI,MAAM,IAAI,MAAM,iBAAiB,CACzC,CACJ,CAPgB,wBAShB,SAAS,kBAAmB,CACxB,GAAM,CAAE,KAAM,EAAI,UAAU,EAEtB,UAAS,kBAAK,QAAQ,IAAI,EAAG,aAAa,EAEhD,SAAO,mBAAM,CACT,MAAO,GACP,OAAQ,CAAC,KAAK,EACd,OAAQ,GACR,IAAK,GACL,sBAAuB,GACvB,OAAQ,GACR,MAAO,GACP,UAAW,SACX,UAAW,GACX,OAAQ,cACR,OAAQ,GACR,MAAO,CAAC,KAAK,EACb,MACA,MAAM,WAAY,CAElB,CACJ,CAAC,EAAE,KAAK,OACG,kBAAK,OAAQ,YAAY,CACnC,CACL,CAzBS","names":[]}
@@ -0,0 +1,2 @@
1
+ import{bundle}from"../../chunk-QVM3SASI.mjs";import"../../chunk-BWCE2PU3.mjs";import"../../chunk-7KD7ZCH6.mjs";export{bundle};
2
+ //# sourceMappingURL=bundle.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,3 @@
1
+ declare function injectShims(outDir: string, main: string, antiCrash: boolean, polyfillRequire: boolean): Promise<void>;
2
+
3
+ export { injectShims };
@@ -0,0 +1,3 @@
1
+ declare function injectShims(outDir: string, main: string, antiCrash: boolean, polyfillRequire: boolean): Promise<void>;
2
+
3
+ export { injectShims };
@@ -0,0 +1,11 @@
1
+ "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var shims_exports={};__export(shims_exports,{injectShims:()=>injectShims});module.exports=__toCommonJS(shims_exports);var import_promises=require("fs/promises"),import_node_path=require("path");async function injectShims(outDir,main,antiCrash,polyfillRequire){let path=(0,import_node_path.join)(process.cwd(),outDir,main),head=[`
2
+
3
+ ;await (async()=>{`," 'use strict';"].join(`
4
+ `),tail=`
5
+ })();`,requireScript=polyfillRequire?["// --- CommandKit require() polyfill ---",' if (typeof require === "undefined") {',' const { createRequire } = await import("node:module");'," const __require = createRequire(import.meta.url);",' Object.defineProperty(globalThis, "require", {'," value: (id) => {"," return __require(id);"," },"," configurable: true,"," enumerable: false,"," writable: true,"," });"," }","// --- CommandKit require() polyfill ---"].join(`
6
+ `):"",antiCrashScript=antiCrash?["// --- CommandKit Anti-Crash Monitor ---"," // 'uncaughtException' event is supposed to be used to perform synchronous cleanup before shutting down the process"," // instead of using it as a means to resume operation."," // But it exists here due to compatibility reasons with discord bot ecosystem."," const p = (t) => `\\x1b[33m${t}\\x1b[0m`, b = '[CommandKit Anti-Crash Monitor]', l = console.log, e1 = 'uncaughtException', e2 = 'unhandledRejection';"," if (!process.eventNames().includes(e1)) // skip if it is already handled"," process.on(e1, (e) => {"," l(p(`${b} Uncaught Exception`)); l(p(b), p(e.stack || e));"," })"," if (!process.eventNames().includes(e2)) // skip if it is already handled"," process.on(e2, (r) => {"," l(p(`${b} Unhandled promise rejection`)); l(p(`${b} ${r.stack || r}`));"," });","// --- CommandKit Anti-Crash Monitor ---"].join(`
7
+ `):"",contents=await(0,import_promises.readFile)(path,"utf-8"),finalScript=[head,requireScript,antiCrashScript,tail,`
8
+
9
+ `,contents].join(`
10
+ `);return(0,import_promises.writeFile)(path,finalScript)}__name(injectShims,"injectShims");0&&(module.exports={injectShims});
11
+ //# sourceMappingURL=shims.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/environment/bundler/shims.ts"],"sourcesContent":["import { readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\nexport async function injectShims(\n outDir: string,\n main: string,\n antiCrash: boolean,\n polyfillRequire: boolean,\n) {\n const path = join(process.cwd(), outDir, main);\n\n const head = ['\\n\\n;await (async()=>{', \" 'use strict';\"].join('\\n');\n const tail = '\\n})();';\n const requireScript = polyfillRequire\n ? [\n '// --- CommandKit require() polyfill ---',\n ' if (typeof require === \"undefined\") {',\n ' const { createRequire } = await import(\"node:module\");',\n ' const __require = createRequire(import.meta.url);',\n ' Object.defineProperty(globalThis, \"require\", {',\n ' value: (id) => {',\n ' return __require(id);',\n ' },',\n ' configurable: true,',\n ' enumerable: false,',\n ' writable: true,',\n ' });',\n ' }',\n '// --- CommandKit require() polyfill ---',\n ].join('\\n')\n : '';\n\n const antiCrashScript = antiCrash\n ? [\n '// --- CommandKit Anti-Crash Monitor ---',\n \" // 'uncaughtException' event is supposed to be used to perform synchronous cleanup before shutting down the process\",\n ' // instead of using it as a means to resume operation.',\n ' // But it exists here due to compatibility reasons with discord bot ecosystem.',\n \" const p = (t) => `\\\\x1b[33m${t}\\\\x1b[0m`, b = '[CommandKit Anti-Crash Monitor]', l = console.log, e1 = 'uncaughtException', e2 = 'unhandledRejection';\",\n ' if (!process.eventNames().includes(e1)) // skip if it is already handled',\n ' process.on(e1, (e) => {',\n ' l(p(`${b} Uncaught Exception`)); l(p(b), p(e.stack || e));',\n ' })',\n ' if (!process.eventNames().includes(e2)) // skip if it is already handled',\n ' process.on(e2, (r) => {',\n ' l(p(`${b} Unhandled promise rejection`)); l(p(`${b} ${r.stack || r}`));',\n ' });',\n '// --- CommandKit Anti-Crash Monitor ---',\n ].join('\\n')\n : '';\n\n const contents = await readFile(path, 'utf-8');\n const finalScript = [head, requireScript, antiCrashScript, tail, '\\n\\n', contents].join('\\n');\n\n return writeFile(path, finalScript);\n}\n"],"mappings":"ouBAAA,sHAAA,oBAAoC,uBACpC,iBAAqB,gBAErB,eAAsB,YAClB,OACA,KACA,UACA,gBACF,CACE,IAAM,QAAO,uBAAK,QAAQ,IAAI,EAAG,OAAQ,IAAI,EAEvC,KAAO,CAAC;AAAA;AAAA,oBAA0B,iBAAiB,EAAE,KAAK;AAAA,CAAI,EAC9D,KAAO;AAAA,OACP,cAAgB,gBAChB,CACI,2CACA,0CACA,6DACA,wDACA,qDACA,yBACA,gCACA,WACA,4BACA,2BACA,wBACA,UACA,MACA,0CACJ,EAAE,KAAK;AAAA,CAAI,EACX,GAEA,gBAAkB,UAClB,CACI,2CACA,wHACA,2DACA,mFACA,2JACA,6EACA,8BACA,mEACA,SACA,6EACA,8BACA,gFACA,UACA,0CACJ,EAAE,KAAK;AAAA,CAAI,EACX,GAEA,SAAW,QAAM,0BAAS,KAAM,OAAO,EACvC,YAAc,CAAC,KAAM,cAAe,gBAAiB,KAAM;AAAA;AAAA,EAAQ,QAAQ,EAAE,KAAK;AAAA,CAAI,EAE5F,SAAO,2BAAU,KAAM,WAAW,CACtC,CApDsB","names":[]}
@@ -0,0 +1,11 @@
1
+ import{__name}from"../../chunk-7KD7ZCH6.mjs";import{readFile,writeFile}from"node:fs/promises";import{join}from"node:path";async function injectShims(outDir,main,antiCrash,polyfillRequire){let path=join(process.cwd(),outDir,main),head=[`
2
+
3
+ ;await (async()=>{`," 'use strict';"].join(`
4
+ `),tail=`
5
+ })();`,requireScript=polyfillRequire?["// --- CommandKit require() polyfill ---",' if (typeof require === "undefined") {',' const { createRequire } = await import("node:module");'," const __require = createRequire(import.meta.url);",' Object.defineProperty(globalThis, "require", {'," value: (id) => {"," return __require(id);"," },"," configurable: true,"," enumerable: false,"," writable: true,"," });"," }","// --- CommandKit require() polyfill ---"].join(`
6
+ `):"",antiCrashScript=antiCrash?["// --- CommandKit Anti-Crash Monitor ---"," // 'uncaughtException' event is supposed to be used to perform synchronous cleanup before shutting down the process"," // instead of using it as a means to resume operation."," // But it exists here due to compatibility reasons with discord bot ecosystem."," const p = (t) => `\\x1b[33m${t}\\x1b[0m`, b = '[CommandKit Anti-Crash Monitor]', l = console.log, e1 = 'uncaughtException', e2 = 'unhandledRejection';"," if (!process.eventNames().includes(e1)) // skip if it is already handled"," process.on(e1, (e) => {"," l(p(`${b} Uncaught Exception`)); l(p(b), p(e.stack || e));"," })"," if (!process.eventNames().includes(e2)) // skip if it is already handled"," process.on(e2, (r) => {"," l(p(`${b} Unhandled promise rejection`)); l(p(`${b} ${r.stack || r}`));"," });","// --- CommandKit Anti-Crash Monitor ---"].join(`
7
+ `):"",contents=await readFile(path,"utf-8"),finalScript=[head,requireScript,antiCrashScript,tail,`
8
+
9
+ `,contents].join(`
10
+ `);return writeFile(path,finalScript)}__name(injectShims,"injectShims");export{injectShims};
11
+ //# sourceMappingURL=shims.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/environment/bundler/shims.ts"],"sourcesContent":["import { readFile, writeFile } from 'node:fs/promises';\nimport { join } from 'node:path';\n\nexport async function injectShims(\n outDir: string,\n main: string,\n antiCrash: boolean,\n polyfillRequire: boolean,\n) {\n const path = join(process.cwd(), outDir, main);\n\n const head = ['\\n\\n;await (async()=>{', \" 'use strict';\"].join('\\n');\n const tail = '\\n})();';\n const requireScript = polyfillRequire\n ? [\n '// --- CommandKit require() polyfill ---',\n ' if (typeof require === \"undefined\") {',\n ' const { createRequire } = await import(\"node:module\");',\n ' const __require = createRequire(import.meta.url);',\n ' Object.defineProperty(globalThis, \"require\", {',\n ' value: (id) => {',\n ' return __require(id);',\n ' },',\n ' configurable: true,',\n ' enumerable: false,',\n ' writable: true,',\n ' });',\n ' }',\n '// --- CommandKit require() polyfill ---',\n ].join('\\n')\n : '';\n\n const antiCrashScript = antiCrash\n ? [\n '// --- CommandKit Anti-Crash Monitor ---',\n \" // 'uncaughtException' event is supposed to be used to perform synchronous cleanup before shutting down the process\",\n ' // instead of using it as a means to resume operation.',\n ' // But it exists here due to compatibility reasons with discord bot ecosystem.',\n \" const p = (t) => `\\\\x1b[33m${t}\\\\x1b[0m`, b = '[CommandKit Anti-Crash Monitor]', l = console.log, e1 = 'uncaughtException', e2 = 'unhandledRejection';\",\n ' if (!process.eventNames().includes(e1)) // skip if it is already handled',\n ' process.on(e1, (e) => {',\n ' l(p(`${b} Uncaught Exception`)); l(p(b), p(e.stack || e));',\n ' })',\n ' if (!process.eventNames().includes(e2)) // skip if it is already handled',\n ' process.on(e2, (r) => {',\n ' l(p(`${b} Unhandled promise rejection`)); l(p(`${b} ${r.stack || r}`));',\n ' });',\n '// --- CommandKit Anti-Crash Monitor ---',\n ].join('\\n')\n : '';\n\n const contents = await readFile(path, 'utf-8');\n const finalScript = [head, requireScript, antiCrashScript, tail, '\\n\\n', contents].join('\\n');\n\n return writeFile(path, finalScript);\n}\n"],"mappings":"6CAAA,OAAS,SAAU,cAAiB,mBACpC,OAAS,SAAY,YAErB,eAAsB,YAClB,OACA,KACA,UACA,gBACF,CACE,IAAM,KAAO,KAAK,QAAQ,IAAI,EAAG,OAAQ,IAAI,EAEvC,KAAO,CAAC;AAAA;AAAA,oBAA0B,iBAAiB,EAAE,KAAK;AAAA,CAAI,EAC9D,KAAO;AAAA,OACP,cAAgB,gBAChB,CACI,2CACA,0CACA,6DACA,wDACA,qDACA,yBACA,gCACA,WACA,4BACA,2BACA,wBACA,UACA,MACA,0CACJ,EAAE,KAAK;AAAA,CAAI,EACX,GAEA,gBAAkB,UAClB,CACI,2CACA,wHACA,2DACA,mFACA,2JACA,6EACA,8BACA,mEACA,SACA,6EACA,8BACA,gFACA,UACA,0CACJ,EAAE,KAAK;AAAA,CAAI,EACX,GAEA,SAAW,MAAM,SAAS,KAAM,OAAO,EACvC,YAAc,CAAC,KAAM,cAAe,gBAAiB,KAAM;AAAA;AAAA,EAAQ,QAAQ,EAAE,KAAK;AAAA,CAAI,EAE5F,OAAO,UAAU,KAAM,WAAW,CACtC,CApDsB","names":[]}
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,2 @@
1
+
2
+ export { }
@@ -0,0 +1,2 @@
1
+ "use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod));var import_yargs=__toESM(require("yargs/yargs")),import_helpers=require("yargs/helpers");var import_node_fs=require("fs"),import_node_path=require("path");var ConfigLookupPaths=["js","cjs","mjs"];async function findConfigPath(relative){for(let extension of ConfigLookupPaths){let path=(0,import_node_path.join)(relative,`commandkit.${extension}`);if((0,import_node_fs.existsSync)(path))return path}return null}__name(findConfigPath,"findConfigPath");async function importConfig(path){let config2=await import(`file://${path}`);return config2?.default??config2}__name(importConfig,"importConfig");var resetColor="\x1B[0m",colors_default={reset:text=>`${text}${resetColor}`,bright:text=>`\x1B[1m${text}${resetColor}`,dim:text=>`\x1B[2m${text}${resetColor}`,underscore:text=>`\x1B[4m${text}${resetColor}`,blink:text=>`\x1B[5m${text}${resetColor}`,reverse:text=>`\x1B[7m${text}${resetColor}`,hidden:text=>`\x1B[8m${text}${resetColor}`,black:text=>`\x1B[30m${text}${resetColor}`,red:text=>`\x1B[31m${text}${resetColor}`,green:text=>`\x1B[32m${text}${resetColor}`,yellow:text=>`\x1B[33m${text}${resetColor}`,blue:text=>`\x1B[34m${text}${resetColor}`,magenta:text=>`\x1B[35m${text}${resetColor}`,cyan:text=>`\x1B[36m${text}${resetColor}`,white:text=>`\x1B[37m${text}${resetColor}`,bgBlack:text=>`\x1B[40m${text}${resetColor}`,bgRed:text=>`\x1B[41m${text}${resetColor}`,bgGreen:text=>`\x1B[42m${text}${resetColor}`,bgYellow:text=>`\x1B[43m${text}${resetColor}`,bgBlue:text=>`\x1B[44m${text}${resetColor}`,bgMagenta:text=>`\x1B[45m${text}${resetColor}`,bgCyan:text=>`\x1B[46m${text}${resetColor}`,bgWhite:text=>`\x1B[47m${text}${resetColor}`};var Logger={Fatal:(...message)=>{console.log(colors_default.red("[FATAL ERROR]"),...message),process.exit(1)},Warning:(...message)=>{console.log(colors_default.yellow("[WARNING]"),...message)},Info:(...message)=>{console.log(colors_default.green("[INFO]"),...message)},Debug:(...message)=>{console.log(colors_default.blue("[DEBUG]"),...message)},Log:(...message)=>{console.log(...message)}};var import_dotenv_cra=require("dotenv-cra");function loadEnv(type){return process.env.NODE_ENV=type,(0,import_dotenv_cra.config)().error?.message}__name(loadEnv,"loadEnv");var import_discord=require("discord.js");var globalConfig={envExtra:!0,outDir:"dist",watch:!0,clearRestartLogs:!0,minify:!1,sourcemap:!1,nodeOptions:[],antiCrash:!0,requirePolyfill:!0,token:process.env.DISCORD_TOKEN};function getConfig(){return globalConfig}__name(getConfig,"getConfig");var discord_client;function getClient(){return discord_client}__name(getClient,"getClient");function createClient(){let config2=getConfig();return discord_client=new import_discord.Client(config2.clientOptions),discord_client}__name(createClient,"createClient");var import_tsup=require("tsup");var import_path=require("path");function bundle(mode){switch(mode){case"development":return buildDevelopment();default:throw new Error("Not implemented")}}__name(bundle,"bundle");function buildDevelopment(){let{watch}=getConfig(),outDir=(0,import_path.join)(process.cwd(),".commandkit");return(0,import_tsup.build)({clean:!0,format:["esm"],bundle:!1,dts:!1,skipNodeModulesBundle:!0,minify:!1,shims:!0,sourcemap:"inline",keepNames:!0,outDir:".commandkit",silent:!0,entry:["src"],watch,async onSuccess(){}}).then(()=>(0,import_path.join)(outDir,"client.mjs"))}__name(buildDevelopment,"buildDevelopment");var commandkitVersion="0.1.10-dev.20240131174628";function printBanner(){let banner=colors_default.magenta(`\u25C6 CommandKit ${commandkitVersion}`);Logger.Log(banner),Logger.Info("Initializing the development environment...")}__name(printBanner,"printBanner");async function initializeDevelopmentEnvironment(args){if(printBanner(),getClient()){Logger.Fatal("The development environment is already initialized.");return}let envErr=loadEnv("development");envErr?Logger.Warning("Failed to load .env",envErr):Logger.Debug("Loaded .env");let configPath=await findConfigPath(args.config??process.cwd());if(!configPath){let msg=`Could not locate the commandkit config file${args.config?" at "+args.config:" in the current working directory"}.`;Logger.Fatal(msg);return}try{var config2=await importConfig(configPath);Logger.Debug("Loaded config from",colors_default.yellow(configPath))}catch(e){Logger.Warning("Failed to load config"),Logger.Fatal(colors_default.red(e.stack??`${e}`));return}let client=createClient(),entrypoint=await bundle("development");try{await import(`file://${entrypoint}`),await client.login(config2.token)}catch(e){Logger.Fatal("Failed to load the client entrypoint",e)}}__name(initializeDevelopmentEnvironment,"initializeDevelopmentEnvironment");(0,import_yargs.default)((0,import_helpers.hideBin)(process.argv)).scriptName("commandkit").command("dev","Start the bot in development mode",()=>{},async args=>{await initializeDevelopmentEnvironment(args)}).command("start","Start the production build").command("build","Generate production build of the project").options({config:{alias:"c",type:"string",description:"Path to the commandkit config file"},nodeOptions:{alias:"n",type:"string",description:"Node options to pass to the process"}}).version("0.1.10-dev.20240131174628").help().demandCommand().parse();
2
+ //# sourceMappingURL=cli.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/environment/cli.ts","../../src/environment/common/config.ts","../../src/utils/colors.ts","../../src/environment/common/logger.ts","../../src/bootstrap/loadEnv.ts","../../src/bootstrap/client.ts","../../src/config.ts","../../src/environment/bundler/bundle.ts","../../src/environment/actions/development.ts"],"sourcesContent":["import yargs from 'yargs/yargs';\nimport { hideBin } from 'yargs/helpers';\nimport { initializeDevelopmentEnvironment } from './actions/development';\n\nyargs(hideBin(process.argv))\n .scriptName('commandkit')\n .command(\n 'dev',\n 'Start the bot in development mode',\n () => {},\n async (args) => {\n await initializeDevelopmentEnvironment(args);\n },\n )\n .command('start', 'Start the production build')\n .command('build', 'Generate production build of the project')\n .options({\n config: {\n alias: 'c',\n type: 'string',\n description: 'Path to the commandkit config file',\n },\n nodeOptions: {\n alias: 'n',\n type: 'string',\n description: 'Node options to pass to the process',\n },\n })\n .version('0.1.10-dev.20240131174628')\n .help()\n .demandCommand()\n .parse();\n","import { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport type { CommandKitConfig } from '../../config';\n\nconst ConfigLookupPaths = [\n // javascript\n 'js',\n 'cjs',\n 'mjs',\n];\n\nexport async function findConfigPath(relative: string) {\n for (const extension of ConfigLookupPaths) {\n const path = join(relative, `commandkit.${extension}`);\n if (existsSync(path)) return path;\n }\n\n return null;\n}\n\nexport async function importConfig(path: string): Promise<CommandKitConfig> {\n const config = await import(`file://${path}`);\n return config?.default ?? config;\n}\n","const resetColor = '\\x1b[0m';\n\nexport default {\n reset: (text: string) => `${text}${resetColor}`,\n bright: (text: string) => `\\x1b[1m${text}${resetColor}`,\n dim: (text: string) => `\\x1b[2m${text}${resetColor}`,\n underscore: (text: string) => `\\x1b[4m${text}${resetColor}`,\n blink: (text: string) => `\\x1b[5m${text}${resetColor}`,\n reverse: (text: string) => `\\x1b[7m${text}${resetColor}`,\n hidden: (text: string) => `\\x1b[8m${text}${resetColor}`,\n\n black: (text: string) => `\\x1b[30m${text}${resetColor}`,\n red: (text: string) => `\\x1b[31m${text}${resetColor}`,\n green: (text: string) => `\\x1b[32m${text}${resetColor}`,\n yellow: (text: string) => `\\x1b[33m${text}${resetColor}`,\n blue: (text: string) => `\\x1b[34m${text}${resetColor}`,\n magenta: (text: string) => `\\x1b[35m${text}${resetColor}`,\n cyan: (text: string) => `\\x1b[36m${text}${resetColor}`,\n white: (text: string) => `\\x1b[37m${text}${resetColor}`,\n\n bgBlack: (text: string) => `\\x1b[40m${text}${resetColor}`,\n bgRed: (text: string) => `\\x1b[41m${text}${resetColor}`,\n bgGreen: (text: string) => `\\x1b[42m${text}${resetColor}`,\n bgYellow: (text: string) => `\\x1b[43m${text}${resetColor}`,\n bgBlue: (text: string) => `\\x1b[44m${text}${resetColor}`,\n bgMagenta: (text: string) => `\\x1b[45m${text}${resetColor}`,\n bgCyan: (text: string) => `\\x1b[46m${text}${resetColor}`,\n bgWhite: (text: string) => `\\x1b[47m${text}${resetColor}`,\n};\n","import colors from '../../utils/colors';\n\nexport const Logger = {\n Fatal: (...message: unknown[]) => {\n console.log(colors.red('[FATAL ERROR]'), ...message);\n process.exit(1);\n },\n Warning: (...message: unknown[]) => {\n console.log(colors.yellow('[WARNING]'), ...message);\n },\n Info: (...message: unknown[]) => {\n console.log(colors.green('[INFO]'), ...message);\n },\n Debug: (...message: unknown[]) => {\n console.log(colors.blue('[DEBUG]'), ...message);\n },\n Log: (...message: unknown[]) => {\n console.log(...message);\n },\n};\n","import { config } from 'dotenv-cra';\n\nexport function loadEnv(type: 'development' | 'production') {\n process.env.NODE_ENV = type;\n\n const result = config();\n\n return result.error?.message;\n}\n","import { Client } from 'discord.js';\nimport { getConfig } from '../config';\n\nlet discord_client: Client;\n\n/**\n * @internal\n */\nexport function getClient() {\n return discord_client;\n}\n\n/**\n * Fetches the client instance. If the client instance is not initialized, an error will be thrown.\n */\nexport function client<T extends boolean = boolean>() {\n if (!discord_client) {\n throw new Error(\n 'Client was not initialized. Make sure to run \"commandkit dev\" to bootstrap the client.',\n );\n }\n\n return discord_client as Client<T>;\n}\n\nexport function createClient() {\n const config = getConfig();\n\n discord_client = new Client(config.clientOptions);\n\n return discord_client;\n}\n","import type { ClientOptions } from 'discord.js';\n\nexport interface CommandKitConfig {\n /**\n * The Discord client options.\n */\n clientOptions: ClientOptions;\n /**\n * The Discord bot token. Defaults to `process.env.DISCORD_TOKEN`.\n */\n token?: string;\n /**\n * Whether or not to use the watch mode. Defaults to `true`.\n */\n watch: boolean;\n /**\n * The output directory of the project. Defaults to `dist`.\n */\n outDir: string;\n /**\n * Whether or not to include extra env utilities. Defaults to `true`.\n */\n envExtra: boolean;\n /**\n * Node.js cli options.\n */\n nodeOptions: string[];\n /**\n * Whether or not to clear default restart logs. Defaults to `true`.\n */\n clearRestartLogs: boolean;\n /**\n * Whether or not to minify the output. Defaults to `false`.\n */\n minify: boolean;\n /**\n * Whether or not to include sourcemaps in production build. Defaults to `false`.\n */\n sourcemap: boolean | 'inline';\n /**\n * Whether or not to include anti-crash handler in production. Defaults to `true`.\n */\n antiCrash: boolean;\n /**\n * Whether or not to polyfill `require` function. Defaults to `true`.\n */\n requirePolyfill: boolean;\n}\n\nlet globalConfig: Partial<CommandKitConfig> = {\n envExtra: true,\n outDir: 'dist',\n watch: true,\n clearRestartLogs: true,\n minify: false,\n sourcemap: false,\n nodeOptions: [],\n antiCrash: true,\n requirePolyfill: true,\n token: process.env.DISCORD_TOKEN,\n};\n\nexport function getConfig(): CommandKitConfig {\n return globalConfig as CommandKitConfig;\n}\n\nconst requiredProps = ['clientOptions'] as const;\n\ntype R = (typeof requiredProps)[number];\n\ntype PartialConfig<T extends CommandKitConfig> = Partial<Omit<T, R>> & Pick<T, R>;\n\nexport function defineConfig(config: PartialConfig<CommandKitConfig>) {\n for (const prop of requiredProps) {\n if (!config[prop]) {\n throw new Error(`[CommandKit Config] Missing required config property: ${prop}`);\n }\n }\n\n globalConfig = {\n ...globalConfig,\n ...config,\n };\n\n return globalConfig;\n}\n","import { build } from 'tsup';\nimport { getConfig } from '../../config';\nimport { join } from 'path';\n\nexport function bundle(mode: 'development' | 'production') {\n switch (mode) {\n case 'development':\n return buildDevelopment();\n default:\n throw new Error('Not implemented');\n }\n}\n\nfunction buildDevelopment() {\n const { watch } = getConfig();\n\n const outDir = join(process.cwd(), '.commandkit');\n\n return build({\n clean: true,\n format: ['esm'],\n bundle: false,\n dts: false,\n skipNodeModulesBundle: true,\n minify: false,\n shims: true,\n sourcemap: 'inline',\n keepNames: true,\n outDir: '.commandkit',\n silent: true,\n entry: ['src'],\n watch,\n async onSuccess() {\n // return await injectShims('.commandkit', main, false, requirePolyfill);\n },\n }).then(() => {\n return join(outDir, 'client.mjs');\n });\n}\n","import type yargs from 'yargs';\nimport { findConfigPath, importConfig } from '../common/config';\nimport colors from '../../utils/colors';\nimport { Logger } from '../common/logger';\nimport { loadEnv } from '../../bootstrap/loadEnv';\nimport { createClient, getClient } from '../../bootstrap/client';\nimport { bundle } from '../bundler/bundle';\n\nconst commandkitVersion = '0.1.10-dev.20240131174628';\n\nfunction printBanner() {\n const banner = colors.magenta(`${String.fromCharCode(9670)} CommandKit ${commandkitVersion}`);\n Logger.Log(banner);\n Logger.Info('Initializing the development environment...');\n}\n\nexport async function initializeDevelopmentEnvironment(\n args: yargs.ArgumentsCamelCase<{\n config?: string | undefined;\n nodeOptions?: string | undefined;\n }>,\n) {\n printBanner();\n\n if (getClient()) {\n Logger.Fatal('The development environment is already initialized.');\n return;\n }\n\n const envErr = loadEnv('development');\n\n if (envErr) {\n Logger.Warning('Failed to load .env', envErr);\n } else {\n Logger.Debug('Loaded .env');\n }\n\n const configPath = await findConfigPath(args.config ?? process.cwd());\n if (!configPath) {\n const msg = `Could not locate the commandkit config file${\n args.config ? ' at ' + args.config : ' in the current working directory'\n }.`;\n Logger.Fatal(msg);\n return;\n }\n\n try {\n var config = await importConfig(configPath);\n Logger.Debug('Loaded config from', colors.yellow(configPath));\n } catch (e) {\n Logger.Warning('Failed to load config');\n Logger.Fatal(colors.red((e as Error).stack ?? `${e}`));\n return;\n }\n\n const client = createClient();\n\n // build the project\n const entrypoint = await bundle('development');\n\n try {\n // load the client entrypoint\n await import(`file://${entrypoint}`);\n await client.login(config.token);\n } catch (e) {\n Logger.Fatal('Failed to load the client entrypoint', e);\n }\n}\n"],"mappings":"0zBAAA,iBAAkB,gCAClB,eAAwB,yBCDxB,mBAA2B,cAC3B,iBAAqB,gBAGrB,IAAM,kBAAoB,CAEtB,KACA,MACA,KACJ,EAEA,eAAsB,eAAe,SAAkB,CACnD,QAAW,aAAa,kBAAmB,CACvC,IAAM,QAAO,uBAAK,SAAU,cAAc,SAAS,EAAE,EACrD,MAAI,2BAAW,IAAI,EAAG,OAAO,IACjC,CAEA,OAAO,IACX,CAPsB,wCAStB,eAAsB,aAAa,KAAyC,CACxE,IAAMA,QAAS,MAAM,OAAO,UAAU,IAAI,IAC1C,OAAOA,SAAQ,SAAWA,OAC9B,CAHsB,oCCpBtB,IAAM,WAAa,UAEZ,eAAQ,CACX,MAAQ,MAAiB,GAAG,IAAI,GAAG,UAAU,GAC7C,OAAS,MAAiB,UAAU,IAAI,GAAG,UAAU,GACrD,IAAM,MAAiB,UAAU,IAAI,GAAG,UAAU,GAClD,WAAa,MAAiB,UAAU,IAAI,GAAG,UAAU,GACzD,MAAQ,MAAiB,UAAU,IAAI,GAAG,UAAU,GACpD,QAAU,MAAiB,UAAU,I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opmentEnvironment}from"../chunk-67SR2RRV.mjs";import"../chunk-QVM3SASI.mjs";import"../chunk-P22KPISA.mjs";import"../chunk-XFI3OAJH.mjs";import"../chunk-DJGEQTVH.mjs";import"../chunk-6I5SY5IL.mjs";import"../chunk-BWCE2PU3.mjs";import"../chunk-WTRDOPQV.mjs";import"../chunk-7KD7ZCH6.mjs";import yargs from"yargs/yargs";import{hideBin}from"yargs/helpers";yargs(hideBin(process.argv)).scriptName("commandkit").command("dev","Start the bot in development mode",()=>{},async args=>{await initializeDevelopmentEnvironment(args)}).command("start","Start the production build").command("build","Generate production build of the project").options({config:{alias:"c",type:"string",description:"Path to the commandkit config file"},nodeOptions:{alias:"n",type:"string",description:"Node options to pass to the process"}}).version("0.1.10-dev.20240131174628").help().demandCommand().parse();
2
+ //# sourceMappingURL=cli.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../src/environment/cli.ts"],"sourcesContent":["import yargs from 'yargs/yargs';\nimport { hideBin } from 'yargs/helpers';\nimport { initializeDevelopmentEnvironment } from './actions/development';\n\nyargs(hideBin(process.argv))\n .scriptName('commandkit')\n .command(\n 'dev',\n 'Start the bot in development mode',\n () => {},\n async (args) => {\n await initializeDevelopmentEnvironment(args);\n },\n )\n .command('start', 'Start the production build')\n .command('build', 'Generate production build of the project')\n .options({\n config: {\n alias: 'c',\n type: 'string',\n description: 'Path to the commandkit config file',\n },\n nodeOptions: {\n alias: 'n',\n type: 'string',\n description: 'Node options to pass to the process',\n },\n })\n .version('0.1.10-dev.20240131174628')\n .help()\n .demandCommand()\n .parse();\n"],"mappings":"oTAAA,OAAO,UAAW,cAClB,OAAS,YAAe,gBAGxB,MAAM,QAAQ,QAAQ,IAAI,CAAC,EACtB,WAAW,YAAY,EACvB,QACG,MACA,oCACA,IAAM,CAAC,EACP,MAAO,MAAS,CACZ,MAAM,iCAAiC,IAAI,CAC/C,CACJ,EACC,QAAQ,QAAS,4BAA4B,EAC7C,QAAQ,QAAS,0CAA0C,EAC3D,QAAQ,CACL,OAAQ,CACJ,MAAO,IACP,KAAM,SACN,YAAa,oCACjB,EACA,YAAa,CACT,MAAO,IACP,KAAM,SACN,YAAa,qCACjB,CACJ,CAAC,EACA,QAAQ,2BAA2B,EACnC,KAAK,EACL,cAAc,EACd,MAAM","names":[]}
@@ -0,0 +1,7 @@
1
+ import { CommandKitConfig } from '../../config.mjs';
2
+ import 'discord.js';
3
+
4
+ declare function findConfigPath(relative: string): Promise<string | null>;
5
+ declare function importConfig(path: string): Promise<CommandKitConfig>;
6
+
7
+ export { findConfigPath, importConfig };
@@ -0,0 +1,7 @@
1
+ import { CommandKitConfig } from '../../config.js';
2
+ import 'discord.js';
3
+
4
+ declare function findConfigPath(relative: string): Promise<string | null>;
5
+ declare function importConfig(path: string): Promise<CommandKitConfig>;
6
+
7
+ export { findConfigPath, importConfig };
@@ -0,0 +1,2 @@
1
+ "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var config_exports={};__export(config_exports,{findConfigPath:()=>findConfigPath,importConfig:()=>importConfig});module.exports=__toCommonJS(config_exports);var import_node_fs=require("fs"),import_node_path=require("path");var ConfigLookupPaths=["js","cjs","mjs"];async function findConfigPath(relative){for(let extension of ConfigLookupPaths){let path=(0,import_node_path.join)(relative,`commandkit.${extension}`);if((0,import_node_fs.existsSync)(path))return path}return null}__name(findConfigPath,"findConfigPath");async function importConfig(path){let config=await import(`file://${path}`);return config?.default??config}__name(importConfig,"importConfig");0&&(module.exports={findConfigPath,importConfig});
2
+ //# sourceMappingURL=config.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/environment/common/config.ts"],"sourcesContent":["import { existsSync } from 'node:fs';\nimport { join } from 'node:path';\nimport type { CommandKitConfig } from '../../config';\n\nconst ConfigLookupPaths = [\n // javascript\n 'js',\n 'cjs',\n 'mjs',\n];\n\nexport async function findConfigPath(relative: string) {\n for (const extension of ConfigLookupPaths) {\n const path = join(relative, `commandkit.${extension}`);\n if (existsSync(path)) return path;\n }\n\n return null;\n}\n\nexport async function importConfig(path: string): Promise<CommandKitConfig> {\n const config = await import(`file://${path}`);\n return config?.default ?? config;\n}\n"],"mappings":"ouBAAA,6JAAA,mBAA2B,cAC3B,iBAAqB,gBAGrB,IAAM,kBAAoB,CAEtB,KACA,MACA,KACJ,EAEA,eAAsB,eAAe,SAAkB,CACnD,QAAW,aAAa,kBAAmB,CACvC,IAAM,QAAO,uBAAK,SAAU,cAAc,SAAS,EAAE,EACrD,MAAI,2BAAW,IAAI,EAAG,OAAO,IACjC,CAEA,OAAO,IACX,CAPsB,wCAStB,eAAsB,aAAa,KAAyC,CACxE,IAAM,OAAS,MAAM,OAAO,UAAU,IAAI,IAC1C,OAAO,QAAQ,SAAW,MAC9B,CAHsB","names":[]}
@@ -0,0 +1,2 @@
1
+ import{findConfigPath,importConfig}from"../../chunk-P22KPISA.mjs";import"../../chunk-7KD7ZCH6.mjs";export{findConfigPath,importConfig};
2
+ //# sourceMappingURL=config.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,9 @@
1
+ declare const Logger: {
2
+ Fatal: (...message: unknown[]) => never;
3
+ Warning: (...message: unknown[]) => void;
4
+ Info: (...message: unknown[]) => void;
5
+ Debug: (...message: unknown[]) => void;
6
+ Log: (...message: unknown[]) => void;
7
+ };
8
+
9
+ export { Logger };
@@ -0,0 +1,9 @@
1
+ declare const Logger: {
2
+ Fatal: (...message: unknown[]) => never;
3
+ Warning: (...message: unknown[]) => void;
4
+ Info: (...message: unknown[]) => void;
5
+ Debug: (...message: unknown[]) => void;
6
+ Log: (...message: unknown[]) => void;
7
+ };
8
+
9
+ export { Logger };
@@ -0,0 +1,2 @@
1
+ "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var logger_exports={};__export(logger_exports,{Logger:()=>Logger});module.exports=__toCommonJS(logger_exports);var resetColor="\x1B[0m",colors_default={reset:text=>`${text}${resetColor}`,bright:text=>`\x1B[1m${text}${resetColor}`,dim:text=>`\x1B[2m${text}${resetColor}`,underscore:text=>`\x1B[4m${text}${resetColor}`,blink:text=>`\x1B[5m${text}${resetColor}`,reverse:text=>`\x1B[7m${text}${resetColor}`,hidden:text=>`\x1B[8m${text}${resetColor}`,black:text=>`\x1B[30m${text}${resetColor}`,red:text=>`\x1B[31m${text}${resetColor}`,green:text=>`\x1B[32m${text}${resetColor}`,yellow:text=>`\x1B[33m${text}${resetColor}`,blue:text=>`\x1B[34m${text}${resetColor}`,magenta:text=>`\x1B[35m${text}${resetColor}`,cyan:text=>`\x1B[36m${text}${resetColor}`,white:text=>`\x1B[37m${text}${resetColor}`,bgBlack:text=>`\x1B[40m${text}${resetColor}`,bgRed:text=>`\x1B[41m${text}${resetColor}`,bgGreen:text=>`\x1B[42m${text}${resetColor}`,bgYellow:text=>`\x1B[43m${text}${resetColor}`,bgBlue:text=>`\x1B[44m${text}${resetColor}`,bgMagenta:text=>`\x1B[45m${text}${resetColor}`,bgCyan:text=>`\x1B[46m${text}${resetColor}`,bgWhite:text=>`\x1B[47m${text}${resetColor}`};var Logger={Fatal:(...message)=>{console.log(colors_default.red("[FATAL ERROR]"),...message),process.exit(1)},Warning:(...message)=>{console.log(colors_default.yellow("[WARNING]"),...message)},Info:(...message)=>{console.log(colors_default.green("[INFO]"),...message)},Debug:(...message)=>{console.log(colors_default.blue("[DEBUG]"),...message)},Log:(...message)=>{console.log(...message)}};0&&(module.exports={Logger});
2
+ //# sourceMappingURL=logger.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/environment/common/logger.ts","../../../src/utils/colors.ts"],"sourcesContent":["import colors from '../../utils/colors';\n\nexport const Logger = {\n Fatal: (...message: unknown[]) => {\n console.log(colors.red('[FATAL ERROR]'), ...message);\n process.exit(1);\n },\n Warning: (...message: unknown[]) => {\n console.log(colors.yellow('[WARNING]'), ...message);\n },\n Info: (...message: unknown[]) => {\n console.log(colors.green('[INFO]'), ...message);\n },\n Debug: (...message: unknown[]) => {\n console.log(colors.blue('[DEBUG]'), ...message);\n },\n Log: (...message: unknown[]) => {\n console.log(...message);\n },\n};\n","const resetColor = '\\x1b[0m';\n\nexport default {\n reset: (text: string) => `${text}${resetColor}`,\n bright: (text: string) => `\\x1b[1m${text}${resetColor}`,\n dim: (text: string) => `\\x1b[2m${text}${resetColor}`,\n underscore: (text: string) => `\\x1b[4m${text}${resetColor}`,\n blink: (text: string) => `\\x1b[5m${text}${resetColor}`,\n reverse: (text: string) => `\\x1b[7m${text}${resetColor}`,\n hidden: (text: string) => `\\x1b[8m${text}${resetColor}`,\n\n black: (text: string) => `\\x1b[30m${text}${resetColor}`,\n red: (text: string) => `\\x1b[31m${text}${resetColor}`,\n green: (text: string) => `\\x1b[32m${text}${resetColor}`,\n yellow: (text: string) => `\\x1b[33m${text}${resetColor}`,\n blue: (text: string) => `\\x1b[34m${text}${resetColor}`,\n magenta: (text: string) => `\\x1b[35m${text}${resetColor}`,\n cyan: (text: string) => `\\x1b[36m${text}${resetColor}`,\n white: (text: string) => `\\x1b[37m${text}${resetColor}`,\n\n bgBlack: (text: string) => `\\x1b[40m${text}${resetColor}`,\n bgRed: (text: string) => `\\x1b[41m${text}${resetColor}`,\n bgGreen: (text: string) => `\\x1b[42m${text}${resetColor}`,\n bgYellow: (text: string) => `\\x1b[43m${text}${resetColor}`,\n bgBlue: (text: string) => `\\x1b[44m${text}${resetColor}`,\n bgMagenta: (text: string) => `\\x1b[45m${text}${resetColor}`,\n bgCyan: (text: string) => `\\x1b[46m${text}${resetColor}`,\n bgWhite: (text: string) => `\\x1b[47m${text}${resetColor}`,\n};\n"],"mappings":"wpBAAA,+GCAA,IAAM,WAAa,UAEZ,eAAQ,CACX,MAAQ,MAAiB,GAAG,IAAI,GAAG,UAAU,GAC7C,OAAS,MAAiB,UAAU,IAAI,GAAG,UAAU,GACrD,IAAM,MAAiB,UAAU,IAAI,GAAG,UAAU,GAClD,WAAa,MAAiB,UAAU,IAAI,GAAG,UAAU,GACzD,MAAQ,MAAiB,UAAU,IAAI,GAAG,UAAU,GACpD,QAAU,MAAiB,UAAU,IAAI,GAAG,UAAU,GACtD,OAAS,MAAiB,UAAU,IAAI,GAAG,UAAU,GAErD,MAAQ,MAAiB,WAAW,IAAI,GAAG,UAAU,GACrD,IAAM,MAAiB,WAAW,IAAI,GAAG,UAAU,GACnD,MAAQ,MAAiB,WAAW,IAAI,GAAG,UAAU,GACrD,OAAS,MAAiB,WAAW,IAAI,GAAG,UAAU,GACtD,KAAO,MAAiB,WAAW,IAAI,GAAG,UAAU,GACpD,QAAU,MAAiB,WAAW,IAAI,GAAG,UAAU,GACvD,KAAO,MAAiB,WAAW,IAAI,GAAG,UAAU,GACpD,MAAQ,MAAiB,WAAW,IAAI,GAAG,UAAU,GAErD,QAAU,MAAiB,WAAW,IAAI,GAAG,UAAU,GACvD,MAAQ,MAAiB,WAAW,IAAI,GAAG,UAAU,GACrD,QAAU,MAAiB,WAAW,IAAI,GAAG,UAAU,GACvD,SAAW,MAAiB,WAAW,IAAI,GAAG,UAAU,GACxD,OAAS,MAAiB,WAAW,IAAI,GAAG,UAAU,GACtD,UAAY,MAAiB,WAAW,IAAI,GAAG,UAAU,GACzD,OAAS,MAAiB,WAAW,IAAI,GAAG,UAAU,GACtD,QAAU,MAAiB,WAAW,IAAI,GAAG,UAAU,EAC3D,ED1BO,IAAM,OAAS,CAClB,MAAO,IAAI,UAAuB,CAC9B,QAAQ,IAAI,eAAO,IAAI,eAAe,EAAG,GAAG,OAAO,EACnD,QAAQ,KAAK,CAAC,CAClB,EACA,QAAS,IAAI,UAAuB,CAChC,QAAQ,IAAI,eAAO,OAAO,WAAW,EAAG,GAAG,OAAO,CACtD,EACA,KAAM,IAAI,UAAuB,CAC7B,QAAQ,IAAI,eAAO,MAAM,QAAQ,EAAG,GAAG,OAAO,CAClD,EACA,MAAO,IAAI,UAAuB,CAC9B,QAAQ,IAAI,eAAO,KAAK,SAAS,EAAG,GAAG,OAAO,CAClD,EACA,IAAK,IAAI,UAAuB,CAC5B,QAAQ,IAAI,GAAG,OAAO,CAC1B,CACJ","names":[]}
@@ -0,0 +1,2 @@
1
+ import{Logger}from"../../chunk-XFI3OAJH.mjs";import"../../chunk-DJGEQTVH.mjs";import"../../chunk-7KD7ZCH6.mjs";export{Logger};
2
+ //# sourceMappingURL=logger.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,5 @@
1
+ export { f as CommandHandler, h as hCommandContext } from '../../CommandKit--SA9LcIq.mjs';
2
+ import 'async_hooks';
3
+ import '../validation-handler/ValidationHandler.mjs';
4
+ import '../validation-handler/typings.mjs';
5
+ import 'discord.js';
@@ -0,0 +1,5 @@
1
+ export { f as CommandHandler, h as hCommandContext } from '../../CommandKit-GIHMEeqf.js';
2
+ import 'async_hooks';
3
+ import '../validation-handler/ValidationHandler.js';
4
+ import '../validation-handler/typings.js';
5
+ import 'discord.js';
@@ -0,0 +1,11 @@
1
+ "use strict";var __create=Object.create;var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __getProtoOf=Object.getPrototypeOf,__hasOwnProp=Object.prototype.hasOwnProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toESM=(mod,isNodeMode,target)=>(target=mod!=null?__create(__getProtoOf(mod)):{},__copyProps(isNodeMode||!mod||!mod.__esModule?__defProp(target,"default",{value:mod,enumerable:!0}):target,mod)),__toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var CommandHandler_exports={};__export(CommandHandler_exports,{CommandHandler:()=>CommandHandler});module.exports=__toCommonJS(CommandHandler_exports);var import_path=__toESM(require("path"));function toFileURL(filePath){return"file://"+import_path.default.resolve(filePath).replace(/\\\\|\\/g,"/")}__name(toFileURL,"toFileURL");var import_path2=__toESM(require("path")),import_promises=__toESM(require("fs/promises"));async function getFilePaths(directory,nesting){let filePaths=[];if(!directory)return filePaths;let files=await import_promises.default.readdir(directory,{withFileTypes:!0});for(let file of files){let filePath=import_path2.default.join(directory,file.name);file.isFile()&&filePaths.push(filePath),nesting&&file.isDirectory()&&(filePaths=[...filePaths,...await getFilePaths(filePath,!0)])}return filePaths}__name(getFilePaths,"getFilePaths");var import_rfdc=__toESM(require("rfdc")),clone=(0,import_rfdc.default)();var resetColor="\x1B[0m",colors_default={reset:text=>`${text}${resetColor}`,bright:text=>`\x1B[1m${text}${resetColor}`,dim:text=>`\x1B[2m${text}${resetColor}`,underscore:text=>`\x1B[4m${text}${resetColor}`,blink:text=>`\x1B[5m${text}${resetColor}`,reverse:text=>`\x1B[7m${text}${resetColor}`,hidden:text=>`\x1B[8m${text}${resetColor}`,black:text=>`\x1B[30m${text}${resetColor}`,red:text=>`\x1B[31m${text}${resetColor}`,green:text=>`\x1B[32m${text}${resetColor}`,yellow:text=>`\x1B[33m${text}${resetColor}`,blue:text=>`\x1B[34m${text}${resetColor}`,magenta:text=>`\x1B[35m${text}${resetColor}`,cyan:text=>`\x1B[36m${text}${resetColor}`,white:text=>`\x1B[37m${text}${resetColor}`,bgBlack:text=>`\x1B[40m${text}${resetColor}`,bgRed:text=>`\x1B[41m${text}${resetColor}`,bgGreen:text=>`\x1B[42m${text}${resetColor}`,bgYellow:text=>`\x1B[43m${text}${resetColor}`,bgBlue:text=>`\x1B[44m${text}${resetColor}`,bgMagenta:text=>`\x1B[45m${text}${resetColor}`,bgCyan:text=>`\x1B[46m${text}${resetColor}`,bgWhite:text=>`\x1B[47m${text}${resetColor}`};async function loadCommandsWithRest(props){if(props.reloading)if(props.client.isReady())await handleLoading(props.client,props.commands,props.devGuildIds,props.reloading,props.type);else throw new Error(colors_default.red("Cannot reload commands when client is not ready."));else props.client.once("ready",async c=>{await handleLoading(c,props.commands,props.devGuildIds,props.reloading,props.type)})}__name(loadCommandsWithRest,"loadCommandsWithRest");async function handleLoading(client,commands,devGuildIds,reloading,type){commands=commands.filter(cmd=>!cmd.options?.deleted);let devOnlyCommands=commands.filter(cmd=>cmd.options?.devOnly),globalCommands=commands.filter(cmd=>!cmd.options?.devOnly);type==="dev"?await loadDevCommands(client,devOnlyCommands,devGuildIds,reloading):type==="global"?await loadGlobalCommands(client,globalCommands,reloading):(await loadDevCommands(client,devOnlyCommands,devGuildIds,reloading),await loadGlobalCommands(client,globalCommands,reloading))}__name(handleLoading,"handleLoading");async function loadGlobalCommands(client,commands,reloading){let requestBody=commands.map(cmd=>cmd.data);await client.application.commands.set(requestBody).catch(error=>{throw new Error(colors_default.red(`Error ${reloading?"reloading":"loading"} global application commands.
2
+ `),error)}),console.log(colors_default.green(`${reloading?"Reloaded":"Loaded"} ${requestBody.length} global commands.`))}__name(loadGlobalCommands,"loadGlobalCommands");async function loadDevCommands(client,commands,guildIds,reloading){let requestBody=commands.map(cmd=>cmd.data);for(let guildId of guildIds){let targetGuild=client.guilds.cache.get(guildId)||await client.guilds.fetch(guildId);if(!targetGuild){process.emitWarning(`Cannot ${reloading?"reload":"load"} commands in guild "${guildId}" - guild doesn't exist or client isn't part of the guild.`);continue}await targetGuild.commands.set(requestBody).catch(error=>{throw new Error(colors_default.red(`Error ${reloading?"reloading":"loading"} developer application commands in guild "${targetGuild?.name||guildId}".
3
+ `),error)}),console.log(colors_default.green(`${reloading?"Reloaded":"Loaded"} ${requestBody.length} developer commands in guild "${targetGuild.name}".`))}}__name(loadDevCommands,"loadDevCommands");function areSlashCommandsDifferent(appCommand,localCommand){if(appCommand.options||(appCommand.options=[]),localCommand.options||(localCommand.options=[]),appCommand.description||(appCommand.description=""),localCommand.description||(localCommand.description=""),localCommand.description!==appCommand.description||localCommand.options.length!==appCommand.options.length)return!0}__name(areSlashCommandsDifferent,"areSlashCommandsDifferent");async function registerCommands(props){if(props.reloading)if(props.client.isReady())await handleRegistration(props.client,props.commands,props.devGuildIds,props.type);else throw new Error(colors_default.red("Cannot reload commands when client is not ready."));else props.client.once("ready",async c=>{await handleRegistration(c,props.commands,props.devGuildIds,props.type)})}__name(registerCommands,"registerCommands");async function handleRegistration(client,commands,devGuildIds,type){let devOnlyCommands=commands.filter(cmd=>cmd.options?.devOnly),globalCommands=commands.filter(cmd=>!cmd.options?.devOnly);type==="dev"?await registerDevCommands(client,devOnlyCommands,devGuildIds):type==="global"?await registerGlobalCommands(client,globalCommands):(await registerDevCommands(client,devOnlyCommands,devGuildIds),await registerGlobalCommands(client,globalCommands))}__name(handleRegistration,"handleRegistration");async function registerGlobalCommands(client,commands){let appCommandsManager=client.application.commands;await appCommandsManager.fetch();for(let command of commands){let targetCommand=appCommandsManager.cache.find(cmd=>cmd.name===command.data.name);if(command.options?.deleted){targetCommand?(await targetCommand.delete().catch(error=>{throw new Error(colors_default.red(`Failed to delete command "${command.data.name}" globally.
4
+ `),error)}),console.log(colors_default.green(`Deleted command "${command.data.name}" globally.`))):process.emitWarning(colors_default.yellow(`Ignoring: Command "${command.data.name}" is globally marked as deleted.`));continue}if(targetCommand&&areSlashCommandsDifferent(targetCommand,command.data)){await targetCommand.edit(command.data).catch(error=>{throw new Error(colors_default.red(`Failed to edit command "${command.data.name}" globally.
5
+ `),error)}),console.log(colors_default.green(`Edited command "${command.data.name}" globally.`));continue}targetCommand||(await appCommandsManager.create(command.data).catch(error=>{throw new Error(colors_default.red(`Failed to register command "${command.data.name}" globally.
6
+ `),error)}),console.log(colors_default.green(`Registered command "${command.data.name}" globally.`)))}}__name(registerGlobalCommands,"registerGlobalCommands");async function registerDevCommands(client,commands,guildIds){let devGuilds=[];for(let guildId of guildIds){let guild=client.guilds.cache.get(guildId)||await client.guilds.fetch(guildId);if(!guild){process.emitWarning(colors_default.yellow(`Ignoring: Guild ${guildId} doesn't exist or client isn't part of the guild.`));continue}devGuilds.push(guild)}let guildCommandsManagers=[];for(let guild of devGuilds){let guildCommandsManager=guild.commands;await guildCommandsManager.fetch(),guildCommandsManagers.push(guildCommandsManager)}for(let command of commands)for(let guildCommands of guildCommandsManagers){let targetCommand=guildCommands.cache.find(cmd=>cmd.name===command.data.name);if(command.options?.deleted){targetCommand?(await targetCommand.delete().catch(error=>{throw new Error(colors_default.red(`Failed to delete command "${command.data.name}" in ${guildCommands.guild.name}.`),error)}),console.log(colors_default.green(`Deleted command "${command.data.name}" in ${guildCommands.guild.name}.`))):process.emitWarning(colors_default.yellow(`Ignoring: Command "${command.data.name}" is marked as deleted in ${guildCommands.guild.name}.`));continue}if(targetCommand&&areSlashCommandsDifferent(targetCommand,command.data)){await targetCommand.edit(command.data).catch(error=>{throw new Error(colors_default.red(`Failed to edit command "${command.data.name}" in ${guildCommands.guild.name}.
7
+ `),error)}),console.log(colors_default.green(`Edited command "${command.data.name}" in ${guildCommands.guild.name}.`));continue}targetCommand||(await guildCommands.create(command.data).catch(error=>{throw new Error(colors_default.red(`Failed to register command "${command.data.name}" in ${guildCommands.guild.name}.
8
+ `),error)}),console.log(colors_default.green(`Registered command "${command.data.name}" in ${guildCommands.guild.name}.`)))}}__name(registerDevCommands,"registerDevCommands");function devOnly_default({interaction,targetCommand,handlerData}){if(!interaction.isAutocomplete()&&targetCommand.options?.devOnly){if(interaction.inGuild()&&!handlerData.devGuildIds.includes(interaction.guildId))return interaction.reply({content:"\u274C This command can only be used inside development servers.",ephemeral:!0}),!0;let memberRoles=interaction.guild?.members.cache.get(interaction.user.id)?.roles.cache,hasDevRole=!1;if(memberRoles?.forEach(role=>{handlerData.devRoleIds.includes(role.id)&&(hasDevRole=!0)}),!(handlerData.devUserIds.includes(interaction.user.id)||hasDevRole))return interaction.reply({content:"\u274C This command can only be used by developers.",ephemeral:!0}),!0}}__name(devOnly_default,"default");var import_discord=require("discord.js");function permissions_default({interaction,targetCommand}){if(interaction.isAutocomplete())return;let userPermissions=interaction.memberPermissions,userPermissionsRequired=targetCommand.options?.userPermissions,missingUserPermissions=[];typeof userPermissionsRequired=="string"&&(userPermissionsRequired=[userPermissionsRequired]);let botPermissions=interaction.guild?.members.me?.permissions,botPermissionsRequired=targetCommand.options?.botPermissions,missingBotPermissions=[];if(typeof botPermissionsRequired=="string"&&(botPermissionsRequired=[botPermissionsRequired]),!userPermissionsRequired?.length&&!botPermissionsRequired?.length)return;if(userPermissions&&userPermissionsRequired)for(let permission of userPermissionsRequired)userPermissions.has(permission)||missingUserPermissions.push(permission);if(botPermissions&&botPermissionsRequired)for(let permission of botPermissionsRequired)botPermissions.has(permission)||missingBotPermissions.push(permission);if(!missingUserPermissions.length&&!missingBotPermissions.length)return;let pattern=/([a-z])([A-Z])|([A-Z]+)([A-Z][a-z])/g;missingUserPermissions=missingUserPermissions.map(str=>str.replace(pattern,"$1$3 $2$4")),missingBotPermissions=missingBotPermissions.map(str=>str.replace(pattern,"$1$3 $2$4"));let embedDescription="",formatter=new Intl.ListFormat("en",{style:"long",type:"conjunction"}),getPermissionWord=__name(permissions=>permissions.length===1?"permission":"permissions","getPermissionWord");if(missingUserPermissions.length){let formattedPermissions=missingUserPermissions.map(p=>`\`${p}\``),permissionsString=formatter.format(formattedPermissions);embedDescription+=`- You must have the ${permissionsString} ${getPermissionWord(missingUserPermissions)} to be able to run this command.
9
+ `}if(missingBotPermissions.length){let formattedPermissions=missingBotPermissions.map(p=>`\`${p}\``),permissionsString=formatter.format(formattedPermissions);embedDescription+=`- I must have the ${permissionsString} ${getPermissionWord(missingBotPermissions)} to be able to execute this command.
10
+ `}let embed=new import_discord.EmbedBuilder().setTitle(":x: Missing permissions!").setDescription(embedDescription).setColor("Red");return interaction.reply({embeds:[embed],ephemeral:!0}),!0}__name(permissions_default,"default");var validations_default=[devOnly_default,permissions_default];var import_async_hooks=require("async_hooks");var CommandHandler=class{static{__name(this,"CommandHandler")}#data;context=null;constructor({...options}){this.#data={...options,builtInValidations:[],commands:[]}}async init(){this.#data.enableHooks&&!this.context&&(this.context=new import_async_hooks.AsyncLocalStorage),await this.#buildCommands(),this.#buildBuiltInValidations();let devOnlyCommands=this.#data.commands.filter(cmd=>cmd.options?.devOnly);devOnlyCommands.length&&!this.#data.devGuildIds.length&&process.emitWarning(colors_default.yellow('You have commands marked as "devOnly", but "devGuildIds" have not been set.')),devOnlyCommands.length&&!this.#data.devUserIds.length&&!this.#data.devRoleIds.length&&process.emitWarning(colors_default.yellow('You have commands marked as "devOnly", but "devUserIds" or "devRoleIds" have not been set.')),this.#data.bulkRegister?await loadCommandsWithRest({client:this.#data.client,devGuildIds:this.#data.devGuildIds,commands:this.#data.commands}):await registerCommands({client:this.#data.client,devGuildIds:this.#data.devGuildIds,commands:this.#data.commands}),this.handleCommands()}async#buildCommands(){let allowedExtensions=/\.(js|mjs|cjs|ts)$/i,commandFilePaths=(await getFilePaths(this.#data.commandsPath,!0)).filter(path3=>allowedExtensions.test(path3));for(let commandFilePath of commandFilePaths){let importedObj=await import(`${toFileURL(commandFilePath)}?t=${Date.now()}`),commandObj=clone(importedObj);typeof module<"u"&&typeof require<"u"&&delete require.cache[require.resolve(commandFilePath)];let compactFilePath=commandFilePath.split(process.cwd())[1]||commandFilePath;if(commandObj.default&&(commandObj=commandObj.default),importedObj.default?commandObj.data=importedObj.default.data:commandObj.data=importedObj.data,!commandObj.data){process.emitWarning(colors_default.yellow(`Ignoring: Command file ${compactFilePath} does not export "data".`));continue}if(!commandObj.data.name){process.emitWarning(colors_default.yellow(`Ignoring: Command file ${compactFilePath} does not export "data.name".`));continue}if(!commandObj.run){process.emitWarning(colors_default.yellow(`Ignoring: Command file ${commandObj.data.name} does not export "run".`));continue}if(typeof commandObj.run!="function"){process.emitWarning(colors_default.yellow(`Ignoring: Command file ${commandObj.data.name} does not export "run" as a function.`));continue}commandObj.filePath=commandFilePath;let commandCategory=commandFilePath.split(this.#data.commandsPath)[1]?.replace(/\\\\|\\/g,"/").split("/")[1]||null;commandCategory&&allowedExtensions.test(commandCategory)?commandObj.category=null:commandObj.category=commandCategory,this.#data.commands.push(commandObj)}}#buildBuiltInValidations(){for(let builtInValidationFunction of validations_default)this.#data.builtInValidations.push(builtInValidationFunction)}handleCommands(){let areHooksEnabled=this.#data.enableHooks;this.#data.client.on("interactionCreate",async interaction=>{if(!interaction.isChatInputCommand()&&!interaction.isContextMenuCommand()&&!interaction.isAutocomplete())return;let isAutocomplete=interaction.isAutocomplete(),targetCommand=this.#data.commands.find(cmd=>cmd.data.name===interaction.commandName);if(!targetCommand)return;let{data,options,run,autocomplete,...rest}=targetCommand;if(isAutocomplete&&!autocomplete)return;let executor=__name(async()=>{let commandObj={data:targetCommand.data,options:targetCommand.options,...rest};if(this.#data.validationHandler){let canRun2=!0;for(let validationFunction of this.#data.validationHandler.validations)if(await validationFunction({interaction,commandObj,client:this.#data.client,handler:this.#data.commandkitInstance})){canRun2=!1;break}if(!canRun2)return}let canRun=!0;if(!this.#data.skipBuiltInValidations){for(let validation of this.#data.builtInValidations)if(validation({targetCommand,interaction,handlerData:this.#data})){canRun=!1;break}}if(!canRun)return;let command=targetCommand[isAutocomplete?"autocomplete":"run"];if(!areHooksEnabled){let context={interaction,client:this.#data.client,handler:this.#data.commandkitInstance};return await command(context)}return command()},"executor");return this.context?this.context.run({command:targetCommand.data,interaction},executor):executor()})}get commands(){return this.#data.commands}async reloadCommands(type){if(!this.#data.commandsPath)throw new Error(colors_default.red('Cannot reload commands as "commandsPath" was not provided when instantiating CommandKit.'));this.#data.commands=[],await this.#buildCommands(),this.#data.bulkRegister?await loadCommandsWithRest({client:this.#data.client,devGuildIds:this.#data.devGuildIds,commands:this.#data.commands,reloading:!0,type}):await registerCommands({client:this.#data.client,devGuildIds:this.#data.devGuildIds,commands:this.#data.commands,reloading:!0,type})}};0&&(module.exports={CommandHandler});
11
+ //# sourceMappingURL=CommandHandler.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../src/handlers/command-handler/CommandHandler.ts","../../../src/utils/resolve-file-url.ts","../../../src/utils/get-paths.ts","../../../src/utils/clone.ts","../../../src/utils/colors.ts","../../../src/handlers/command-handler/functions/loadCommandsWithRest.ts","../../../src/handlers/command-handler/utils/areSlashCommandsDifferent.ts","../../../src/handlers/command-handler/functions/registerCommands.ts","../../../src/handlers/command-handler/validations/devOnly.ts","../../../src/handlers/command-handler/validations/permissions.ts","../../../src/handlers/command-handler/validations/index.ts"],"sourcesContent":["import type { CommandHandlerData, CommandHandlerOptions, CommandKitInteraction } from './typings';\nimport type { CommandFileObject, ReloadOptions } from '../../typings';\n\nimport { toFileURL } from '../../utils/resolve-file-url';\nimport { getFilePaths } from '../../utils/get-paths';\nimport { clone } from '../../utils/clone';\n\nimport loadCommandsWithRest from './functions/loadCommandsWithRest';\nimport registerCommands from './functions/registerCommands';\nimport builtInValidationsFunctions from './validations';\nimport colors from '../../utils/colors';\nimport { AsyncLocalStorage } from 'async_hooks';\nimport type { CommandData } from '../../types';\n\nexport interface hCommandContext {\n interaction: CommandKitInteraction;\n command: CommandData;\n}\n\n/**\n * A handler for client application commands.\n */\nexport class CommandHandler {\n #data: CommandHandlerData;\n context: AsyncLocalStorage<hCommandContext> | null = null;\n\n constructor({ ...options }: CommandHandlerOptions) {\n this.#data = {\n ...options,\n builtInValidations: [],\n commands: [],\n };\n }\n\n async init() {\n if (this.#data.enableHooks && !this.context) {\n this.context = new AsyncLocalStorage();\n }\n await this.#buildCommands();\n\n this.#buildBuiltInValidations();\n\n const devOnlyCommands = this.#data.commands.filter((cmd) => cmd.options?.devOnly);\n\n if (devOnlyCommands.length && !this.#data.devGuildIds.length) {\n process.emitWarning(\n colors.yellow(\n 'You have commands marked as \"devOnly\", but \"devGuildIds\" have not been set.',\n ),\n );\n }\n\n if (\n devOnlyCommands.length &&\n !this.#data.devUserIds.length &&\n !this.#data.devRoleIds.length\n ) {\n process.emitWarning(\n colors.yellow(\n 'You have commands marked as \"devOnly\", but \"devUserIds\" or \"devRoleIds\" have not been set.',\n ),\n );\n }\n\n if (this.#data.bulkRegister) {\n await loadCommandsWithRest({\n client: this.#data.client,\n devGuildIds: this.#data.devGuildIds,\n commands: this.#data.commands,\n });\n } else {\n await registerCommands({\n client: this.#data.client,\n devGuildIds: this.#data.devGuildIds,\n commands: this.#data.commands,\n });\n }\n\n this.handleCommands();\n }\n\n async #buildCommands() {\n const allowedExtensions = /\\.(js|mjs|cjs|ts)$/i;\n const paths = await getFilePaths(this.#data.commandsPath, true);\n\n const commandFilePaths = paths.filter((path) => allowedExtensions.test(path));\n\n for (const commandFilePath of commandFilePaths) {\n const modulePath = toFileURL(commandFilePath);\n\n const importedObj = await import(`${modulePath}?t=${Date.now()}`);\n let commandObj: CommandFileObject = clone(importedObj); // Make commandObj extensible\n\n // If it's CommonJS, invalidate the import cache\n if (typeof module !== 'undefined' && typeof require !== 'undefined') {\n delete require.cache[require.resolve(commandFilePath)];\n }\n\n const compactFilePath = commandFilePath.split(process.cwd())[1] || commandFilePath;\n\n if (commandObj.default) commandObj = commandObj.default as CommandFileObject;\n\n // Ensure builder properties\n if (importedObj.default) {\n commandObj.data = importedObj.default.data;\n } else {\n commandObj.data = importedObj.data;\n }\n\n if (!commandObj.data) {\n process.emitWarning(\n colors.yellow(\n `Ignoring: Command file ${compactFilePath} does not export \"data\".`,\n ),\n );\n continue;\n }\n\n if (!commandObj.data.name) {\n process.emitWarning(\n colors.yellow(\n `Ignoring: Command file ${compactFilePath} does not export \"data.name\".`,\n ),\n );\n continue;\n }\n\n if (!commandObj.run) {\n process.emitWarning(\n colors.yellow(\n `Ignoring: Command file ${commandObj.data.name} does not export \"run\".`,\n ),\n );\n continue;\n }\n\n if (typeof commandObj.run !== 'function') {\n process.emitWarning(\n colors.yellow(\n `Ignoring: Command file ${commandObj.data.name} does not export \"run\" as a function.`,\n ),\n );\n continue;\n }\n\n commandObj.filePath = commandFilePath;\n\n let commandCategory =\n commandFilePath\n .split(this.#data.commandsPath)[1]\n ?.replace(/\\\\\\\\|\\\\/g, '/')\n .split('/')[1] || null;\n\n if (commandCategory && allowedExtensions.test(commandCategory)) {\n commandObj.category = null;\n } else {\n commandObj.category = commandCategory;\n }\n\n this.#data.commands.push(commandObj);\n }\n }\n\n #buildBuiltInValidations() {\n for (const builtInValidationFunction of builtInValidationsFunctions) {\n this.#data.builtInValidations.push(builtInValidationFunction);\n }\n }\n\n handleCommands() {\n const areHooksEnabled = this.#data.enableHooks;\n\n this.#data.client.on('interactionCreate', async (interaction) => {\n if (\n !interaction.isChatInputCommand() &&\n !interaction.isContextMenuCommand() &&\n !interaction.isAutocomplete()\n )\n return;\n\n const isAutocomplete = interaction.isAutocomplete();\n\n const targetCommand = this.#data.commands.find(\n (cmd) => cmd.data.name === interaction.commandName,\n );\n\n if (!targetCommand) return;\n\n const { data, options, run, autocomplete, ...rest } = targetCommand;\n\n // Skip if autocomplete handler is not defined\n if (isAutocomplete && !autocomplete) return;\n\n const executor = async () => {\n const commandObj = {\n data: targetCommand.data,\n options: targetCommand.options,\n ...rest,\n };\n\n if (this.#data.validationHandler) {\n let canRun = true;\n\n for (const validationFunction of this.#data.validationHandler.validations) {\n const stopValidationLoop = await validationFunction({\n interaction,\n commandObj,\n client: this.#data.client,\n handler: this.#data.commandkitInstance,\n });\n\n if (stopValidationLoop) {\n canRun = false;\n break;\n }\n }\n\n if (!canRun) return;\n }\n\n let canRun = true;\n\n // If custom validations pass and !skipBuiltInValidations, run built-in CommandKit validation functions\n if (!this.#data.skipBuiltInValidations) {\n for (const validation of this.#data.builtInValidations) {\n const stopValidationLoop = validation({\n targetCommand,\n interaction,\n handlerData: this.#data,\n });\n\n if (stopValidationLoop) {\n canRun = false;\n break;\n }\n }\n }\n\n if (!canRun) return;\n\n const command = targetCommand[isAutocomplete ? 'autocomplete' : 'run']!;\n\n // if hooks are not enabled, pass the context to the command via its arguments\n if (!areHooksEnabled) {\n const context = {\n interaction,\n client: this.#data.client,\n handler: this.#data.commandkitInstance,\n };\n return await command(context);\n }\n\n // @ts-expect-error - context data is not passed when hooks are enabled\n return command();\n };\n\n if (this.context)\n return this.context.run(\n {\n command: targetCommand.data,\n interaction,\n },\n executor,\n );\n return executor();\n });\n }\n\n get commands() {\n return this.#data.commands;\n }\n\n async reloadCommands(type?: ReloadOptions) {\n if (!this.#data.commandsPath) {\n throw new Error(\n colors.red(\n 'Cannot reload commands as \"commandsPath\" was not provided when instantiating CommandKit.',\n ),\n );\n }\n\n this.#data.commands = [];\n\n // Re-build commands tree\n await this.#buildCommands();\n\n if (this.#data.bulkRegister) {\n await loadCommandsWithRest({\n client: this.#data.client,\n devGuildIds: this.#data.devGuildIds,\n commands: this.#data.commands,\n reloading: true,\n type,\n });\n } else {\n await registerCommands({\n client: this.#data.client,\n devGuildIds: this.#data.devGuildIds,\n commands: this.#data.commands,\n reloading: true,\n type,\n });\n }\n }\n}\n","import path from 'path';\n\n/**\n * Convert a local file path to a file URL.\n * @param filePath - The local file's path.\n * @returns - The converted file URL.\n */\nexport function toFileURL(filePath: string) {\n const resolvedPath = path.resolve(filePath);\n return 'file://' + resolvedPath.replace(/\\\\\\\\|\\\\/g, '/');\n}\n","import path from 'path';\nimport fs from 'fs/promises';\n\nexport async function getFilePaths(directory: string, nesting?: boolean): Promise<string[]> {\n let filePaths: string[] = [];\n\n if (!directory) return filePaths;\n\n const files = await fs.readdir(directory, { withFileTypes: true });\n\n for (const file of files) {\n const filePath = path.join(directory, file.name);\n\n if (file.isFile()) {\n filePaths.push(filePath);\n }\n\n if (nesting && file.isDirectory()) {\n filePaths = [...filePaths, ...(await getFilePaths(filePath, true))];\n }\n }\n\n return filePaths;\n}\n\nexport async function getFolderPaths(directory: string, nesting?: boolean): Promise<string[]> {\n let folderPaths: string[] = [];\n\n if (!directory) return folderPaths;\n\n const folders = await fs.readdir(directory, { withFileTypes: true });\n\n for (const folder of folders) {\n const folderPath = path.join(directory, folder.name);\n\n if (folder.isDirectory()) {\n folderPaths.push(folderPath);\n\n if (nesting) {\n folderPaths = [...folderPaths, ...(await getFolderPaths(folderPath, true))];\n }\n }\n }\n\n return folderPaths;\n}\n","import rfdc from 'rfdc';\n\nexport const clone = rfdc();\n","const resetColor = '\\x1b[0m';\n\nexport default {\n reset: (text: string) => `${text}${resetColor}`,\n bright: (text: string) => `\\x1b[1m${text}${resetColor}`,\n dim: (text: string) => `\\x1b[2m${text}${resetColor}`,\n underscore: (text: string) => `\\x1b[4m${text}${resetColor}`,\n blink: (text: string) => `\\x1b[5m${text}${resetColor}`,\n reverse: (text: string) => `\\x1b[7m${text}${resetColor}`,\n hidden: (text: string) => `\\x1b[8m${text}${resetColor}`,\n\n black: (text: string) => `\\x1b[30m${text}${resetColor}`,\n red: (text: string) => `\\x1b[31m${text}${resetColor}`,\n green: (text: string) => `\\x1b[32m${text}${resetColor}`,\n yellow: (text: string) => `\\x1b[33m${text}${resetColor}`,\n blue: (text: string) => `\\x1b[34m${text}${resetColor}`,\n magenta: (text: string) => `\\x1b[35m${text}${resetColor}`,\n cyan: (text: string) => `\\x1b[36m${text}${resetColor}`,\n white: (text: string) => `\\x1b[37m${text}${resetColor}`,\n\n bgBlack: (text: string) => `\\x1b[40m${text}${resetColor}`,\n bgRed: (text: string) => `\\x1b[41m${text}${resetColor}`,\n bgGreen: (text: string) => `\\x1b[42m${text}${resetColor}`,\n bgYellow: (text: string) => `\\x1b[43m${text}${resetColor}`,\n bgBlue: (text: string) => `\\x1b[44m${text}${resetColor}`,\n bgMagenta: (text: string) => `\\x1b[45m${text}${resetColor}`,\n bgCyan: (text: string) => `\\x1b[46m${text}${resetColor}`,\n bgWhite: (text: string) => `\\x1b[47m${text}${resetColor}`,\n};\n","import type { ApplicationCommandDataResolvable, Client } from 'discord.js';\nimport type { CommandFileObject, ReloadOptions } from '../../../typings';\n\nimport colors from '../../../utils/colors';\n\ntype LoadCommandsWithRestProps = {\n /**\n * The main client.\n */\n client: Client;\n\n /**\n * An array of command objects.\n */\n commands: CommandFileObject[];\n\n /**\n * An array of developer guild IDs.\n */\n devGuildIds: string[];\n\n /**\n * A boolean indicating whether these commands are reloading.\n */\n reloading?: boolean;\n\n /**\n * A type for reloading the commands (if this is reloading).\n */\n type?: ReloadOptions;\n};\n\n/**\n * Use REST to load commands.\n * @param props - Options for loading commands.\n */\nexport default async function loadCommandsWithRest(props: LoadCommandsWithRestProps) {\n if (props.reloading) {\n if (props.client.isReady()) {\n await handleLoading(\n props.client,\n props.commands,\n props.devGuildIds,\n props.reloading,\n props.type,\n );\n } else {\n throw new Error(colors.red(`Cannot reload commands when client is not ready.`));\n }\n } else {\n props.client.once('ready', async (c) => {\n await handleLoading(c, props.commands, props.devGuildIds, props.reloading, props.type);\n });\n }\n}\n\n/**\n * Handles loading commands.\n * @param client - The discord.js client instance.\n * @param commands - An array of command file objects.\n * @param devGuildIds - An array of developer guild IDs.\n * @param reloading - A boolean indicating whether this is reloading.\n * @param type - A type for reloading the commands (if this is reloading).\n */\nasync function handleLoading(\n client: Client<true>,\n commands: CommandFileObject[],\n devGuildIds: string[],\n reloading?: boolean,\n type?: ReloadOptions,\n) {\n commands = commands.filter((cmd) => !cmd.options?.deleted);\n const devOnlyCommands = commands.filter((cmd) => cmd.options?.devOnly);\n const globalCommands = commands.filter((cmd) => !cmd.options?.devOnly);\n\n if (type === 'dev') {\n await loadDevCommands(client, devOnlyCommands, devGuildIds, reloading);\n } else if (type === 'global') {\n await loadGlobalCommands(client, globalCommands, reloading);\n } else {\n await loadDevCommands(client, devOnlyCommands, devGuildIds, reloading);\n await loadGlobalCommands(client, globalCommands, reloading);\n }\n}\n\n/**\n * Load commands globally.\n * @param client - The discord.js client instance.\n * @param commands - An array of command file objects.\n * @param reloading - A boolean indicating whether the commands are reloading.\n */\nasync function loadGlobalCommands(\n client: Client<true>,\n commands: CommandFileObject[],\n reloading?: boolean,\n) {\n const requestBody = commands.map((cmd) => cmd.data);\n\n await client.application.commands\n .set(requestBody as ApplicationCommandDataResolvable[])\n .catch((error) => {\n throw new Error(\n colors.red(\n `Error ${reloading ? 'reloading' : 'loading'} global application commands.\\n`,\n ),\n error,\n );\n });\n\n console.log(\n colors.green(`${reloading ? 'Reloaded' : 'Loaded'} ${requestBody.length} global commands.`),\n );\n}\n\n/**\n * Load commands for dev guilds.\n * @param client - The discord.js client instance.\n * @param commands - An array of command file objects.\n * @param guildIds - An array of developer guild IDs.\n * @param reloading - A boolean indicating whether the commands are reloading.\n */\nasync function loadDevCommands(\n client: Client<true>,\n commands: CommandFileObject[],\n guildIds: string[],\n reloading?: boolean,\n) {\n const requestBody = commands.map((cmd) => cmd.data);\n\n for (const guildId of guildIds) {\n const targetGuild =\n client.guilds.cache.get(guildId) || (await client.guilds.fetch(guildId));\n\n if (!targetGuild) {\n process.emitWarning(\n `Cannot ${\n reloading ? 'reload' : 'load'\n } commands in guild \"${guildId}\" - guild doesn't exist or client isn't part of the guild.`,\n );\n\n continue;\n }\n\n await targetGuild.commands\n .set(requestBody as ApplicationCommandDataResolvable[])\n .catch((error) => {\n throw new Error(\n colors.red(\n `Error ${\n reloading ? 'reloading' : 'loading'\n } developer application commands in guild \"${\n targetGuild?.name || guildId\n }\".\\n`,\n ),\n error,\n );\n });\n\n console.log(\n colors.green(\n `${reloading ? 'Reloaded' : 'Loaded'} ${\n requestBody.length\n } developer commands in guild \"${targetGuild.name}\".`,\n ),\n );\n }\n}\n","/**\n * Test if two slash commands are different.\n * @param appCommand - The application command.\n * @param localCommand - The local command.\n * @returns A boolean indicating whether these commands are different\n */\nexport default function areSlashCommandsDifferent(appCommand: any, localCommand: any) {\n if (!appCommand.options) appCommand.options = [];\n if (!localCommand.options) localCommand.options = [];\n\n if (!appCommand.description) appCommand.description = '';\n if (!localCommand.description) localCommand.description = '';\n\n if (\n localCommand.description !== appCommand.description ||\n localCommand.options.length !== appCommand.options.length\n ) {\n return true;\n }\n}\n","import type {\n Guild,\n Client,\n ApplicationCommandData,\n GuildApplicationCommandManager,\n ApplicationCommandDataResolvable,\n} from 'discord.js';\nimport type { CommandFileObject, ReloadOptions } from '../../../typings';\n\nimport areSlashCommandsDifferent from '../utils/areSlashCommandsDifferent';\n\nimport colors from '../../../utils/colors';\n\ntype RegisterCommandProps = {\n client: Client;\n commands: CommandFileObject[];\n devGuildIds: string[];\n reloading?: boolean;\n type?: ReloadOptions;\n};\n\n/**\n * Register client commands to Discord.\n * @param props\n */\nexport default async function registerCommands(props: RegisterCommandProps) {\n if (props.reloading) {\n if (props.client.isReady()) {\n await handleRegistration(props.client, props.commands, props.devGuildIds, props.type);\n } else {\n throw new Error(colors.red(`Cannot reload commands when client is not ready.`));\n }\n } else {\n props.client.once('ready', async (c) => {\n await handleRegistration(c, props.commands, props.devGuildIds, props.type);\n });\n }\n}\n\nasync function handleRegistration(\n client: Client<true>,\n commands: CommandFileObject[],\n devGuildIds: string[],\n type?: ReloadOptions,\n) {\n const devOnlyCommands = commands.filter((cmd) => cmd.options?.devOnly);\n const globalCommands = commands.filter((cmd) => !cmd.options?.devOnly);\n\n if (type === 'dev') {\n await registerDevCommands(client, devOnlyCommands, devGuildIds);\n } else if (type === 'global') {\n await registerGlobalCommands(client, globalCommands);\n } else {\n await registerDevCommands(client, devOnlyCommands, devGuildIds);\n await registerGlobalCommands(client, globalCommands);\n }\n}\n\nasync function registerGlobalCommands(client: Client<true>, commands: CommandFileObject[]) {\n const appCommandsManager = client.application.commands;\n await appCommandsManager.fetch();\n\n for (const command of commands) {\n const targetCommand = appCommandsManager.cache.find(\n (cmd) => cmd.name === command.data.name,\n );\n\n // <!-- Delete global command -->\n if (command.options?.deleted) {\n if (!targetCommand) {\n process.emitWarning(\n colors.yellow(\n `Ignoring: Command \"${command.data.name}\" is globally marked as deleted.`,\n ),\n );\n } else {\n await targetCommand.delete().catch((error) => {\n throw new Error(\n colors.red(`Failed to delete command \"${command.data.name}\" globally.\\n`),\n error,\n );\n });\n\n console.log(colors.green(`Deleted command \"${command.data.name}\" globally.`));\n }\n\n continue;\n }\n\n // <!-- Edit global command -->\n if (targetCommand) {\n const commandsAreDifferent = areSlashCommandsDifferent(targetCommand, command.data);\n\n if (commandsAreDifferent) {\n await targetCommand\n .edit(command.data as Partial<ApplicationCommandData>)\n .catch((error) => {\n throw new Error(\n colors.red(`Failed to edit command \"${command.data.name}\" globally.\\n`),\n error,\n );\n });\n\n console.log(colors.green(`Edited command \"${command.data.name}\" globally.`));\n\n continue;\n }\n }\n\n // <!-- Register global command -->\n if (targetCommand) continue;\n\n await appCommandsManager\n .create(command.data as ApplicationCommandDataResolvable)\n .catch((error) => {\n throw new Error(\n colors.red(`Failed to register command \"${command.data.name}\" globally.\\n`),\n error,\n );\n });\n\n console.log(colors.green(`Registered command \"${command.data.name}\" globally.`));\n }\n}\n\nasync function registerDevCommands(\n client: Client<true>,\n commands: CommandFileObject[],\n guildIds: string[],\n) {\n const devGuilds: Guild[] = [];\n\n for (const guildId of guildIds) {\n const guild = client.guilds.cache.get(guildId) || (await client.guilds.fetch(guildId));\n\n if (!guild) {\n process.emitWarning(\n colors.yellow(\n `Ignoring: Guild ${guildId} doesn't exist or client isn't part of the guild.`,\n ),\n );\n continue;\n }\n\n devGuilds.push(guild);\n }\n\n const guildCommandsManagers: GuildApplicationCommandManager[] = [];\n\n for (const guild of devGuilds) {\n const guildCommandsManager = guild.commands;\n await guildCommandsManager.fetch();\n\n guildCommandsManagers.push(guildCommandsManager);\n }\n\n for (const command of commands) {\n for (const guildCommands of guildCommandsManagers) {\n const targetCommand = guildCommands.cache.find((cmd) => cmd.name === command.data.name);\n\n // <!-- Delete dev command -->\n if (command.options?.deleted) {\n if (!targetCommand) {\n process.emitWarning(\n colors.yellow(\n `Ignoring: Command \"${command.data.name}\" is marked as deleted in ${guildCommands.guild.name}.`,\n ),\n );\n } else {\n await targetCommand.delete().catch((error) => {\n throw new Error(\n colors.red(\n `Failed to delete command \"${command.data.name}\" in ${guildCommands.guild.name}.`,\n ),\n error,\n );\n });\n\n console.log(\n colors.green(\n `Deleted command \"${command.data.name}\" in ${guildCommands.guild.name}.`,\n ),\n );\n }\n\n continue;\n }\n\n // <!-- Edit dev command -->\n if (targetCommand) {\n const commandsAreDifferent = areSlashCommandsDifferent(targetCommand, command.data);\n\n if (commandsAreDifferent) {\n await targetCommand\n .edit(command.data as Partial<ApplicationCommandData>)\n .catch((error) => {\n throw new Error(\n colors.red(\n `Failed to edit command \"${command.data.name}\" in ${guildCommands.guild.name}.\\n`,\n ),\n error,\n );\n });\n\n console.log(\n colors.green(\n `Edited command \"${command.data.name}\" in ${guildCommands.guild.name}.`,\n ),\n );\n\n continue;\n }\n }\n\n // <!-- Register guild command -->\n if (targetCommand) continue;\n\n await guildCommands\n .create(command.data as ApplicationCommandDataResolvable)\n .catch((error) => {\n throw new Error(\n colors.red(\n `Failed to register command \"${command.data.name}\" in ${guildCommands.guild.name}.\\n`,\n ),\n error,\n );\n });\n\n console.log(\n colors.green(\n `Registered command \"${command.data.name}\" in ${guildCommands.guild.name}.`,\n ),\n );\n }\n }\n}\n","import type { BuiltInValidationParams } from '../typings';\n\nexport default function ({ interaction, targetCommand, handlerData }: BuiltInValidationParams) {\n if (interaction.isAutocomplete()) return;\n\n if (targetCommand.options?.devOnly) {\n if (interaction.inGuild() && !handlerData.devGuildIds.includes(interaction.guildId)) {\n interaction.reply({\n content: '❌ This command can only be used inside development servers.',\n ephemeral: true,\n });\n\n return true;\n }\n\n const guildMember = interaction.guild?.members.cache.get(interaction.user.id);\n const memberRoles = guildMember?.roles.cache;\n\n let hasDevRole = false;\n\n memberRoles?.forEach((role) => {\n if (handlerData.devRoleIds.includes(role.id)) {\n hasDevRole = true;\n }\n });\n\n const isDevUser = handlerData.devUserIds.includes(interaction.user.id) || hasDevRole;\n\n if (!isDevUser) {\n interaction.reply({\n content: '❌ This command can only be used by developers.',\n ephemeral: true,\n });\n\n return true;\n }\n }\n}\n","import type { BuiltInValidationParams } from '../typings';\nimport { EmbedBuilder } from 'discord.js';\n\nexport default function ({ interaction, targetCommand }: BuiltInValidationParams) {\n if (interaction.isAutocomplete()) return;\n const userPermissions = interaction.memberPermissions;\n let userPermissionsRequired = targetCommand.options?.userPermissions;\n let missingUserPermissions: string[] = [];\n\n if (typeof userPermissionsRequired === 'string') {\n userPermissionsRequired = [userPermissionsRequired];\n }\n\n const botPermissions = interaction.guild?.members.me?.permissions;\n let botPermissionsRequired = targetCommand.options?.botPermissions;\n let missingBotPermissions: string[] = [];\n\n if (typeof botPermissionsRequired === 'string') {\n botPermissionsRequired = [botPermissionsRequired];\n }\n\n if (!userPermissionsRequired?.length && !botPermissionsRequired?.length) {\n return;\n }\n\n if (userPermissions && userPermissionsRequired) {\n for (const permission of userPermissionsRequired) {\n const hasPermission = userPermissions.has(permission);\n\n if (!hasPermission) {\n missingUserPermissions.push(permission);\n }\n }\n }\n\n if (botPermissions && botPermissionsRequired) {\n for (const permission of botPermissionsRequired) {\n const hasPermission = botPermissions.has(permission);\n\n if (!hasPermission) {\n missingBotPermissions.push(permission);\n }\n }\n }\n\n if (!missingUserPermissions.length && !missingBotPermissions.length) {\n return;\n }\n\n // Fix casing. e.g. KickMembers -> Kick Members\n const pattern = /([a-z])([A-Z])|([A-Z]+)([A-Z][a-z])/g;\n\n missingUserPermissions = missingUserPermissions.map((str) => str.replace(pattern, '$1$3 $2$4'));\n missingBotPermissions = missingBotPermissions.map((str) => str.replace(pattern, '$1$3 $2$4'));\n\n let embedDescription = '';\n\n const formatter = new Intl.ListFormat('en', { style: 'long', type: 'conjunction' });\n\n const getPermissionWord = (permissions: string[]) =>\n permissions.length === 1 ? 'permission' : 'permissions';\n\n if (missingUserPermissions.length) {\n const formattedPermissions = missingUserPermissions.map((p) => `\\`${p}\\``);\n const permissionsString = formatter.format(formattedPermissions);\n\n embedDescription += `- You must have the ${permissionsString} ${getPermissionWord(\n missingUserPermissions,\n )} to be able to run this command.\\n`;\n }\n\n if (missingBotPermissions.length) {\n const formattedPermissions = missingBotPermissions.map((p) => `\\`${p}\\``);\n const permissionsString = formatter.format(formattedPermissions);\n\n embedDescription += `- I must have the ${permissionsString} ${getPermissionWord(\n missingBotPermissions,\n )} to be able to execute this command.\\n`;\n }\n\n const embed = new EmbedBuilder()\n .setTitle(`:x: Missing permissions!`)\n .setDescription(embedDescription)\n .setColor('Red');\n\n interaction.reply({ embeds: [embed], ephemeral: true });\n return true;\n}\n","import devOnly from './devOnly';\nimport permissions from './permissions';\n\nexport default [devOnly, permissions];\n"],"mappings":"q+BAAA,uJCAA,gBAAiB,yBAOV,SAAS,UAAU,SAAkB,CAExC,MAAO,UADc,YAAAA,QAAK,QAAQ,QAAQ,EACV,QAAQ,WAAY,GAAG,CAC3D,CAHgB,8BCPhB,IAAAC,aAAiB,yBACjB,gBAAe,gCAEf,eAAsB,aAAa,UAAmB,QAAsC,CACxF,IAAI,UAAsB,CAAC,EAE3B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AK,QAAQ,IAChB,CACI,QAAS,cAAc,KACvB,WACJ,EACA,QACJ,EACG,SAAS,CACpB,CAAC,CACL,CAEA,IAAI,UAAW,CACX,OAAO,KAAK,MAAM,QACtB,CAEA,MAAM,eAAe,KAAsB,CACvC,GAAI,CAAC,KAAK,MAAM,aACZ,MAAM,IAAI,MACN,eAAO,IACH,0FACJ,CACJ,EAGJ,KAAK,MAAM,SAAW,CAAC,EAGvB,MAAM,KAAK,eAAe,EAEtB,KAAK,MAAM,aACX,MAAM,qBAAqB,CACvB,OAAQ,KAAK,MAAM,OACnB,YAAa,KAAK,MAAM,YACxB,SAAU,KAAK,MAAM,SACrB,UAAW,GACX,IACJ,CAAC,EAED,MAAM,iBAAiB,CACnB,OAAQ,KAAK,MAAM,OACnB,YAAa,KAAK,MAAM,YACxB,SAAU,KAAK,MAAM,SACrB,UAAW,GACX,IACJ,CAAC,CAET,CACJ","names":["path","import_path","fs","path","rfdc","path","canRun"]}
@@ -0,0 +1,2 @@
1
+ import{CommandHandler}from"../../chunk-47OCM32X.mjs";import"../../chunk-LVMZYYYQ.mjs";import"../../chunk-5A7S2KUP.mjs";import"../../chunk-ZBUBSPF6.mjs";import"../../chunk-5NCNVJD5.mjs";import"../../chunk-YVVGY7EA.mjs";import"../../chunk-NAGAOZDU.mjs";import"../../chunk-GLH4FCGA.mjs";import"../../chunk-3RMN5A5C.mjs";import"../../chunk-VURGPMLB.mjs";import"../../chunk-DJGEQTVH.mjs";import"../../chunk-7KD7ZCH6.mjs";export{CommandHandler};
2
+ //# sourceMappingURL=CommandHandler.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,35 @@
1
+ import { Client } from 'discord.js';
2
+ import { i as CommandFileObject, j as ReloadOptions } from '../../../CommandKit--SA9LcIq.mjs';
3
+ import '../../validation-handler/ValidationHandler.mjs';
4
+ import '../../validation-handler/typings.mjs';
5
+ import 'async_hooks';
6
+
7
+ type LoadCommandsWithRestProps = {
8
+ /**
9
+ * The main client.
10
+ */
11
+ client: Client;
12
+ /**
13
+ * An array of command objects.
14
+ */
15
+ commands: CommandFileObject[];
16
+ /**
17
+ * An array of developer guild IDs.
18
+ */
19
+ devGuildIds: string[];
20
+ /**
21
+ * A boolean indicating whether these commands are reloading.
22
+ */
23
+ reloading?: boolean;
24
+ /**
25
+ * A type for reloading the commands (if this is reloading).
26
+ */
27
+ type?: ReloadOptions;
28
+ };
29
+ /**
30
+ * Use REST to load commands.
31
+ * @param props - Options for loading commands.
32
+ */
33
+ declare function loadCommandsWithRest(props: LoadCommandsWithRestProps): Promise<void>;
34
+
35
+ export { loadCommandsWithRest as default };
@@ -0,0 +1,35 @@
1
+ import { Client } from 'discord.js';
2
+ import { i as CommandFileObject, j as ReloadOptions } from '../../../CommandKit-GIHMEeqf.js';
3
+ import '../../validation-handler/ValidationHandler.js';
4
+ import '../../validation-handler/typings.js';
5
+ import 'async_hooks';
6
+
7
+ type LoadCommandsWithRestProps = {
8
+ /**
9
+ * The main client.
10
+ */
11
+ client: Client;
12
+ /**
13
+ * An array of command objects.
14
+ */
15
+ commands: CommandFileObject[];
16
+ /**
17
+ * An array of developer guild IDs.
18
+ */
19
+ devGuildIds: string[];
20
+ /**
21
+ * A boolean indicating whether these commands are reloading.
22
+ */
23
+ reloading?: boolean;
24
+ /**
25
+ * A type for reloading the commands (if this is reloading).
26
+ */
27
+ type?: ReloadOptions;
28
+ };
29
+ /**
30
+ * Use REST to load commands.
31
+ * @param props - Options for loading commands.
32
+ */
33
+ declare function loadCommandsWithRest(props: LoadCommandsWithRestProps): Promise<void>;
34
+
35
+ export { loadCommandsWithRest as default };
@@ -0,0 +1,4 @@
1
+ "use strict";var __defProp=Object.defineProperty;var __getOwnPropDesc=Object.getOwnPropertyDescriptor;var __getOwnPropNames=Object.getOwnPropertyNames;var __hasOwnProp=Object.prototype.hasOwnProperty;var __name=(target,value)=>__defProp(target,"name",{value,configurable:!0});var __export=(target,all)=>{for(var name in all)__defProp(target,name,{get:all[name],enumerable:!0})},__copyProps=(to,from,except,desc)=>{if(from&&typeof from=="object"||typeof from=="function")for(let key of __getOwnPropNames(from))!__hasOwnProp.call(to,key)&&key!==except&&__defProp(to,key,{get:()=>from[key],enumerable:!(desc=__getOwnPropDesc(from,key))||desc.enumerable});return to};var __toCommonJS=mod=>__copyProps(__defProp({},"__esModule",{value:!0}),mod);var loadCommandsWithRest_exports={};__export(loadCommandsWithRest_exports,{default:()=>loadCommandsWithRest});module.exports=__toCommonJS(loadCommandsWithRest_exports);var resetColor="\x1B[0m",colors_default={reset:text=>`${text}${resetColor}`,bright:text=>`\x1B[1m${text}${resetColor}`,dim:text=>`\x1B[2m${text}${resetColor}`,underscore:text=>`\x1B[4m${text}${resetColor}`,blink:text=>`\x1B[5m${text}${resetColor}`,reverse:text=>`\x1B[7m${text}${resetColor}`,hidden:text=>`\x1B[8m${text}${resetColor}`,black:text=>`\x1B[30m${text}${resetColor}`,red:text=>`\x1B[31m${text}${resetColor}`,green:text=>`\x1B[32m${text}${resetColor}`,yellow:text=>`\x1B[33m${text}${resetColor}`,blue:text=>`\x1B[34m${text}${resetColor}`,magenta:text=>`\x1B[35m${text}${resetColor}`,cyan:text=>`\x1B[36m${text}${resetColor}`,white:text=>`\x1B[37m${text}${resetColor}`,bgBlack:text=>`\x1B[40m${text}${resetColor}`,bgRed:text=>`\x1B[41m${text}${resetColor}`,bgGreen:text=>`\x1B[42m${text}${resetColor}`,bgYellow:text=>`\x1B[43m${text}${resetColor}`,bgBlue:text=>`\x1B[44m${text}${resetColor}`,bgMagenta:text=>`\x1B[45m${text}${resetColor}`,bgCyan:text=>`\x1B[46m${text}${resetColor}`,bgWhite:text=>`\x1B[47m${text}${resetColor}`};async function loadCommandsWithRest(props){if(props.reloading)if(props.client.isReady())await handleLoading(props.client,props.commands,props.devGuildIds,props.reloading,props.type);else throw new Error(colors_default.red("Cannot reload commands when client is not ready."));else props.client.once("ready",async c=>{await handleLoading(c,props.commands,props.devGuildIds,props.reloading,props.type)})}__name(loadCommandsWithRest,"loadCommandsWithRest");async function handleLoading(client,commands,devGuildIds,reloading,type){commands=commands.filter(cmd=>!cmd.options?.deleted);let devOnlyCommands=commands.filter(cmd=>cmd.options?.devOnly),globalCommands=commands.filter(cmd=>!cmd.options?.devOnly);type==="dev"?await loadDevCommands(client,devOnlyCommands,devGuildIds,reloading):type==="global"?await loadGlobalCommands(client,globalCommands,reloading):(await loadDevCommands(client,devOnlyCommands,devGuildIds,reloading),await loadGlobalCommands(client,globalCommands,reloading))}__name(handleLoading,"handleLoading");async function loadGlobalCommands(client,commands,reloading){let requestBody=commands.map(cmd=>cmd.data);await client.application.commands.set(requestBody).catch(error=>{throw new Error(colors_default.red(`Error ${reloading?"reloading":"loading"} global application commands.
2
+ `),error)}),console.log(colors_default.green(`${reloading?"Reloaded":"Loaded"} ${requestBody.length} global commands.`))}__name(loadGlobalCommands,"loadGlobalCommands");async function loadDevCommands(client,commands,guildIds,reloading){let requestBody=commands.map(cmd=>cmd.data);for(let guildId of guildIds){let targetGuild=client.guilds.cache.get(guildId)||await client.guilds.fetch(guildId);if(!targetGuild){process.emitWarning(`Cannot ${reloading?"reload":"load"} commands in guild "${guildId}" - guild doesn't exist or client isn't part of the guild.`);continue}await targetGuild.commands.set(requestBody).catch(error=>{throw new Error(colors_default.red(`Error ${reloading?"reloading":"loading"} developer application commands in guild "${targetGuild?.name||guildId}".
3
+ `),error)}),console.log(colors_default.green(`${reloading?"Reloaded":"Loaded"} ${requestBody.length} developer commands in guild "${targetGuild.name}".`))}}__name(loadDevCommands,"loadDevCommands");
4
+ //# sourceMappingURL=loadCommandsWithRest.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../../../../src/handlers/command-handler/functions/loadCommandsWithRest.ts","../../../../src/utils/colors.ts"],"sourcesContent":["import type { ApplicationCommandDataResolvable, Client } from 'discord.js';\nimport type { CommandFileObject, ReloadOptions } from '../../../typings';\n\nimport colors from '../../../utils/colors';\n\ntype LoadCommandsWithRestProps = {\n /**\n * The main client.\n */\n client: Client;\n\n /**\n * An array of command objects.\n */\n commands: CommandFileObject[];\n\n /**\n * An array of developer guild IDs.\n */\n devGuildIds: string[];\n\n /**\n * A boolean indicating whether these commands are reloading.\n */\n reloading?: boolean;\n\n /**\n * A type for reloading the commands (if this is reloading).\n */\n type?: ReloadOptions;\n};\n\n/**\n * Use REST to load commands.\n * @param props - Options for loading commands.\n */\nexport default async function loadCommandsWithRest(props: LoadCommandsWithRestProps) {\n if (props.reloading) {\n if (props.client.isReady()) {\n await handleLoading(\n props.client,\n props.commands,\n props.devGuildIds,\n props.reloading,\n props.type,\n );\n } else {\n throw new Error(colors.red(`Cannot reload commands when client is not ready.`));\n }\n } else {\n props.client.once('ready', async (c) => {\n await handleLoading(c, props.commands, props.devGuildIds, props.reloading, props.type);\n });\n }\n}\n\n/**\n * Handles loading commands.\n * @param client - The discord.js client instance.\n * @param commands - An array of command file objects.\n * @param devGuildIds - An array of developer guild IDs.\n * @param reloading - A boolean indicating whether this is reloading.\n * @param type - A type for reloading the commands (if this is reloading).\n */\nasync function handleLoading(\n client: Client<true>,\n commands: CommandFileObject[],\n devGuildIds: string[],\n reloading?: boolean,\n type?: ReloadOptions,\n) {\n commands = commands.filter((cmd) => !cmd.options?.deleted);\n const devOnlyCommands = commands.filter((cmd) => cmd.options?.devOnly);\n const globalCommands = commands.filter((cmd) => !cmd.options?.devOnly);\n\n if (type === 'dev') {\n await loadDevCommands(client, devOnlyCommands, devGuildIds, reloading);\n } else if (type === 'global') {\n await loadGlobalCommands(client, globalCommands, reloading);\n } else {\n await loadDevCommands(client, devOnlyCommands, devGuildIds, reloading);\n await loadGlobalCommands(client, globalCommands, reloading);\n }\n}\n\n/**\n * Load commands globally.\n * @param client - The discord.js client instance.\n * @param commands - An array of command file objects.\n * @param reloading - A boolean indicating whether the commands are reloading.\n */\nasync function loadGlobalCommands(\n client: Client<true>,\n commands: CommandFileObject[],\n reloading?: boolean,\n) {\n const requestBody = commands.map((cmd) => cmd.data);\n\n await client.application.commands\n .set(requestBody as ApplicationCommandDataResolvable[])\n .catch((error) => {\n throw new Error(\n colors.red(\n `Error ${reloading ? 'reloading' : 'loading'} global application commands.\\n`,\n ),\n error,\n );\n });\n\n console.log(\n colors.green(`${reloading ? 'Reloaded' : 'Loaded'} ${requestBody.length} global commands.`),\n );\n}\n\n/**\n * Load commands for dev guilds.\n * @param client - The discord.js client instance.\n * @param commands - An array of command file objects.\n * @param guildIds - An array of developer guild IDs.\n * @param reloading - A boolean indicating whether the commands are reloading.\n */\nasync function loadDevCommands(\n client: Client<true>,\n commands: CommandFileObject[],\n guildIds: string[],\n reloading?: boolean,\n) {\n const requestBody = commands.map((cmd) => cmd.data);\n\n for (const guildId of guildIds) {\n const targetGuild =\n client.guilds.cache.get(guildId) || (await client.guilds.fetch(guildId));\n\n if (!targetGuild) {\n process.emitWarning(\n `Cannot ${\n reloading ? 'reload' : 'load'\n } commands in guild \"${guildId}\" - guild doesn't exist or client isn't part of the guild.`,\n );\n\n continue;\n }\n\n await targetGuild.commands\n .set(requestBody as ApplicationCommandDataResolvable[])\n .catch((error) => {\n throw new Error(\n colors.red(\n `Error ${\n reloading ? 'reloading' : 'loading'\n } developer application commands in guild \"${\n targetGuild?.name || guildId\n }\".\\n`,\n ),\n error,\n );\n });\n\n console.log(\n colors.green(\n `${reloading ? 'Reloaded' : 'Loaded'} ${\n requestBody.length\n } developer commands in guild \"${targetGuild.name}\".`,\n ),\n );\n }\n}\n","const resetColor = '\\x1b[0m';\n\nexport default {\n reset: (text: string) => `${text}${resetColor}`,\n bright: (text: string) => `\\x1b[1m${text}${resetColor}`,\n dim: (text: string) => `\\x1b[2m${text}${resetColor}`,\n underscore: (text: string) => `\\x1b[4m${text}${resetColor}`,\n blink: (text: string) => `\\x1b[5m${text}${resetColor}`,\n reverse: (text: string) => `\\x1b[7m${text}${resetColor}`,\n hidden: (text: string) => `\\x1b[8m${text}${resetColor}`,\n\n black: (text: string) => `\\x1b[30m${text}${resetColor}`,\n red: (text: string) => `\\x1b[31m${text}${resetColor}`,\n green: (text: string) => `\\x1b[32m${text}${resetColor}`,\n yellow: (text: string) => `\\x1b[33m${text}${resetColor}`,\n blue: (text: string) => `\\x1b[34m${text}${resetColor}`,\n magenta: (text: string) => `\\x1b[35m${text}${resetColor}`,\n cyan: (text: string) => `\\x1b[36m${text}${resetColor}`,\n white: (text: string) => `\\x1b[37m${text}${resetColor}`,\n\n bgBlack: (text: string) => `\\x1b[40m${text}${resetColor}`,\n bgRed: (text: string) => `\\x1b[41m${text}${resetColor}`,\n bgGreen: (text: string) => `\\x1b[42m${text}${resetColor}`,\n bgYellow: (text: string) => `\\x1b[43m${text}${resetColor}`,\n bgBlue: (text: string) => `\\x1b[44m${text}${resetColor}`,\n bgMagenta: (text: string) => `\\x1b[45m${text}${resetColor}`,\n bgCyan: (text: string) => `\\x1b[46m${text}${resetColor}`,\n bgWhite: (text: string) => `\\x1b[47m${text}${resetColor}`,\n};\n"],"mappings":"ouBAAA,wKCAA,IAAM,WAAa,UAEZ,eAAQ,CACX,MAAQ,MAAiB,GAAG,IAAI,GAAG,UAAU,GAC7C,OAAS,MAAiB,UAAU,IAAI,GAAG,UAAU,GACrD,IAAM,MAAiB,UAAU,IAAI,GAAG,UAAU,GAClD,WAAa,MAAiB,UAAU,IAAI,GAAG,UAAU,GACzD,MAAQ,MAAiB,UAAU,IAAI,GAAG,UAAU,GACpD,QAAU,MAAiB,UAAU,IAAI,GAAG,UAAU,GACtD,OAAS,MAAiB,UAAU,IAAI,GAAG,UAAU,GAErD,MAAQ,MAAiB,WAAW,IAAI,GAAG,UAAU,GACrD,IAAM,MAAiB,WAAW,IAAI,GAAG,UAAU,GACnD,MAAQ,MAAiB,WAAW,IAAI,GAAG,UAAU,GACrD,OAAS,MAAiB,WAAW,IAAI,GAAG,UAAU,GACtD,KAAO,MAAiB,WAAW,IAAI,GAAG,UAAU,GACpD,QAAU,MAAiB,WAA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nBe,sCA2Bf,eAAe,mBACX,OACA,SACA,UACF,CACE,IAAM,YAAc,SAAS,IAAK,KAAQ,IAAI,IAAI,EAElD,MAAM,OAAO,YAAY,SACpB,IAAI,WAAiD,EACrD,MAAO,OAAU,CACd,MAAM,IAAI,MACN,eAAO,IACH,SAAS,UAAY,YAAc,SAAS;AAAA,CAChD,EACA,KACJ,CACJ,CAAC,EAEL,QAAQ,IACJ,eAAO,MAAM,GAAG,UAAY,WAAa,QAAQ,IAAI,YAAY,MAAM,mBAAmB,CAC9F,CACJ,CArBe,gDA8Bf,eAAe,gBACX,OACA,SACA,SACA,UACF,CACE,IAAM,YAAc,SAAS,IAAK,KAAQ,IAAI,IAAI,EAElD,QAAW,WAAW,SAAU,CAC5B,IAAM,YACF,OAAO,OAAO,MAAM,IAAI,OAAO,GAAM,MAAM,OAAO,OAAO,MAAM,OAAO,EAE1E,GAAI,CAAC,YAAa,CACd,QAAQ,YACJ,UACI,UAAY,SAAW,MAC3B,uBAAuB,OAAO,4DAClC,EAEA,QACJ,CAEA,MAAM,YAAY,SACb,IAAI,WAAiD,EACrD,MAAO,OAAU,CACd,MAAM,IAAI,MACN,eAAO,IACH,SACI,UAAY,YAAc,SAC9B,6CACI,aAAa,MAAQ,OACzB;AAAA,CACJ,EACA,KACJ,CACJ,CAAC,EAEL,QAAQ,IACJ,eAAO,MACH,GAAG,UAAY,WAAa,QAAQ,IAChC,YAAY,MAChB,iCAAiC,YAAY,IAAI,IACrD,CACJ,CACJ,CACJ,CA7Ce","names":[]}
@@ -0,0 +1,2 @@
1
+ import{loadCommandsWithRest}from"../../../chunk-5NCNVJD5.mjs";import"../../../chunk-DJGEQTVH.mjs";import"../../../chunk-7KD7ZCH6.mjs";export{loadCommandsWithRest as default};
2
+ //# sourceMappingURL=loadCommandsWithRest.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":[],"sourcesContent":[],"mappings":"","names":[]}
@@ -0,0 +1,20 @@
1
+ import { Client } from 'discord.js';
2
+ import { i as CommandFileObject, j as ReloadOptions } from '../../../CommandKit--SA9LcIq.mjs';
3
+ import '../../validation-handler/ValidationHandler.mjs';
4
+ import '../../validation-handler/typings.mjs';
5
+ import 'async_hooks';
6
+
7
+ type RegisterCommandProps = {
8
+ client: Client;
9
+ commands: CommandFileObject[];
10
+ devGuildIds: string[];
11
+ reloading?: boolean;
12
+ type?: ReloadOptions;
13
+ };
14
+ /**
15
+ * Register client commands to Discord.
16
+ * @param props
17
+ */
18
+ declare function registerCommands(props: RegisterCommandProps): Promise<void>;
19
+
20
+ export { registerCommands as default };