commandkit 0.1.11-dev.20250128160021 → 0.1.11-dev.20250128162551

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 (188) hide show
  1. package/bin/index.mjs +2 -50
  2. package/dist/CommandKit.js +6 -6
  3. package/dist/CommandKit.js.map +1 -1
  4. package/dist/CommandKit.mjs +1 -1
  5. package/dist/cache/CacheProvider.js +1 -1
  6. package/dist/cache/CacheProvider.js.map +1 -1
  7. package/dist/cache/CacheProvider.mjs +1 -1
  8. package/dist/cache/MemoryCache.js +1 -1
  9. package/dist/cache/MemoryCache.js.map +1 -1
  10. package/dist/cache/MemoryCache.mjs +1 -1
  11. package/dist/cache/cache.js +6 -6
  12. package/dist/cache/cache.js.map +1 -1
  13. package/dist/cache/cache.mjs +1 -1
  14. package/dist/cache/index.js +6 -6
  15. package/dist/cache/index.js.map +1 -1
  16. package/dist/cache/index.mjs +1 -1
  17. package/dist/chunk-35OSBS47.mjs +2 -0
  18. package/dist/chunk-6ZU6MOKA.mjs +2 -0
  19. package/dist/chunk-73NFQRKA.mjs +7 -0
  20. package/dist/{chunk-XJCWZEWC.mjs.map → chunk-73NFQRKA.mjs.map} +1 -1
  21. package/dist/chunk-B5T552SB.mjs +2 -0
  22. package/dist/{chunk-4OV4GE7B.mjs.map → chunk-B5T552SB.mjs.map} +1 -1
  23. package/dist/{chunk-6AX5YJEO.mjs → chunk-BNTMQC76.mjs} +2 -2
  24. package/dist/{chunk-DW5KRS5H.mjs → chunk-DTKEXOZL.mjs} +3 -3
  25. package/dist/{chunk-DW5KRS5H.mjs.map → chunk-DTKEXOZL.mjs.map} +1 -1
  26. package/dist/chunk-FC5WQLBI.mjs +3 -0
  27. package/dist/chunk-FC5WQLBI.mjs.map +1 -0
  28. package/dist/{chunk-4CG7S6RY.mjs → chunk-ICJ4BBWI.mjs} +2 -2
  29. package/dist/chunk-IRBJOQ7G.mjs +2 -0
  30. package/dist/{chunk-CO2EZ53K.mjs.map → chunk-IRBJOQ7G.mjs.map} +1 -1
  31. package/dist/chunk-JYUG7HAX.mjs +2 -0
  32. package/dist/{chunk-Z4FBPRS6.mjs.map → chunk-JYUG7HAX.mjs.map} +1 -1
  33. package/dist/chunk-KAJRRZVI.mjs +2 -0
  34. package/dist/{chunk-5KRNT4BG.mjs.map → chunk-KAJRRZVI.mjs.map} +1 -1
  35. package/dist/chunk-LQPVE73I.mjs +2 -0
  36. package/dist/{chunk-RGQOLRR6.mjs.map → chunk-LQPVE73I.mjs.map} +1 -1
  37. package/dist/{chunk-6W2KY7FK.mjs → chunk-PTP2L33V.mjs} +2 -2
  38. package/dist/{chunk-C6WU57FQ.mjs → chunk-QXMWKQIO.mjs} +2 -2
  39. package/dist/{chunk-CKNUFVNV.mjs → chunk-R4SWJR4N.mjs} +2 -2
  40. package/dist/chunk-RQ3ABUE3.mjs +2 -0
  41. package/dist/chunk-RQ3ABUE3.mjs.map +1 -0
  42. package/dist/{chunk-6BSP7AD3.mjs → chunk-RVGLG66X.mjs} +2 -2
  43. package/dist/chunk-SI3L34FF.mjs +2 -0
  44. package/dist/{chunk-UPJYI5Q6.mjs.map → chunk-SI3L34FF.mjs.map} +1 -1
  45. package/dist/chunk-TEL2J6LT.mjs +2 -0
  46. package/dist/{chunk-WNEBLBID.mjs.map → chunk-TEL2J6LT.mjs.map} +1 -1
  47. package/dist/chunk-ULPF2QCW.mjs +2 -0
  48. package/dist/chunk-ULPF2QCW.mjs.map +1 -0
  49. package/dist/{chunk-J7CCGFUZ.mjs → chunk-UP6ACDGE.mjs} +2 -2
  50. package/dist/{chunk-J7CCGFUZ.mjs.map → chunk-UP6ACDGE.mjs.map} +1 -1
  51. package/dist/chunk-UYDZJJZT.mjs +4 -0
  52. package/dist/{chunk-K43A7OIY.mjs.map → chunk-UYDZJJZT.mjs.map} +1 -1
  53. package/dist/chunk-WZU7OSUV.mjs +13 -0
  54. package/dist/chunk-WZU7OSUV.mjs.map +1 -0
  55. package/dist/chunk-Y522NY4J.mjs +2 -0
  56. package/dist/chunk-Y522NY4J.mjs.map +1 -0
  57. package/dist/chunk-ZCUZ5ENB.mjs +2 -0
  58. package/dist/chunk-ZCUZ5ENB.mjs.map +1 -0
  59. package/dist/cli/build.d.mts +4 -0
  60. package/dist/cli/build.d.ts +4 -0
  61. package/dist/cli/build.js +14 -0
  62. package/dist/cli/build.js.map +1 -0
  63. package/dist/cli/build.mjs +2 -0
  64. package/dist/cli/build.mjs.map +1 -0
  65. package/dist/cli/common.d.mts +35 -0
  66. package/dist/cli/common.d.ts +35 -0
  67. package/dist/cli/common.js +3 -0
  68. package/dist/cli/common.js.map +1 -0
  69. package/dist/cli/common.mjs +2 -0
  70. package/dist/cli/common.mjs.map +1 -0
  71. package/dist/cli/development.d.mts +3 -0
  72. package/dist/cli/development.d.ts +3 -0
  73. package/dist/cli/development.js +17 -0
  74. package/dist/cli/development.js.map +1 -0
  75. package/dist/cli/development.mjs +7 -0
  76. package/dist/cli/development.mjs.map +1 -0
  77. package/dist/cli/esbuild-plugins/plugin.d.mts +10 -0
  78. package/dist/cli/esbuild-plugins/plugin.d.ts +10 -0
  79. package/dist/cli/esbuild-plugins/plugin.js +2 -0
  80. package/dist/cli/esbuild-plugins/plugin.js.map +1 -0
  81. package/dist/cli/esbuild-plugins/plugin.mjs +2 -0
  82. package/dist/cli/esbuild-plugins/plugin.mjs.map +1 -0
  83. package/dist/cli/esbuild-plugins/use-cache.d.mts +6 -0
  84. package/dist/cli/esbuild-plugins/use-cache.d.ts +6 -0
  85. package/dist/cli/esbuild-plugins/use-cache.js +2 -0
  86. package/dist/cli/esbuild-plugins/use-cache.js.map +1 -0
  87. package/dist/cli/esbuild-plugins/use-cache.mjs +2 -0
  88. package/dist/cli/esbuild-plugins/use-cache.mjs.map +1 -0
  89. package/dist/cli/init.d.mts +10 -0
  90. package/dist/cli/init.d.ts +10 -0
  91. package/dist/cli/init.js +20 -0
  92. package/dist/cli/init.js.map +1 -0
  93. package/dist/cli/init.mjs +2 -0
  94. package/dist/cli/init.mjs.map +1 -0
  95. package/dist/cli/parse-env.d.mts +3 -0
  96. package/dist/cli/parse-env.d.ts +3 -0
  97. package/dist/cli/parse-env.js +2 -0
  98. package/dist/cli/parse-env.js.map +1 -0
  99. package/dist/cli/parse-env.mjs +2 -0
  100. package/dist/cli/parse-env.mjs.map +1 -0
  101. package/dist/cli/production.d.mts +3 -0
  102. package/dist/cli/production.d.ts +3 -0
  103. package/dist/cli/production.js +4 -0
  104. package/dist/cli/production.js.map +1 -0
  105. package/dist/cli/production.mjs +3 -0
  106. package/dist/cli/production.mjs.map +1 -0
  107. package/dist/components/ButtonKit.js +1 -1
  108. package/dist/components/ButtonKit.js.map +1 -1
  109. package/dist/components/ButtonKit.mjs +1 -1
  110. package/dist/components/index.js +1 -1
  111. package/dist/components/index.js.map +1 -1
  112. package/dist/components/index.mjs +1 -1
  113. package/dist/config.mjs +1 -1
  114. package/dist/context/async-context.js +6 -6
  115. package/dist/context/async-context.js.map +1 -1
  116. package/dist/context/async-context.mjs +1 -1
  117. package/dist/context/environment.js +1 -1
  118. package/dist/context/environment.js.map +1 -1
  119. package/dist/context/environment.mjs +1 -1
  120. package/dist/handlers/command-handler/CommandHandler.js +6 -6
  121. package/dist/handlers/command-handler/CommandHandler.js.map +1 -1
  122. package/dist/handlers/command-handler/CommandHandler.mjs +1 -1
  123. package/dist/handlers/command-handler/functions/loadCommandsWithRest.js +2 -2
  124. package/dist/handlers/command-handler/functions/loadCommandsWithRest.js.map +1 -1
  125. package/dist/handlers/command-handler/functions/loadCommandsWithRest.mjs +1 -1
  126. package/dist/handlers/command-handler/functions/registerCommands.js +2 -2
  127. package/dist/handlers/command-handler/functions/registerCommands.js.map +1 -1
  128. package/dist/handlers/command-handler/functions/registerCommands.mjs +1 -1
  129. package/dist/handlers/command-handler/utils/areSlashCommandsDifferent.mjs +1 -1
  130. package/dist/handlers/command-handler/validations/devOnly.js +1 -1
  131. package/dist/handlers/command-handler/validations/devOnly.js.map +1 -1
  132. package/dist/handlers/command-handler/validations/devOnly.mjs +1 -1
  133. package/dist/handlers/command-handler/validations/index.js +1 -1
  134. package/dist/handlers/command-handler/validations/index.js.map +1 -1
  135. package/dist/handlers/command-handler/validations/index.mjs +1 -1
  136. package/dist/handlers/command-handler/validations/permissions.js +1 -1
  137. package/dist/handlers/command-handler/validations/permissions.js.map +1 -1
  138. package/dist/handlers/command-handler/validations/permissions.mjs +1 -1
  139. package/dist/handlers/event-handler/EventHandler.js +1 -1
  140. package/dist/handlers/event-handler/EventHandler.js.map +1 -1
  141. package/dist/handlers/event-handler/EventHandler.mjs +1 -1
  142. package/dist/handlers/index.js +6 -6
  143. package/dist/handlers/index.js.map +1 -1
  144. package/dist/handlers/index.mjs +1 -1
  145. package/dist/handlers/validation-handler/ValidationHandler.js +1 -1
  146. package/dist/handlers/validation-handler/ValidationHandler.js.map +1 -1
  147. package/dist/handlers/validation-handler/ValidationHandler.mjs +1 -1
  148. package/dist/index.d.mts +2 -0
  149. package/dist/index.d.ts +2 -0
  150. package/dist/index.js +24 -6
  151. package/dist/index.js.map +1 -1
  152. package/dist/index.mjs +1 -1
  153. package/dist/index.mjs.map +1 -1
  154. package/dist/types.mjs +1 -1
  155. package/dist/utils/clone.mjs +1 -1
  156. package/dist/utils/colors.mjs +1 -1
  157. package/dist/utils/constants.mjs +1 -1
  158. package/dist/utils/error-codes.mjs +1 -1
  159. package/dist/utils/get-paths.mjs +1 -1
  160. package/dist/utils/resolve-file-url.mjs +1 -1
  161. package/dist/utils/warn-unstable.mjs +1 -1
  162. package/package.json +3 -13
  163. package/bin/build.mjs +0 -129
  164. package/bin/common.mjs +0 -125
  165. package/bin/development.mjs +0 -187
  166. package/bin/esbuild-plugins/plugin.mjs +0 -74
  167. package/bin/esbuild-plugins/use-cache.mjs +0 -160
  168. package/bin/parse-env.mjs +0 -65
  169. package/bin/production.mjs +0 -86
  170. package/dist/chunk-4OV4GE7B.mjs +0 -2
  171. package/dist/chunk-5KRNT4BG.mjs +0 -2
  172. package/dist/chunk-6TIBWNPX.mjs +0 -2
  173. package/dist/chunk-6TIGKCSX.mjs +0 -2
  174. package/dist/chunk-CO2EZ53K.mjs +0 -2
  175. package/dist/chunk-K43A7OIY.mjs +0 -4
  176. package/dist/chunk-RGQOLRR6.mjs +0 -2
  177. package/dist/chunk-UPJYI5Q6.mjs +0 -2
  178. package/dist/chunk-WNEBLBID.mjs +0 -2
  179. package/dist/chunk-XJCWZEWC.mjs +0 -7
  180. package/dist/chunk-Z4FBPRS6.mjs +0 -2
  181. /package/dist/{chunk-6TIBWNPX.mjs.map → chunk-35OSBS47.mjs.map} +0 -0
  182. /package/dist/{chunk-6TIGKCSX.mjs.map → chunk-6ZU6MOKA.mjs.map} +0 -0
  183. /package/dist/{chunk-6AX5YJEO.mjs.map → chunk-BNTMQC76.mjs.map} +0 -0
  184. /package/dist/{chunk-4CG7S6RY.mjs.map → chunk-ICJ4BBWI.mjs.map} +0 -0
  185. /package/dist/{chunk-6W2KY7FK.mjs.map → chunk-PTP2L33V.mjs.map} +0 -0
  186. /package/dist/{chunk-C6WU57FQ.mjs.map → chunk-QXMWKQIO.mjs.map} +0 -0
  187. /package/dist/{chunk-CKNUFVNV.mjs.map → chunk-R4SWJR4N.mjs.map} +0 -0
  188. /package/dist/{chunk-6BSP7AD3.mjs.map → chunk-RVGLG66X.mjs.map} +0 -0
