diff --git a/src/handlers/commands.ts b/src/handlers/commands.ts index 0e657b8..4645c10 100644 --- a/src/handlers/commands.ts +++ b/src/handlers/commands.ts @@ -11,13 +11,18 @@ export default async (client: Client) => { return logger?.error(new Error(error)); } - await plugins?.map(async (pluginName: any) => { - const plugin = await import(`../plugins/${pluginName}`); + await Promise.all( + plugins?.map(async (pluginName: any) => { + const plugin = await import(`../plugins/${pluginName}`); - await client?.commands?.set(plugin?.default?.data?.name, plugin?.default); - logger?.debug( - `Successfully loaded plugin: ${plugin?.default?.data?.name} from ${plugin.default?.metadata?.author}` - ); - }); + await client?.commands?.set( + plugin?.default?.data?.name, + plugin?.default + ); + logger?.debug( + `Successfully loaded plugin: ${plugin?.default?.data?.name} from ${plugin.default?.metadata?.author}` + ); + }) + ); }); }; diff --git a/src/handlers/deployCommands.ts b/src/handlers/deployCommands.ts index 2d134e5..d58e5af 100644 --- a/src/handlers/deployCommands.ts +++ b/src/handlers/deployCommands.ts @@ -15,15 +15,17 @@ export default async () => { const pluginList = [] as any; - await plugins?.map(async (pluginName: any) => { - const plugin = await import(`../plugins/${pluginName}`); + await Promise.all( + plugins?.map(async (pluginName: any) => { + const plugin = await import(`../plugins/${pluginName}`); - pluginList.push(plugin.default.data.toJSON()); + pluginList.push(plugin.default.data.toJSON()); - logger?.debug( - `Successfully deployed plugin: ${plugin?.default?.data?.name} from ${plugin.default?.metadata?.author}` - ); - }); + logger?.debug( + `Successfully deployed plugin: ${plugin?.default?.data?.name} from ${plugin.default?.metadata?.author}` + ); + }) + ); const rest = new REST({ version: "9" }).setToken(token); @@ -31,9 +33,9 @@ export default async () => { .put(Routes.applicationCommands(clientId), { body: pluginList, }) - .then(async () => - logger.info("Successfully registered application commands.") - ) + .then(async () => { + logger.info("Successfully registered application commands."); + }) .catch(async (err: any) => { logger.error(err); }); diff --git a/src/helpers/devMode.ts b/src/helpers/devMode.ts index abdba7e..708481b 100644 --- a/src/helpers/devMode.ts +++ b/src/helpers/devMode.ts @@ -7,9 +7,9 @@ import logger from "@logger"; import { devMode, guildId } from "@config/other"; export default async (client: Client) => { - // if (!devMode) { - // client?.application?.commands?.set([], guildId).then(async () => { - // logger.verbose(`Removed all guild based commands from ${guildId}`); - // }); - // } + if (!devMode) { + client?.application?.commands?.set([], guildId).then(async () => { + logger.verbose(`Removed all guild based commands from ${guildId}`); + }); + } };