@@ -1,4 +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:__name(text=>`${text}${resetColor}`,"reset"),bright:__name(text=>`\x1B[1m${text}${resetColor}`,"bright"),dim:__name(text=>`\x1B[2m${text}${resetColor}`,"dim"),underscore:__name(text=>`\x1B[4m${text}${resetColor}`,"underscore"),blink:__name(text=>`\x1B[5m${text}${resetColor}`,"blink"),reverse:__name(text=>`\x1B[7m${text}${resetColor}`,"reverse"),hidden:__name(text=>`\x1B[8m${text}${resetColor}`,"hidden"),black:__name(text=>`\x1B[30m${text}${resetColor}`,"black"),red:__name(text=>`\x1B[31m${text}${resetColor}`,"red"),green:__name(text=>`\x1B[32m${text}${resetColor}`,"green"),yellow:__name(text=>`\x1B[33m${text}${resetColor}`,"yellow"),blue:__name(text=>`\x1B[34m${text}${resetColor}`,"blue"),magenta:__name(text=>`\x1B[35m${text}${resetColor}`,"magenta"),cyan:__name(text=>`\x1B[36m${text}${resetColor}`,"cyan"),white:__name(text=>`\x1B[37m${text}${resetColor}`,"white"),bgBlack:__name(text=>`\x1B[40m${text}${resetColor}`,"bgBlack"),bgRed:__name(text=>`\x1B[41m${text}${resetColor}`,"bgRed"),bgGreen:__name(text=>`\x1B[42m${text}${resetColor}`,"bgGreen"),bgYellow:__name(text=>`\x1B[43m${text}${resetColor}`,"bgYellow"),bgBlue:__name(text=>`\x1B[44m${text}${resetColor}`,"bgBlue"),bgMagenta:__name(text=>`\x1B[45m${text}${resetColor}`,"bgMagenta"),bgCyan:__name(text=>`\x1B[46m${text}${resetColor}`,"bgCyan"),bgWhite:__name(text=>`\x1B[47m${text}${resetColor}`,"bgWhite")};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}".
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:__name(text=>`${text}${resetColor}`,"reset"),bright:__name(text=>`\x1B[1m${text}${resetColor}`,"bright"),dim:__name(text=>`\x1B[2m${text}${resetColor}`,"dim"),underscore:__name(text=>`\x1B[4m${text}${resetColor}`,"underscore"),blink:__name(text=>`\x1B[5m${text}${resetColor}`,"blink"),reverse:__name(text=>`\x1B[7m${text}${resetColor}`,"reverse"),hidden:__name(text=>`\x1B[8m${text}${resetColor}`,"hidden"),black:__name(text=>`\x1B[30m${text}${resetColor}`,"black"),red:__name(text=>`\x1B[31m${text}${resetColor}`,"red"),green:__name(text=>`\x1B[32m${text}${resetColor}`,"green"),yellow:__name(text=>`\x1B[33m${text}${resetColor}`,"yellow"),blue:__name(text=>`\x1B[34m${text}${resetColor}`,"blue"),magenta:__name(text=>`\x1B[35m${text}${resetColor}`,"magenta"),cyan:__name(text=>`\x1B[36m${text}${resetColor}`,"cyan"),white:__name(text=>`\x1B[37m${text}${resetColor}`,"white"),bgBlack:__name(text=>`\x1B[40m${text}${resetColor}`,"bgBlack"),bgRed:__name(text=>`\x1B[41m${text}${resetColor}`,"bgRed"),bgGreen:__name(text=>`\x1B[42m${text}${resetColor}`,"bgGreen"),bgYellow:__name(text=>`\x1B[43m${text}${resetColor}`,"bgYellow"),bgBlue:__name(text=>`\x1B[44m${text}${resetColor}`,"bgBlue"),bgMagenta:__name(text=>`\x1B[45m${text}${resetColor}`,"bgMagenta"),bgCyan:__name(text=>`\x1B[46m${text}${resetColor}`,"bgCyan"),bgWhite:__name(text=>`\x1B[47m${text}${resetColor}`,"bgWhite")};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=>{var _a;return!((_a=cmd.options)!=null&&_a.deleted)});let devOnlyCommands=commands.filter(cmd=>{var _a;return(_a=cmd.options)==null?void 0:_a.devOnly}),globalCommands=commands.filter(cmd=>{var _a;return!((_a=cmd.options)!=null&&_a.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==null?void 0:targetGuild.name)||guildId}".
3
3
  `),error)}),console.log(colors_default.green(`${reloading?"Reloaded":"Loaded"} ${requestBody.length} developer commands in guild "${targetGuild.name}".`))}}__name(loadDevCommands,"loadDevCommands");
4
4
  //# sourceMappingURL=loadCommandsWithRest.js.map
@@ -1 +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 '../../../types';\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(\nprops: LoadCommandsWithRestProps)\n{\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(\n colors.red(`Cannot reload commands when client is not ready.`)\n );\n }\n } else {\n props.client.once('ready', async (c) => {\n await handleLoading(\n c,\n props.commands,\n props.devGuildIds,\n props.reloading,\n props.type\n );\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(\nclient: Client<true>,\ncommands: CommandFileObject[],\ndevGuildIds: string[],\nreloading?: boolean,\ntype?: 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(\nclient: Client<true>,\ncommands: CommandFileObject[],\nreloading?: 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 ${\n reloading ? 'reloading' : 'loading'} global application commands.\\n`\n\n ),\n error\n );\n });\n\n console.log(\n colors.green(\n `${reloading ? 'Reloaded' : 'Loaded'} ${\n requestBody.length} global commands.`\n\n )\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(\nclient: Client<true>,\ncommands: CommandFileObject[],\nguildIds: string[],\nreloading?: 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'} commands in guild \"${\n 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'} developer application commands in guild \"${\n\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} developer commands in guild \"${\n targetGuild.name}\".`\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};"],"mappings":"ouBAAA,wKCAA,IAAM,WAAa,UAEZ,eAAQ,CACb,MAAO,OAAC,MAAiB,GAAG,IAAI,GAAG,UAAU,GAAtC,SACP,OAAQ,OAAC,MAAiB,UAAU,IAAI,GAAG,UAAU,GAA7C,UACR,IAAK,OAAC,MAAiB,UAAU,IAAI,GAAG,UAAU,GAA7C,OACL,WAAY,OAAC,MAAiB,UAAU,IAAI,GAAG,UAAU,GAA7C,cACZ,MAAO,OAAC,MAAiB,UAAU,IAAI,GAAG,UAAU,GAA7C,SACP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R,eAAO,IACL,SACA,UAAY,YAAc,SAAS,6CAEnC,aAAa,MAAQ,OAAO;AAAA,CAE9B,EACA,KACF,CACF,CAAC,EAED,QAAQ,IACN,eAAO,MACL,GAAG,UAAY,WAAa,QAAQ,IACpC,YAAY,MAAM,iCAClB,YAAY,IAAI,IAClB,CACF,CACF,CACF,CA7Ce","names":[]}
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 '../../../types';\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(\nprops: LoadCommandsWithRestProps)\n{\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(\n colors.red(`Cannot reload commands when client is not ready.`)\n );\n }\n } else {\n props.client.once('ready', async (c) => {\n await handleLoading(\n c,\n props.commands,\n props.devGuildIds,\n props.reloading,\n props.type\n );\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(\nclient: Client<true>,\ncommands: CommandFileObject[],\ndevGuildIds: string[],\nreloading?: boolean,\ntype?: 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(\nclient: Client<true>,\ncommands: CommandFileObject[],\nreloading?: 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 ${\n reloading ? 'reloading' : 'loading'} global application commands.\\n`\n\n ),\n error\n );\n });\n\n console.log(\n colors.green(\n `${reloading ? 'Reloaded' : 'Loaded'} ${\n requestBody.length} global commands.`\n\n )\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(\nclient: Client<true>,\ncommands: CommandFileObject[],\nguildIds: string[],\nreloading?: 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'} commands in guild \"${\n 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'} developer application commands in guild \"${\n\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} developer commands in guild \"${\n targetGuild.name}\".`\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};"],"mappings":"ouBAAA,wKCAA,IAAM,WAAa,UAEZ,eAAQ,CACb,MAAO,OAAC,MAAiB,GAAG,IAAI,GAAG,UAAU,GAAtC,SACP,OAAQ,OAAC,MAAiB,UAAU,IAAI,GAAG,UAAU,GAA7C,UACR,IAA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AAO,MAAM,IAAI,OAAO,GAAM,MAAM,OAAO,OAAO,MAAM,OAAO,EAEtE,GAAI,CAAC,YAAa,CAChB,QAAQ,YACN,UACA,UAAY,SAAW,MAAM,uBAC7B,OAAO,4DACT,EAEA,QACF,CAEA,MAAM,YAAY,SAClB,IAAI,WAAiD,EACrD,MAAO,OAAU,CACf,MAAM,IAAI,MACR,eAAO,IACL,SACA,UAAY,YAAc,SAAS,8CAEnC,qCAAa,OAAQ,OAAO;AAAA,CAE9B,EACA,KACF,CACF,CAAC,EAED,QAAQ,IACN,eAAO,MACL,GAAG,UAAY,WAAa,QAAQ,IACpC,YAAY,MAAM,iCAClB,YAAY,IAAI,IAClB,CACF,CACF,CACF,CA7Ce","names":[]}
@@ -1,2 +1,2 @@
1
- import{loadCommandsWithRest}from"../../../chunk-DW5KRS5H.mjs";import"../../../chunk-C6WU57FQ.mjs";import"../../../chunk-6TIBWNPX.mjs";export{loadCommandsWithRest as default};
1
+ import{loadCommandsWithRest}from"../../../chunk-DTKEXOZL.mjs";import"../../../chunk-QXMWKQIO.mjs";import"../../../chunk-35OSBS47.mjs";export{loadCommandsWithRest as default};
2
2
  //# sourceMappingURL=loadCommandsWithRest.mjs.map
@@ -1,7 +1,7 @@
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 registerCommands_exports={};__export(registerCommands_exports,{default:()=>registerCommands});module.exports=__toCommonJS(registerCommands_exports);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");var resetColor="\x1B[0m",colors_default={reset:__name(text=>`${text}${resetColor}`,"reset"),bright:__name(text=>`\x1B[1m${text}${resetColor}`,"bright"),dim:__name(text=>`\x1B[2m${text}${resetColor}`,"dim"),underscore:__name(text=>`\x1B[4m${text}${resetColor}`,"underscore"),blink:__name(text=>`\x1B[5m${text}${resetColor}`,"blink"),reverse:__name(text=>`\x1B[7m${text}${resetColor}`,"reverse"),hidden:__name(text=>`\x1B[8m${text}${resetColor}`,"hidden"),black:__name(text=>`\x1B[30m${text}${resetColor}`,"black"),red:__name(text=>`\x1B[31m${text}${resetColor}`,"red"),green:__name(text=>`\x1B[32m${text}${resetColor}`,"green"),yellow:__name(text=>`\x1B[33m${text}${resetColor}`,"yellow"),blue:__name(text=>`\x1B[34m${text}${resetColor}`,"blue"),magenta:__name(text=>`\x1B[35m${text}${resetColor}`,"magenta"),cyan:__name(text=>`\x1B[36m${text}${resetColor}`,"cyan"),white:__name(text=>`\x1B[37m${text}${resetColor}`,"white"),bgBlack:__name(text=>`\x1B[40m${text}${resetColor}`,"bgBlack"),bgRed:__name(text=>`\x1B[41m${text}${resetColor}`,"bgRed"),bgGreen:__name(text=>`\x1B[42m${text}${resetColor}`,"bgGreen"),bgYellow:__name(text=>`\x1B[43m${text}${resetColor}`,"bgYellow"),bgBlue:__name(text=>`\x1B[44m${text}${resetColor}`,"bgBlue"),bgMagenta:__name(text=>`\x1B[45m${text}${resetColor}`,"bgMagenta"),bgCyan:__name(text=>`\x1B[46m${text}${resetColor}`,"bgCyan"),bgWhite:__name(text=>`\x1B[47m${text}${resetColor}`,"bgWhite")};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.
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 registerCommands_exports={};__export(registerCommands_exports,{default:()=>registerCommands});module.exports=__toCommonJS(registerCommands_exports);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");var resetColor="\x1B[0m",colors_default={reset:__name(text=>`${text}${resetColor}`,"reset"),bright:__name(text=>`\x1B[1m${text}${resetColor}`,"bright"),dim:__name(text=>`\x1B[2m${text}${resetColor}`,"dim"),underscore:__name(text=>`\x1B[4m${text}${resetColor}`,"underscore"),blink:__name(text=>`\x1B[5m${text}${resetColor}`,"blink"),reverse:__name(text=>`\x1B[7m${text}${resetColor}`,"reverse"),hidden:__name(text=>`\x1B[8m${text}${resetColor}`,"hidden"),black:__name(text=>`\x1B[30m${text}${resetColor}`,"black"),red:__name(text=>`\x1B[31m${text}${resetColor}`,"red"),green:__name(text=>`\x1B[32m${text}${resetColor}`,"green"),yellow:__name(text=>`\x1B[33m${text}${resetColor}`,"yellow"),blue:__name(text=>`\x1B[34m${text}${resetColor}`,"blue"),magenta:__name(text=>`\x1B[35m${text}${resetColor}`,"magenta"),cyan:__name(text=>`\x1B[36m${text}${resetColor}`,"cyan"),white:__name(text=>`\x1B[37m${text}${resetColor}`,"white"),bgBlack:__name(text=>`\x1B[40m${text}${resetColor}`,"bgBlack"),bgRed:__name(text=>`\x1B[41m${text}${resetColor}`,"bgRed"),bgGreen:__name(text=>`\x1B[42m${text}${resetColor}`,"bgGreen"),bgYellow:__name(text=>`\x1B[43m${text}${resetColor}`,"bgYellow"),bgBlue:__name(text=>`\x1B[44m${text}${resetColor}`,"bgBlue"),bgMagenta:__name(text=>`\x1B[45m${text}${resetColor}`,"bgMagenta"),bgCyan:__name(text=>`\x1B[46m${text}${resetColor}`,"bgCyan"),bgWhite:__name(text=>`\x1B[47m${text}${resetColor}`,"bgWhite")};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=>{var _a;return(_a=cmd.options)==null?void 0:_a.devOnly}),globalCommands=commands.filter(cmd=>{var _a;return!((_a=cmd.options)!=null&&_a.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){var _a;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((_a=command.options)!=null&&_a.deleted){targetCommand?(await targetCommand.delete().catch(error=>{throw new Error(colors_default.red(`Failed to delete command "${command.data.name}" globally.
2
2
  `),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.
3
3
  `),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.
4
- `),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}.
4
+ `),error)}),console.log(colors_default.green(`Registered command "${command.data.name}" globally.`)))}}__name(registerGlobalCommands,"registerGlobalCommands");async function registerDevCommands(client,commands,guildIds){var _a;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((_a=command.options)!=null&&_a.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}.
5
5
  `),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}.
6
6
  `),error)}),console.log(colors_default.green(`Registered command "${command.data.name}" in ${guildCommands.guild.name}.`)))}}__name(registerDevCommands,"registerDevCommands");
7
7
  //# sourceMappingURL=registerCommands.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/handlers/command-handler/functions/registerCommands.ts","../../../../src/handlers/command-handler/utils/areSlashCommandsDifferent.ts","../../../../src/utils/colors.ts"],"sourcesContent":["import type {\n Guild,\n Client,\n ApplicationCommandData,\n GuildApplicationCommandManager,\n ApplicationCommandDataResolvable } from\n'discord.js';\nimport type { CommandFileObject, ReloadOptions } from '../../../types';\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(\n props.client,\n props.commands,\n props.devGuildIds,\n props.type\n );\n } else {\n throw new Error(\n colors.red(`Cannot reload commands when client is not ready.`)\n );\n }\n } else {\n props.client.once('ready', async (c) => {\n await handleRegistration(\n c,\n props.commands,\n props.devGuildIds,\n props.type\n );\n });\n }\n}\n\nasync function handleRegistration(\nclient: Client<true>,\ncommands: CommandFileObject[],\ndevGuildIds: string[],\ntype?: 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(\nclient: Client<true>,\ncommands: CommandFileObject[])\n{\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(\n `Failed to delete command \"${command.data.name}\" globally.\\n`\n ),\n error\n );\n });\n\n console.log(\n colors.green(`Deleted command \"${command.data.name}\" globally.`)\n );\n }\n\n continue;\n }\n\n // <!-- Edit global command -->\n if (targetCommand) {\n const commandsAreDifferent = areSlashCommandsDifferent(\n targetCommand,\n command.data\n );\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}\" globally.\\n`\n ),\n error\n );\n });\n\n console.log(\n colors.green(`Edited command \"${command.data.name}\" globally.`)\n );\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(\n `Failed to register command \"${command.data.name}\" globally.\\n`\n ),\n error\n );\n });\n\n console.log(\n colors.green(`Registered command \"${command.data.name}\" globally.`)\n );\n }\n}\n\nasync function registerDevCommands(\nclient: Client<true>,\ncommands: CommandFileObject[],\nguildIds: string[])\n{\n const devGuilds: Guild[] = [];\n\n for (const guildId of guildIds) {\n const guild =\n 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(\n (cmd) => cmd.name === command.data.name\n );\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(\n targetCommand,\n command.data\n );\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 * 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(\nappCommand: any,\nlocalCommand: any)\n{\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}","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};"],"mappings":"ouBAAA,wJCMe,SAAR,0BACP,WACA,aACA,CAOE,GANK,WAAW,UAAS,WAAW,QAAU,CAAC,GAC1C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,IAAM,cAAgB,cAAc,MAAM,KACvC,KAAQ,IAAI,OAAS,QAAQ,KAAK,IACrC,EAGA,GAAI,QAAQ,SAAS,QAAS,CACvB,eAOH,MAAM,cAAc,OAAO,EAAE,MAAO,OAAU,CAC5C,MAAM,IAAI,MACR,eAAO,IACL,6BAA6B,QAAQ,KAAK,IAAI,QAAQ,cAAc,MAAM,IAAI,GAChF,EACA,KACF,CACF,CAAC,EAED,QAAQ,IACN,eAAO,MACL,oBAAoB,QAAQ,KAAK,IAAI,QAAQ,cAAc,MAAM,IAAI,GACvE,CACF,GAnBA,QAAQ,YACN,eAAO,OACL,sBAAsB,QAAQ,KAAK,IAAI,6BAA6B,cAAc,MAAM,IAAI,GAC9F,CACF,EAkBF,QACF,CAGA,GAAI,eAC2B,0BAC3B,cACA,QAAQ,IACV,EAE0B,CACxB,MAAM,cACN,KAAK,QAAQ,IAAuC,EACpD,MAAO,OAAU,CACf,MAAM,IAAI,MACR,eAAO,IACL,2BAA2B,QAAQ,KAAK,IAAI,QAAQ,cAAc,MAAM,IAAI;AAAA,CAC9E,EACA,KACF,CACF,CAAC,EAED,QAAQ,IACN,eAAO,MACL,mBAAmB,QAAQ,KAAK,IAAI,QAAQ,cAAc,MAAM,IAAI,GACtE,CACF,EAEA,QACF,CAIE,gBAEJ,MAAM,cACN,OAAO,QAAQ,IAAwC,EACvD,MAAO,OAAU,CACf,MAAM,IAAI,MACR,eAAO,IACL,+BAA+B,QAAQ,KAAK,IAAI,QAAQ,cAAc,MAAM,IAAI;AAAA,CAClF,EACA,KACF,CACF,CAAC,EAED,QAAQ,IACN,eAAO,MACL,uBAAuB,QAAQ,KAAK,IAAI,QAAQ,cAAc,MAAM,IAAI,GAC1E,CACF,EACF,CAEJ,CApHe","names":[]}
1
+ {"version":3,"sources":["../../../../src/handlers/command-handler/functions/registerCommands.ts","../../../../src/handlers/command-handler/utils/areSlashCommandsDifferent.ts","../../../../src/utils/colors.ts"],"sourcesContent":["import type {\n Guild,\n Client,\n ApplicationCommandData,\n GuildApplicationCommandManager,\n ApplicationCommandDataResolvable } from\n'discord.js';\nimport type { CommandFileObject, ReloadOptions } from '../../../types';\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(\n props.client,\n props.commands,\n props.devGuildIds,\n props.type\n );\n } else {\n throw new Error(\n colors.red(`Cannot reload commands when client is not ready.`)\n );\n }\n } else {\n props.client.once('ready', async (c) => {\n await handleRegistration(\n c,\n props.commands,\n props.devGuildIds,\n props.type\n );\n });\n }\n}\n\nasync function handleRegistration(\nclient: Client<true>,\ncommands: CommandFileObject[],\ndevGuildIds: string[],\ntype?: 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(\nclient: Client<true>,\ncommands: CommandFileObject[])\n{\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(\n `Failed to delete command \"${command.data.name}\" globally.\\n`\n ),\n error\n );\n });\n\n console.log(\n colors.green(`Deleted command \"${command.data.name}\" globally.`)\n );\n }\n\n continue;\n }\n\n // <!-- Edit global command -->\n if (targetCommand) {\n const commandsAreDifferent = areSlashCommandsDifferent(\n targetCommand,\n command.data\n );\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}\" globally.\\n`\n ),\n error\n );\n });\n\n console.log(\n colors.green(`Edited command \"${command.data.name}\" globally.`)\n );\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(\n `Failed to register command \"${command.data.name}\" globally.\\n`\n ),\n error\n );\n });\n\n console.log(\n colors.green(`Registered command \"${command.data.name}\" globally.`)\n );\n }\n}\n\nasync function registerDevCommands(\nclient: Client<true>,\ncommands: CommandFileObject[],\nguildIds: string[])\n{\n const devGuilds: Guild[] = [];\n\n for (const guildId of guildIds) {\n const guild =\n 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(\n (cmd) => cmd.name === command.data.name\n );\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(\n targetCommand,\n command.data\n );\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 * 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(\nappCommand: any,\nlocalCommand: any)\n{\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}","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};"],"mappings":"ouBAAA,wJCMe,SAAR,0BACP,WACA,aACA,CAOE,GANK,WAAW,UAAS,WAAW,QAAU,CAAC,GAC1C,aAAa,UAAS,aAAa,QAAU,CAAC,GAE9C,WAAW,cAAa,WAAW,YAAc,IACjD,aAAa,cAAa,aAAa,YAAc,IAG1D,aAAa,cAAgB,WAAW,aACxC,aAAa,QAAQ,SAAW,WAAW,QAAQ,OAEjD,MAAO,EAEX,CAhBwB,8DCNxB,IAAM,WAAa,UAEZ,eAAQ,CACb,MAAO,OAAC,MAAiB,GAAG,IAAI,GAAG,UAAU,GAAtC,SACP,OAAQ,OAAC,MAAiB,UAAU,IAAI,GAAG,UAAU,GAA7C,UACR,IAAK,OAAC,MAAiB,UAAU,IAAI,GAAG,UAAU,GAA7C,OACL,WAAY,OAAC,MAAiB,UA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AAM,IAAI,GACvE,CACF,GAnBA,QAAQ,YACN,eAAO,OACL,sBAAsB,QAAQ,KAAK,IAAI,6BAA6B,cAAc,MAAM,IAAI,GAC9F,CACF,EAkBF,QACF,CAGA,GAAI,eAC2B,0BAC3B,cACA,QAAQ,IACV,EAE0B,CACxB,MAAM,cACN,KAAK,QAAQ,IAAuC,EACpD,MAAO,OAAU,CACf,MAAM,IAAI,MACR,eAAO,IACL,2BAA2B,QAAQ,KAAK,IAAI,QAAQ,cAAc,MAAM,IAAI;AAAA,CAC9E,EACA,KACF,CACF,CAAC,EAED,QAAQ,IACN,eAAO,MACL,mBAAmB,QAAQ,KAAK,IAAI,QAAQ,cAAc,MAAM,IAAI,GACtE,CACF,EAEA,QACF,CAIE,gBAEJ,MAAM,cACN,OAAO,QAAQ,IAAwC,EACvD,MAAO,OAAU,CACf,MAAM,IAAI,MACR,eAAO,IACL,+BAA+B,QAAQ,KAAK,IAAI,QAAQ,cAAc,MAAM,IAAI;AAAA,CAClF,EACA,KACF,CACF,CAAC,EAED,QAAQ,IACN,eAAO,MACL,uBAAuB,QAAQ,KAAK,IAAI,QAAQ,cAAc,MAAM,IAAI,GAC1E,CACF,EACF,CAEJ,CApHe","names":[]}
@@ -1,2 +1,2 @@
1
- import{registerCommands}from"../../../chunk-XJCWZEWC.mjs";import"../../../chunk-6AX5YJEO.mjs";import"../../../chunk-C6WU57FQ.mjs";import"../../../chunk-6TIBWNPX.mjs";export{registerCommands as default};
1
+ import{registerCommands}from"../../../chunk-73NFQRKA.mjs";import"../../../chunk-BNTMQC76.mjs";import"../../../chunk-QXMWKQIO.mjs";import"../../../chunk-35OSBS47.mjs";export{registerCommands as default};
2
2
  //# sourceMappingURL=registerCommands.mjs.map
@@ -1,2 +1,2 @@
1
- import{areSlashCommandsDifferent}from"../../../chunk-6AX5YJEO.mjs";import"../../../chunk-6TIBWNPX.mjs";export{areSlashCommandsDifferent as default};
1
+ import{areSlashCommandsDifferent}from"../../../chunk-BNTMQC76.mjs";import"../../../chunk-35OSBS47.mjs";export{areSlashCommandsDifferent as default};
2
2
  //# sourceMappingURL=areSlashCommandsDifferent.mjs.map
@@ -1,2 +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 devOnly_exports={};__export(devOnly_exports,{default:()=>devOnly_default});module.exports=__toCommonJS(devOnly_exports);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");
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 devOnly_exports={};__export(devOnly_exports,{default:()=>devOnly_default});module.exports=__toCommonJS(devOnly_exports);function devOnly_default({interaction,targetCommand,handlerData}){var _a,_b;if(!interaction.isAutocomplete()&&(_a=targetCommand.options)!=null&&_a.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 guildMember=(_b=interaction.guild)==null?void 0:_b.members.cache.get(interaction.user.id),memberRoles=guildMember==null?void 0:guildMember.roles.cache,hasDevRole=!1;if(memberRoles==null||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");
2
2
  //# sourceMappingURL=devOnly.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/handlers/command-handler/validations/devOnly.ts"],"sourcesContent":["import type { BuiltInValidationParams } from '../typings';\n\nexport default function ({\n interaction,\n targetCommand,\n handlerData\n}: BuiltInValidationParams) {\n if (interaction.isAutocomplete()) return;\n\n if (targetCommand.options?.devOnly) {\n if (\n interaction.inGuild() &&\n !handlerData.devGuildIds.includes(interaction.guildId))\n {\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(\n interaction.user.id\n );\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 =\n 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}"],"mappings":"ouBAAA,4HAEe,SAAR,gBAAkB,CACvB,YACA,cACA,WACF,EAA4B,CAC1B,GAAI,aAAY,eAAe,GAE3B,cAAc,SAAS,QAAS,CAClC,GACA,YAAY,QAAQ,GACpB,CAAC,YAAY,YAAY,SAAS,YAAY,OAAO,EAEnD,mBAAY,MAAM,CAChB,QAAS,mEACT,UAAW,EACb,CAAC,EAEM,GAMT,IAAM,YAHc,YAAY,OAAO,QAAQ,MAAM,IACnD,YAAY,KAAK,EACnB,GACiC,MAAM,MAEnC,WAAa,GAWjB,GATA,aAAa,QAAS,MAAS,CACzB,YAAY,WAAW,SAAS,KAAK,EAAE,IACzC,WAAa,GAEjB,CAAC,EAKG,EAFJ,YAAY,WAAW,SAAS,YAAY,KAAK,EAAE,GAAK,YAGtD,mBAAY,MAAM,CAChB,QAAS,sDACT,UAAW,EACb,CAAC,EAEM,EAEX,CACF,CA7CO","names":[]}
1
+ {"version":3,"sources":["../../../../src/handlers/command-handler/validations/devOnly.ts"],"sourcesContent":["import type { BuiltInValidationParams } from '../typings';\n\nexport default function ({\n interaction,\n targetCommand,\n handlerData\n}: BuiltInValidationParams) {\n if (interaction.isAutocomplete()) return;\n\n if (targetCommand.options?.devOnly) {\n if (\n interaction.inGuild() &&\n !handlerData.devGuildIds.includes(interaction.guildId))\n {\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(\n interaction.user.id\n );\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 =\n 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}"],"mappings":"ouBAAA,4HAEe,SAAR,gBAAkB,CACvB,YACA,cACA,WACF,EAA4B,CAN5B,UAOE,GAAI,aAAY,eAAe,IAE3B,iBAAc,UAAd,SAAuB,QAAS,CAClC,GACA,YAAY,QAAQ,GACpB,CAAC,YAAY,YAAY,SAAS,YAAY,OAAO,EAEnD,mBAAY,MAAM,CAChB,QAAS,mEACT,UAAW,EACb,CAAC,EAEM,GAGT,IAAM,aAAc,eAAY,QAAZ,eAAmB,QAAQ,MAAM,IACnD,YAAY,KAAK,IAEb,YAAc,qCAAa,MAAM,MAEnC,WAAa,GAWjB,GATA,+BAAa,QAAS,MAAS,CACzB,YAAY,WAAW,SAAS,KAAK,EAAE,IACzC,WAAa,GAEjB,GAKI,EAFJ,YAAY,WAAW,SAAS,YAAY,KAAK,EAAE,GAAK,YAGtD,mBAAY,MAAM,CAChB,QAAS,sDACT,UAAW,EACb,CAAC,EAEM,EAEX,CACF,CA7CO","names":[]}
@@ -1,2 +1,2 @@
1
- import{devOnly_default}from"../../../chunk-Z4FBPRS6.mjs";import"../../../chunk-6TIBWNPX.mjs";export{devOnly_default as default};
1
+ import{devOnly_default}from"../../../chunk-JYUG7HAX.mjs";import"../../../chunk-35OSBS47.mjs";export{devOnly_default as default};
2
2
  //# sourceMappingURL=devOnly.mjs.map
@@ -1,4 +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 validations_exports={};__export(validations_exports,{default:()=>validations_default});module.exports=__toCommonJS(validations_exports);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.
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 validations_exports={};__export(validations_exports,{default:()=>validations_default});module.exports=__toCommonJS(validations_exports);function devOnly_default({interaction,targetCommand,handlerData}){var _a,_b;if(!interaction.isAutocomplete()&&(_a=targetCommand.options)!=null&&_a.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 guildMember=(_b=interaction.guild)==null?void 0:_b.members.cache.get(interaction.user.id),memberRoles=guildMember==null?void 0:guildMember.roles.cache,hasDevRole=!1;if(memberRoles==null||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}){var _a,_b,_c,_d;if(interaction.isAutocomplete())return;let userPermissions=interaction.memberPermissions,userPermissionsRequired=(_a=targetCommand.options)==null?void 0:_a.userPermissions,missingUserPermissions=[];typeof userPermissionsRequired=="string"&&(userPermissionsRequired=[userPermissionsRequired]);let botPermissions=(_c=(_b=interaction.guild)==null?void 0:_b.members.me)==null?void 0:_c.permissions,botPermissionsRequired=(_d=targetCommand.options)==null?void 0:_d.botPermissions,missingBotPermissions=[];if(typeof botPermissionsRequired=="string"&&(botPermissionsRequired=[botPermissionsRequired]),!(userPermissionsRequired!=null&&userPermissionsRequired.length)&&!(botPermissionsRequired!=null&&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.
2
2
  `}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.
3
3
  `}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];
4
4
  //# sourceMappingURL=index.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/handlers/command-handler/validations/index.ts","../../../../src/handlers/command-handler/validations/devOnly.ts","../../../../src/handlers/command-handler/validations/permissions.ts"],"sourcesContent":["import devOnly from './devOnly';\nimport permissions from './permissions';\n\nexport default [devOnly, permissions];","import type { BuiltInValidationParams } from '../typings';\n\nexport default function ({\n interaction,\n targetCommand,\n handlerData\n}: BuiltInValidationParams) {\n if (interaction.isAutocomplete()) return;\n\n if (targetCommand.options?.devOnly) {\n if (\n interaction.inGuild() &&\n !handlerData.devGuildIds.includes(interaction.guildId))\n {\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(\n interaction.user.id\n );\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 =\n 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}","import type { BuiltInValidationParams } from '../typings';\nimport { EmbedBuilder } from 'discord.js';\n\nexport default function ({\n interaction,\n targetCommand\n}: 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) =>\n str.replace(pattern, '$1$3 $2$4')\n );\n missingBotPermissions = missingBotPermissions.map((str) =>\n str.replace(pattern, '$1$3 $2$4')\n );\n\n let embedDescription = '';\n\n const formatter = new Intl.ListFormat('en', {\n style: 'long',\n type: 'conjunction'\n });\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}"],"mappings":"ouBAAA,4ICEe,SAAR,gBAAkB,CACvB,YACA,cACA,WACF,EAA4B,CAC1B,GAAI,aAAY,eAAe,GAE3B,cAAc,SAAS,QAAS,CAClC,GACA,YAAY,QAAQ,GACpB,CAAC,YAAY,YAAY,SAAS,YAAY,OAAO,EA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,WAAW,KAAM,CAC1C,MAAO,OACP,KAAM,aACR,CAAC,EAEK,kBAAoB,OAAC,aAC3B,YAAY,SAAW,EAAI,aAAe,cADhB,qBAG1B,GAAI,uBAAuB,OAAQ,CACjC,IAAM,qBAAuB,uBAAuB,IAAK,GAAM,KAAK,CAAC,IAAI,EACnE,kBAAoB,UAAU,OAAO,oBAAoB,EAE/D,kBAAoB,uBAAuB,iBAAiB,IAAI,kBAC9D,sBACF,CAAC;AAAA,CACH,CAEA,GAAI,sBAAsB,OAAQ,CAChC,IAAM,qBAAuB,sBAAsB,IAAK,GAAM,KAAK,CAAC,IAAI,EAClE,kBAAoB,UAAU,OAAO,oBAAoB,EAE/D,kBAAoB,qBAAqB,iBAAiB,IAAI,kBAC5D,qBACF,CAAC;AAAA,CACH,CAEA,IAAM,MAAQ,IAAI,4BAAa,EAC/B,SAAS,0BAA0B,EACnC,eAAe,gBAAgB,EAC/B,SAAS,KAAK,EAEd,mBAAY,MAAM,CAAE,OAAQ,CAAC,KAAK,EAAG,UAAW,EAAK,CAAC,EAC/C,EACT,CA9FO,sCFAP,IAAO,oBAAQ,CAAC,gBAAS,mBAAW","names":[]}
1
+ {"version":3,"sources":["../../../../src/handlers/command-handler/validations/index.ts","../../../../src/handlers/command-handler/validations/devOnly.ts","../../../../src/handlers/command-handler/validations/permissions.ts"],"sourcesContent":["import devOnly from './devOnly';\nimport permissions from './permissions';\n\nexport default [devOnly, permissions];","import type { BuiltInValidationParams } from '../typings';\n\nexport default function ({\n interaction,\n targetCommand,\n handlerData\n}: BuiltInValidationParams) {\n if (interaction.isAutocomplete()) return;\n\n if (targetCommand.options?.devOnly) {\n if (\n interaction.inGuild() &&\n !handlerData.devGuildIds.includes(interaction.guildId))\n {\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(\n interaction.user.id\n );\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 =\n 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}","import type { BuiltInValidationParams } from '../typings';\nimport { EmbedBuilder } from 'discord.js';\n\nexport default function ({\n interaction,\n targetCommand\n}: 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) =>\n str.replace(pattern, '$1$3 $2$4')\n );\n missingBotPermissions = missingBotPermissions.map((str) =>\n str.replace(pattern, '$1$3 $2$4')\n );\n\n let embedDescription = '';\n\n const formatter = new Intl.ListFormat('en', {\n style: 'long',\n type: 'conjunction'\n });\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}"],"mappings":"ouBAAA,4ICEe,SAAR,gBAAkB,CACvB,YACA,cACA,WACF,EAA4B,CAN5B,UAOE,GAAI,aAAY,eAAe,IAE3B,iBAAc,UAAd,SAAuB,QAAS,CAClC,GACA,YAAY,QAAQ,GACpB,CAAC,YAAY,YAAY,SAAS,YAAY,OAAO,EAEnD,mBAAY,MAAM,CAChB,QAAS,mEACT,UAAW,EACb,CAAC,EAEM,GAGT,IAAM,aAAc,eAAY,QAAZ,eAAmB,QAAQ,MAAM,IACnD,YAAY,KAAK,IAEb,YAAc,qCAAa,MAAM,MAEnC,WAAa,GAWjB,GATA,+BAAa,QAAS,MAAS,CACzB,YAAY,WAAW,SAAS,KAAK,EAAE,IACzC,WAAa,GAEjB,GAKI,EAFJ,YAAY,WAAW,SAAS,YAAY,KAAK,EAAE,GAAK,YAGtD,mBAAY,MAAM,CAChB,QAAS,sDACT,UAAW,EACb,CAAC,EAEM,EAEX,CACF,CA7CO,kCCDP,mBAA6B,sBAEd,SAAR,oBAAkB,CACvB,YACA,aACF,EAA4B,CAN5B,gBAOE,GAAI,YAAY,eAAe,EAAG,OAClC,IAAM,gBAAkB,YAAY,kBAChC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D,qBACF,CAAC;AAAA,CACH,CAEA,IAAM,MAAQ,IAAI,4BAAa,EAC/B,SAAS,0BAA0B,EACnC,eAAe,gBAAgB,EAC/B,SAAS,KAAK,EAEd,mBAAY,MAAM,CAAE,OAAQ,CAAC,KAAK,EAAG,UAAW,EAAK,CAAC,EAC/C,EACT,CA9FO,sCFAP,IAAO,oBAAQ,CAAC,gBAAS,mBAAW","names":[]}
@@ -1,2 +1,2 @@
1
- import{validations_default}from"../../../chunk-6TIGKCSX.mjs";import"../../../chunk-Z4FBPRS6.mjs";import"../../../chunk-K43A7OIY.mjs";import"../../../chunk-6TIBWNPX.mjs";export{validations_default as default};
1
+ import{validations_default}from"../../../chunk-6ZU6MOKA.mjs";import"../../../chunk-JYUG7HAX.mjs";import"../../../chunk-UYDZJJZT.mjs";import"../../../chunk-35OSBS47.mjs";export{validations_default as default};
2
2
  //# sourceMappingURL=index.mjs.map
@@ -1,4 +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 permissions_exports={};__export(permissions_exports,{default:()=>permissions_default});module.exports=__toCommonJS(permissions_exports);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.
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 permissions_exports={};__export(permissions_exports,{default:()=>permissions_default});module.exports=__toCommonJS(permissions_exports);var import_discord=require("discord.js");function permissions_default({interaction,targetCommand}){var _a,_b,_c,_d;if(interaction.isAutocomplete())return;let userPermissions=interaction.memberPermissions,userPermissionsRequired=(_a=targetCommand.options)==null?void 0:_a.userPermissions,missingUserPermissions=[];typeof userPermissionsRequired=="string"&&(userPermissionsRequired=[userPermissionsRequired]);let botPermissions=(_c=(_b=interaction.guild)==null?void 0:_b.members.me)==null?void 0:_c.permissions,botPermissionsRequired=(_d=targetCommand.options)==null?void 0:_d.botPermissions,missingBotPermissions=[];if(typeof botPermissionsRequired=="string"&&(botPermissionsRequired=[botPermissionsRequired]),!(userPermissionsRequired!=null&&userPermissionsRequired.length)&&!(botPermissionsRequired!=null&&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.
2
2
  `}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.
3
3
  `}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");
4
4
  //# sourceMappingURL=permissions.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../../src/handlers/command-handler/validations/permissions.ts"],"sourcesContent":["import type { BuiltInValidationParams } from '../typings';\nimport { EmbedBuilder } from 'discord.js';\n\nexport default function ({\n interaction,\n targetCommand\n}: 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) =>\n str.replace(pattern, '$1$3 $2$4')\n );\n missingBotPermissions = missingBotPermissions.map((str) =>\n str.replace(pattern, '$1$3 $2$4')\n );\n\n let embedDescription = '';\n\n const formatter = new Intl.ListFormat('en', {\n style: 'long',\n type: 'conjunction'\n });\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}"],"mappings":"ouBAAA,4IACA,mBAA6B,sBAEd,SAAR,oBAAkB,CACvB,YACA,aACF,EAA4B,CAC1B,GAAI,YAAY,eAAe,EAAG,OAClC,IAAM,gBAAkB,YAAY,kBAChC,wBAA0B,cAAc,SAAS,gBACjD,uBAAmC,CAAC,EAEpC,OAAO,yBAA4B,WACrC,wBAA0B,CAAC,uBAAuB,GAGpD,IAAM,eAAiB,YAAY,OAAO,QAAQ,IAAI,YAClD,uBAAyB,cAAc,SAAS,eAChD,sBAAkC,CAAC,EAMvC,GAJI,OAAO,wBAA2B,WACpC,uBAAyB,CAAC,sBAAsB,GAG9C,CAAC,yBAAyB,QAAU,CAAC,wBAAwB,OAC/D,OAGF,GAAI,iBAAmB,wBACrB,QAAW,cAAc,wBACD,gBAAgB,IAAI,UAAU,GAGlD,uBAAuB,KAAK,UAAU,EAK5C,GAAI,gBAAkB,uBACpB,QAAW,cAAc,uBACD,eAAe,IAAI,UAAU,GAGjD,sBAAsB,KAAK,UAAU,EAK3C,GAAI,CAAC,uBAAuB,QAAU,CAAC,sBAAsB,OAC3D,OAIF,IAAM,QAAU,uCAEhB,uBAAyB,uBAAuB,IAAK,KACrD,IAAI,QAAQ,QAAS,WAAW,CAChC,EACA,sBAAwB,sBAAsB,IAAK,KACnD,IAAI,QAAQ,QAAS,WAAW,CAChC,EAEA,IAAI,iBAAmB,GAEjB,UAAY,IAAI,KAAK,WAAW,KAAM,CAC1C,MAAO,OACP,KAAM,aACR,CAAC,EAEK,kBAAoB,OAAC,aAC3B,YAAY,SAAW,EAAI,aAAe,cADhB,qBAG1B,GAAI,uBAAuB,OAAQ,CACjC,IAAM,qBAAuB,uBAAuB,IAAK,GAAM,KAAK,CAAC,IAAI,EACnE,kBAAoB,UAAU,OAAO,oBAAoB,EAE/D,kBAAoB,uBAAuB,iBAAiB,IAAI,kBAC9D,sBACF,CAAC;AAAA,CACH,CAEA,GAAI,sBAAsB,OAAQ,CAChC,IAAM,qBAAuB,sBAAsB,IAAK,GAAM,KAAK,CAAC,IAAI,EAClE,kBAAoB,UAAU,OAAO,oBAAoB,EAE/D,kBAAoB,qBAAqB,iBAAiB,IAAI,kBAC5D,qBACF,CAAC;AAAA,CACH,CAEA,IAAM,MAAQ,IAAI,4BAAa,EAC/B,SAAS,0BAA0B,EACnC,eAAe,gBAAgB,EAC/B,SAAS,KAAK,EAEd,mBAAY,MAAM,CAAE,OAAQ,CAAC,KAAK,EAAG,UAAW,EAAK,CAAC,EAC/C,EACT,CA9FO","names":[]}
1
+ {"version":3,"sources":["../../../../src/handlers/command-handler/validations/permissions.ts"],"sourcesContent":["import type { BuiltInValidationParams } from '../typings';\nimport { EmbedBuilder } from 'discord.js';\n\nexport default function ({\n interaction,\n targetCommand\n}: 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) =>\n str.replace(pattern, '$1$3 $2$4')\n );\n missingBotPermissions = missingBotPermissions.map((str) =>\n str.replace(pattern, '$1$3 $2$4')\n );\n\n let embedDescription = '';\n\n const formatter = new Intl.ListFormat('en', {\n style: 'long',\n type: 'conjunction'\n });\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}"],"mappings":"ouBAAA,4IACA,mBAA6B,sBAEd,SAAR,oBAAkB,CACvB,YACA,aACF,EAA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,kBAAoB,UAAU,OAAO,oBAAoB,EAE/D,kBAAoB,qBAAqB,iBAAiB,IAAI,kBAC5D,qBACF,CAAC;AAAA,CACH,CAEA,IAAM,MAAQ,IAAI,4BAAa,EAC/B,SAAS,0BAA0B,EACnC,eAAe,gBAAgB,EAC/B,SAAS,KAAK,EAEd,mBAAY,MAAM,CAAE,OAAQ,CAAC,KAAK,EAAG,UAAW,EAAK,CAAC,EAC/C,EACT,CA9FO","names":[]}
@@ -1,2 +1,2 @@
1
- import{permissions_default}from"../../../chunk-K43A7OIY.mjs";import"../../../chunk-6TIBWNPX.mjs";export{permissions_default as default};
1
+ import{permissions_default}from"../../../chunk-UYDZJJZT.mjs";import"../../../chunk-35OSBS47.mjs";export{permissions_default as default};
2
2
  //# sourceMappingURL=permissions.mjs.map
@@ -1,2 +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 __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 EventHandler_exports={};__export(EventHandler_exports,{EventHandler:()=>EventHandler});module.exports=__toCommonJS(EventHandler_exports);var import_path=__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_path.default.join(directory,file.name);file.isFile()&&filePaths.push(filePath),nesting&&file.isDirectory()&&(filePaths=[...filePaths,...await getFilePaths(filePath,!0)])}return filePaths}__name(getFilePaths,"getFilePaths");async function getFolderPaths(directory,nesting){let folderPaths=[];if(!directory)return folderPaths;let folders=await import_promises.default.readdir(directory,{withFileTypes:!0});for(let folder of folders){let folderPath=import_path.default.join(directory,folder.name);folder.isDirectory()&&(folderPaths.push(folderPath),nesting&&(folderPaths=[...folderPaths,...await getFolderPaths(folderPath,!0)]))}return folderPaths}__name(getFolderPaths,"getFolderPaths");var import_path2=__toESM(require("path"));function toFileURL(filePath){return"file://"+import_path2.default.resolve(filePath).replace(/\\\\|\\/g,"/")}__name(toFileURL,"toFileURL");var import_rfdc=__toESM(require("rfdc")),clone=(0,import_rfdc.default)();var resetColor="\x1B[0m",colors_default={reset:__name(text=>`${text}${resetColor}`,"reset"),bright:__name(text=>`\x1B[1m${text}${resetColor}`,"bright"),dim:__name(text=>`\x1B[2m${text}${resetColor}`,"dim"),underscore:__name(text=>`\x1B[4m${text}${resetColor}`,"underscore"),blink:__name(text=>`\x1B[5m${text}${resetColor}`,"blink"),reverse:__name(text=>`\x1B[7m${text}${resetColor}`,"reverse"),hidden:__name(text=>`\x1B[8m${text}${resetColor}`,"hidden"),black:__name(text=>`\x1B[30m${text}${resetColor}`,"black"),red:__name(text=>`\x1B[31m${text}${resetColor}`,"red"),green:__name(text=>`\x1B[32m${text}${resetColor}`,"green"),yellow:__name(text=>`\x1B[33m${text}${resetColor}`,"yellow"),blue:__name(text=>`\x1B[34m${text}${resetColor}`,"blue"),magenta:__name(text=>`\x1B[35m${text}${resetColor}`,"magenta"),cyan:__name(text=>`\x1B[36m${text}${resetColor}`,"cyan"),white:__name(text=>`\x1B[37m${text}${resetColor}`,"white"),bgBlack:__name(text=>`\x1B[40m${text}${resetColor}`,"bgBlack"),bgRed:__name(text=>`\x1B[41m${text}${resetColor}`,"bgRed"),bgGreen:__name(text=>`\x1B[42m${text}${resetColor}`,"bgGreen"),bgYellow:__name(text=>`\x1B[43m${text}${resetColor}`,"bgYellow"),bgBlue:__name(text=>`\x1B[44m${text}${resetColor}`,"bgBlue"),bgMagenta:__name(text=>`\x1B[45m${text}${resetColor}`,"bgMagenta"),bgCyan:__name(text=>`\x1B[46m${text}${resetColor}`,"bgCyan"),bgWhite:__name(text=>`\x1B[47m${text}${resetColor}`,"bgWhite")};var EventHandler=class{static{__name(this,"EventHandler")}#data;constructor({...options}){this.#data={...options,events:[]}}async init(){await this.#buildEvents(),this.#registerEvents()}async#buildEvents(){let eventFolderPaths=await getFolderPaths(this.#data.eventsPath);for(let eventFolderPath of eventFolderPaths){let eventName=eventFolderPath.replace(/\\\\|\\/g,"/").split("/").pop(),allowedExtensions=/\.(js|mjs|cjs|ts)$/i,eventFilePaths=(await getFilePaths(eventFolderPath,!0)).filter(path3=>allowedExtensions.test(path3)),eventObj={name:eventName,functions:[]};this.#data.events.push(eventObj);for(let eventFilePath of eventFilePaths){let importedFunction=(await import(`${toFileURL(eventFilePath)}?t=${Date.now()}`)).default,eventFunction=clone(importedFunction);typeof module<"u"&&typeof require<"u"&&delete require.cache[require.resolve(eventFilePath)],eventFunction?.default&&(eventFunction=eventFunction.default);let compactFilePath=eventFilePath.split(process.cwd())[1]||eventFilePath;if(typeof eventFunction!="function"){process.emitWarning(colors_default.yellow(`Ignoring: Event file ${compactFilePath} does not export a function.`));continue}eventObj.functions.push(eventFunction)}}}#registerEvents(){let client=this.#data.client,handler=this.#data.commandKitInstance;for(let eventObj of this.#data.events)client.on(eventObj.name,async(...params)=>{for(let eventFunction of eventObj.functions)if(await eventFunction(...params,client,handler))break})}get events(){return this.#data.events}async reloadEvents(commandHandler){if(!this.#data.eventsPath)throw new Error(colors_default.red('Cannot reload events as "eventsPath" was not provided when instantiating CommandKit.'));this.#data.events=[],await this.#buildEvents(),this.#data.client.removeAllListeners(),this.#registerEvents(),commandHandler?.handleCommands()}};0&&(module.exports={EventHandler});
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 __typeError=msg=>{throw TypeError(msg)};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 __accessCheck=(obj,member,msg)=>member.has(obj)||__typeError("Cannot "+msg);var __privateGet=(obj,member,getter)=>(__accessCheck(obj,member,"read from private field"),getter?getter.call(obj):member.get(obj)),__privateAdd=(obj,member,value)=>member.has(obj)?__typeError("Cannot add the same private member more than once"):member instanceof WeakSet?member.add(obj):member.set(obj,value),__privateSet=(obj,member,value,setter)=>(__accessCheck(obj,member,"write to private field"),setter?setter.call(obj,value):member.set(obj,value),value),__privateMethod=(obj,member,method)=>(__accessCheck(obj,member,"access private method"),method);var EventHandler_exports={};__export(EventHandler_exports,{EventHandler:()=>EventHandler});module.exports=__toCommonJS(EventHandler_exports);var import_path=__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_path.default.join(directory,file.name);file.isFile()&&filePaths.push(filePath),nesting&&file.isDirectory()&&(filePaths=[...filePaths,...await getFilePaths(filePath,!0)])}return filePaths}__name(getFilePaths,"getFilePaths");async function getFolderPaths(directory,nesting){let folderPaths=[];if(!directory)return folderPaths;let folders=await import_promises.default.readdir(directory,{withFileTypes:!0});for(let folder of folders){let folderPath=import_path.default.join(directory,folder.name);folder.isDirectory()&&(folderPaths.push(folderPath),nesting&&(folderPaths=[...folderPaths,...await getFolderPaths(folderPath,!0)]))}return folderPaths}__name(getFolderPaths,"getFolderPaths");var import_path2=__toESM(require("path"));function toFileURL(filePath){return"file://"+import_path2.default.resolve(filePath).replace(/\\\\|\\/g,"/")}__name(toFileURL,"toFileURL");var import_rfdc=__toESM(require("rfdc")),clone=(0,import_rfdc.default)();var resetColor="\x1B[0m",colors_default={reset:__name(text=>`${text}${resetColor}`,"reset"),bright:__name(text=>`\x1B[1m${text}${resetColor}`,"bright"),dim:__name(text=>`\x1B[2m${text}${resetColor}`,"dim"),underscore:__name(text=>`\x1B[4m${text}${resetColor}`,"underscore"),blink:__name(text=>`\x1B[5m${text}${resetColor}`,"blink"),reverse:__name(text=>`\x1B[7m${text}${resetColor}`,"reverse"),hidden:__name(text=>`\x1B[8m${text}${resetColor}`,"hidden"),black:__name(text=>`\x1B[30m${text}${resetColor}`,"black"),red:__name(text=>`\x1B[31m${text}${resetColor}`,"red"),green:__name(text=>`\x1B[32m${text}${resetColor}`,"green"),yellow:__name(text=>`\x1B[33m${text}${resetColor}`,"yellow"),blue:__name(text=>`\x1B[34m${text}${resetColor}`,"blue"),magenta:__name(text=>`\x1B[35m${text}${resetColor}`,"magenta"),cyan:__name(text=>`\x1B[36m${text}${resetColor}`,"cyan"),white:__name(text=>`\x1B[37m${text}${resetColor}`,"white"),bgBlack:__name(text=>`\x1B[40m${text}${resetColor}`,"bgBlack"),bgRed:__name(text=>`\x1B[41m${text}${resetColor}`,"bgRed"),bgGreen:__name(text=>`\x1B[42m${text}${resetColor}`,"bgGreen"),bgYellow:__name(text=>`\x1B[43m${text}${resetColor}`,"bgYellow"),bgBlue:__name(text=>`\x1B[44m${text}${resetColor}`,"bgBlue"),bgMagenta:__name(text=>`\x1B[45m${text}${resetColor}`,"bgMagenta"),bgCyan:__name(text=>`\x1B[46m${text}${resetColor}`,"bgCyan"),bgWhite:__name(text=>`\x1B[47m${text}${resetColor}`,"bgWhite")};var _data,_EventHandler_instances,buildEvents_fn,registerEvents_fn,_EventHandler=class _EventHandler{constructor({...options}){__privateAdd(this,_EventHandler_instances);__privateAdd(this,_data);__privateSet(this,_data,{...options,events:[]})}async init(){await __privateMethod(this,_EventHandler_instances,buildEvents_fn).call(this),__privateMethod(this,_EventHandler_instances,registerEvents_fn).call(this)}get events(){return __privateGet(this,_data).events}async reloadEvents(commandHandler){if(!__privateGet(this,_data).eventsPath)throw new Error(colors_default.red('Cannot reload events as "eventsPath" was not provided when instantiating CommandKit.'));__privateGet(this,_data).events=[],await __privateMethod(this,_EventHandler_instances,buildEvents_fn).call(this),__privateGet(this,_data).client.removeAllListeners(),__privateMethod(this,_EventHandler_instances,registerEvents_fn).call(this),commandHandler==null||commandHandler.handleCommands()}};_data=new WeakMap,_EventHandler_instances=new WeakSet,buildEvents_fn=__name(async function(){let eventFolderPaths=await getFolderPaths(__privateGet(this,_data).eventsPath);for(let eventFolderPath of eventFolderPaths){let eventName=eventFolderPath.replace(/\\\\|\\/g,"/").split("/").pop(),allowedExtensions=/\.(js|mjs|cjs|ts)$/i,eventFilePaths=(await getFilePaths(eventFolderPath,!0)).filter(path3=>allowedExtensions.test(path3)),eventObj={name:eventName,functions:[]};__privateGet(this,_data).events.push(eventObj);for(let eventFilePath of eventFilePaths){let importedFunction=(await import(`${toFileURL(eventFilePath)}?t=${Date.now()}`)).default,eventFunction=clone(importedFunction);typeof module<"u"&&typeof require<"u"&&delete require.cache[require.resolve(eventFilePath)],eventFunction!=null&&eventFunction.default&&(eventFunction=eventFunction.default);let compactFilePath=eventFilePath.split(process.cwd())[1]||eventFilePath;if(typeof eventFunction!="function"){process.emitWarning(colors_default.yellow(`Ignoring: Event file ${compactFilePath} does not export a function.`));continue}eventObj.functions.push(eventFunction)}}},"#buildEvents"),registerEvents_fn=__name(function(){let client=__privateGet(this,_data).client,handler=__privateGet(this,_data).commandKitInstance;for(let eventObj of __privateGet(this,_data).events)client.on(eventObj.name,async(...params)=>{for(let eventFunction of eventObj.functions)if(await eventFunction(...params,client,handler))break})},"#registerEvents"),__name(_EventHandler,"EventHandler");var EventHandler=_EventHandler;0&&(module.exports={EventHandler});
2
2
  //# sourceMappingURL=EventHandler.js.map
@@ -1 +1 @@
1
- {"version":3,"sources":["../../../src/handlers/event-handler/EventHandler.ts","../../../src/utils/get-paths.ts","../../../src/utils/resolve-file-url.ts","../../../src/utils/clone.ts","../../../src/utils/colors.ts"],"sourcesContent":["import type { EventHandlerOptions, EventHandlerData } from './typings';\nimport type { CommandHandler } from '../command-handler/CommandHandler';\nimport { getFilePaths, getFolderPaths } from '../../utils/get-paths';\nimport { toFileURL } from '../../utils/resolve-file-url';\nimport { clone } from '../../utils/clone';\nimport colors from '../../utils/colors';\n\n/**\n * A handler for client events.\n */\nexport class EventHandler {\n #data: EventHandlerData;\n\n constructor({ ...options }: EventHandlerOptions) {\n this.#data = {\n ...options,\n events: []\n };\n }\n\n async init() {\n await this.#buildEvents();\n this.#registerEvents();\n }\n\n async #buildEvents() {\n const eventFolderPaths = await getFolderPaths(this.#data.eventsPath);\n\n for (const eventFolderPath of eventFolderPaths) {\n const eventName = eventFolderPath.\n replace(/\\\\\\\\|\\\\/g, '/').\n split('/').\n pop() as string;\n\n const allowedExtensions = /\\.(js|mjs|cjs|ts)$/i;\n const eventPaths = await getFilePaths(eventFolderPath, true);\n\n const eventFilePaths = eventPaths.filter((path) =>\n allowedExtensions.test(path)\n );\n\n const eventObj = {\n name: eventName,\n functions: [] as Function[]\n };\n\n this.#data.events.push(eventObj);\n\n for (const eventFilePath of eventFilePaths) {\n const modulePath = toFileURL(eventFilePath);\n\n let importedFunction = (await import(`${modulePath}?t=${Date.now()}`)).\n default;\n let eventFunction = clone(importedFunction);\n\n // If it's CommonJS, invalidate the import cache\n if (typeof module !== 'undefined' && typeof require !== 'undefined') {\n delete require.cache[require.resolve(eventFilePath)];\n }\n\n if (eventFunction?.default) {\n eventFunction = eventFunction.default;\n }\n\n const compactFilePath =\n eventFilePath.split(process.cwd())[1] || eventFilePath;\n\n if (typeof eventFunction !== 'function') {\n process.emitWarning(\n colors.yellow(\n `Ignoring: Event file ${compactFilePath} does not export a function.`\n )\n );\n continue;\n }\n\n eventObj.functions.push(eventFunction);\n }\n }\n }\n\n #registerEvents() {\n const client = this.#data.client;\n const handler = this.#data.commandKitInstance;\n\n for (const eventObj of this.#data.events) {\n client.on(eventObj.name, async (...params) => {\n for (const eventFunction of eventObj.functions) {\n const stopEventLoop = await eventFunction(...params, client, handler);\n\n if (stopEventLoop) {\n break;\n }\n }\n });\n }\n }\n\n get events() {\n return this.#data.events;\n }\n\n async reloadEvents(commandHandler?: CommandHandler) {\n if (!this.#data.eventsPath) {\n throw new Error(\n colors.red(\n 'Cannot reload events as \"eventsPath\" was not provided when instantiating CommandKit.'\n )\n );\n }\n\n this.#data.events = [];\n\n await this.#buildEvents();\n\n this.#data.client.removeAllListeners();\n\n this.#registerEvents();\n\n // Re-register \"interactionCreate\" event for application commands.\n commandHandler?.handleCommands();\n }\n}","import path from 'path';\nimport fs from 'fs/promises';\n\nexport async function getFilePaths(\ndirectory: string,\nnesting?: boolean)\n: 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(\ndirectory: string,\nnesting?: boolean)\n: 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 = [\n ...folderPaths,\n ...(await getFolderPaths(folderPath, true))];\n\n }\n }\n }\n\n return folderPaths;\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}","import rfdc from 'rfdc';\n\nexport const clone = rfdc();","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};"],"mappings":"q+BAAA,6ICAA,gBAAiB,yBACjB,gBAAe,gCAEf,eAAsB,aACtB,UACA,QACoB,CAClB,IAAI,UAAsB,CAAC,EAE3B,GAAI,CAAC,UAAW,OAAO,UAEvB,IAAM,MAAQ,MAAM,gBAAAA,QAAG,QAAQ,UAAW,CAAE,cAAe,EAAK,CAAC,EAEjE,QAAW,QAAQ,MAAO,CACxB,IAAM,SAAW,YAAAC,QAAK,KAAK,UAAW,KAAK,IAAI,EAE3C,KAAK,OAAO,GACd,UAAU,KAAK,QAAQ,EAGrB,SAAW,KAAK,YAAY,IAC9B,UAAY,CAAC,GAAG,UAAW,GAAI,MAAM,aAAa,SAAU,EAAI,CAAE,EAEtE,CAEA,OAAO,SACT,CAvBsB,oCAyBtB,eAAsB,eACtB,UACA,QACoB,CAClB,IAAI,YAAwB,CAAC,EAE7B,GAAI,CAAC,UAAW,OAAO,YAEvB,IAAM,QAAU,MAAM,gBAAAD,QAAG,QAAQ,UAAW,CAAE,cAAe,EAAK,CAAC,EAEnE,QAAW,UAAU,QAAS,CAC5B,IAAM,WAAa,YAAAC,QAAK,KAAK,UAAW,OAAO,IAAI,EAE/C,OAAO,YAAY,IACrB,YAAY,KAAK,UAAU,EAEvB,UACF,YAAc,CACd,GAAG,YACH,GAAI,MAAM,eAAe,WAAY,EAAI,CAAE,GAIjD,CAEA,OAAO,WACT,CA1BsB,wCC5BtB,IAAAC,aAAiB,yBAOV,SAAS,UAAU,SAAkB,CAE1C,MAAO,UADc,aAAAC,QAAK,QAAQ,QAAQ,EACV,QAAQ,WAAY,GAAG,CACzD,CAHgB,8BCPhB,gBAAiB,yBAEJ,SAAQ,YAAAC,SAAK,ECF1B,IAAM,WAAa,UAEZ,eAAQ,CACb,MAAO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AU,SAAW,CAC5C,QAAW,iBAAiB,SAAS,UAGnC,GAFsB,MAAM,cAAc,GAAG,OAAQ,OAAQ,OAAO,EAGlE,KAGN,CAAC,CAEL,CAEA,IAAI,QAAS,CACX,OAAO,KAAK,MAAM,MACpB,CAEA,MAAM,aAAa,eAAiC,CAClD,GAAI,CAAC,KAAK,MAAM,WACd,MAAM,IAAI,MACR,eAAO,IACL,sFACF,CACF,EAGF,KAAK,MAAM,OAAS,CAAC,EAErB,MAAM,KAAK,aAAa,EAExB,KAAK,MAAM,OAAO,mBAAmB,EAErC,KAAK,gBAAgB,EAGrB,gBAAgB,eAAe,CACjC,CACF","names":["fs","path","import_path","path","rfdc","path"]}
1
+ {"version":3,"sources":["../../../src/handlers/event-handler/EventHandler.ts","../../../src/utils/get-paths.ts","../../../src/utils/resolve-file-url.ts","../../../src/utils/clone.ts","../../../src/utils/colors.ts"],"sourcesContent":["import type { EventHandlerOptions, EventHandlerData } from './typings';\nimport type { CommandHandler } from '../command-handler/CommandHandler';\nimport { getFilePaths, getFolderPaths } from '../../utils/get-paths';\nimport { toFileURL } from '../../utils/resolve-file-url';\nimport { clone } from '../../utils/clone';\nimport colors from '../../utils/colors';\n\n/**\n * A handler for client events.\n */\nexport class EventHandler {\n #data: EventHandlerData;\n\n constructor({ ...options }: EventHandlerOptions) {\n this.#data = {\n ...options,\n events: []\n };\n }\n\n async init() {\n await this.#buildEvents();\n this.#registerEvents();\n }\n\n async #buildEvents() {\n const eventFolderPaths = await getFolderPaths(this.#data.eventsPath);\n\n for (const eventFolderPath of eventFolderPaths) {\n const eventName = eventFolderPath.\n replace(/\\\\\\\\|\\\\/g, '/').\n split('/').\n pop() as string;\n\n const allowedExtensions = /\\.(js|mjs|cjs|ts)$/i;\n const eventPaths = await getFilePaths(eventFolderPath, true);\n\n const eventFilePaths = eventPaths.filter((path) =>\n allowedExtensions.test(path)\n );\n\n const eventObj = {\n name: eventName,\n functions: [] as Function[]\n };\n\n this.#data.events.push(eventObj);\n\n for (const eventFilePath of eventFilePaths) {\n const modulePath = toFileURL(eventFilePath);\n\n let importedFunction = (await import(`${modulePath}?t=${Date.now()}`)).\n default;\n let eventFunction = clone(importedFunction);\n\n // If it's CommonJS, invalidate the import cache\n if (typeof module !== 'undefined' && typeof require !== 'undefined') {\n delete require.cache[require.resolve(eventFilePath)];\n }\n\n if (eventFunction?.default) {\n eventFunction = eventFunction.default;\n }\n\n const compactFilePath =\n eventFilePath.split(process.cwd())[1] || eventFilePath;\n\n if (typeof eventFunction !== 'function') {\n process.emitWarning(\n colors.yellow(\n `Ignoring: Event file ${compactFilePath} does not export a function.`\n )\n );\n continue;\n }\n\n eventObj.functions.push(eventFunction);\n }\n }\n }\n\n #registerEvents() {\n const client = this.#data.client;\n const handler = this.#data.commandKitInstance;\n\n for (const eventObj of this.#data.events) {\n client.on(eventObj.name, async (...params) => {\n for (const eventFunction of eventObj.functions) {\n const stopEventLoop = await eventFunction(...params, client, handler);\n\n if (stopEventLoop) {\n break;\n }\n }\n });\n }\n }\n\n get events() {\n return this.#data.events;\n }\n\n async reloadEvents(commandHandler?: CommandHandler) {\n if (!this.#data.eventsPath) {\n throw new Error(\n colors.red(\n 'Cannot reload events as \"eventsPath\" was not provided when instantiating CommandKit.'\n )\n );\n }\n\n this.#data.events = [];\n\n await this.#buildEvents();\n\n this.#data.client.removeAllListeners();\n\n this.#registerEvents();\n\n // Re-register \"interactionCreate\" event for application commands.\n commandHandler?.handleCommands();\n }\n}","import path from 'path';\nimport fs from 'fs/promises';\n\nexport async function getFilePaths(\ndirectory: string,\nnesting?: boolean)\n: 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(\ndirectory: string,\nnesting?: boolean)\n: 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 = [\n ...folderPaths,\n ...(await getFolderPaths(folderPath, true))];\n\n }\n }\n }\n\n return folderPaths;\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}","import rfdc from 'rfdc';\n\nexport const clone = rfdc();","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};"],"mappings":"8oDAAA,6ICAA,gBAAiB,yBACjB,gBAAe,gCAEf,eAAsB,aACtB,UACA,QACoB,CAClB,IAAI,UAAsB,CAAC,EAE3B,GAAI,CAAC,UAAW,OAAO,UAEvB,IAAM,MAAQ,MAAM,gBAAAA,QAAG,QAAQ,UAAW,CAAE,cAAe,EAAK,CAAC,EAEjE,QAAW,QAAQ,MAAO,CACxB,IAAM,SAAW,YAAAC,QAAK,KAAK,UAAW,KAAK,IAAI,EAE3C,KAAK,OAAO,GACd,UAAU,KAAK,QAAQ,EAGrB,SAAW,KAAK,YAAY,IAC9B,UAAY,CAAC,GAAG,UAAW,GAAI,MAAM,aAAa,SAAU,EAAI,CAAE,EAEtE,CAEA,OAAO,SACT,CAvBsB,oCAyBtB,eAAsB,eACtB,UACA,QACoB,CAClB,IAAI,YAAwB,CAAC,EAE7B,GAAI,CAAC,UAAW,OAAO,YAEvB,IAAM,QAAU,MAAM,gBAAAD,QAAG,QAAQ,UAAW,CAAE,cAAe,EAAK,CAAC,EAEnE,QAAW,UAAU,QAAS,CAC5B,IAAM,WAAa,YAAAC,QAAK,KAAK,UAAW,OAAO,IAAI,EAE/C,OAAO,YAAY,IACrB,YAAY,KAAK,UAAU,EAEvB,UACF,YAAc,CACd,GAAG,YACH,GAAI,MAAM,eAAe,WAAY,EAAI,CAAE,GAIjD,CAEA,OAAO,WACT,CA1BsB,wCC5BtB,IAAAC,aAAiB,yBAOV,SAAS,UAAU,SAAkB,CAE1C,MAAO,UADc,aAAAC,QAAK,QAAQ,QAAQ,EACV,QAAQ,WAAY,GAAG,CACzD,CAHgB,8BCPhB,gBAAiB,yBAEJ,SAAQ,YAAAC,SAAK,ECF1B,IA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hC,IAAM,gBACN,cAAc,MAAM,QAAQ,IAAI,CAAC,EAAE,CAAC,GAAK,cAEzC,GAAI,OAAO,eAAkB,WAAY,CACvC,QAAQ,YACN,eAAO,OACL,wBAAwB,eAAe,8BACzC,CACF,EACA,QACF,CAEA,SAAS,UAAU,KAAK,aAAa,CACvC,CACF,CACF,EAtDkB,gBAwDlB,kBAAe,iBAAG,CAChB,IAAM,OAAS,kBAAK,OAAM,OACpB,QAAU,kBAAK,OAAM,mBAE3B,QAAW,YAAY,kBAAK,OAAM,OAChC,OAAO,GAAG,SAAS,KAAM,SAAU,SAAW,CAC5C,QAAW,iBAAiB,SAAS,UAGnC,GAFsB,MAAM,cAAc,GAAG,OAAQ,OAAQ,OAAO,EAGlE,KAGN,CAAC,CAEL,EAfe,mBAvES,qCAAnB,IAAM,aAAN","names":["fs","path","import_path","path","rfdc","path"]}
@@ -1,2 +1,2 @@
1
- import{EventHandler}from"../../chunk-RGQOLRR6.mjs";import"../../chunk-6BSP7AD3.mjs";import"../../chunk-4CG7S6RY.mjs";import"../../chunk-MNPCM4QU.mjs";import"../../chunk-C6WU57FQ.mjs";import"../../chunk-6TIBWNPX.mjs";export{EventHandler};
1
+ import{EventHandler}from"../../chunk-LQPVE73I.mjs";import"../../chunk-ICJ4BBWI.mjs";import"../../chunk-MNPCM4QU.mjs";import"../../chunk-QXMWKQIO.mjs";import"../../chunk-RVGLG66X.mjs";import"../../chunk-35OSBS47.mjs";export{EventHandler};
2
2
  //# sourceMappingURL=EventHandler.mjs.map