🚑 deployCommands should work
This commit is contained in:
parent
3d8d9c43bd
commit
0054d6439b
3 changed files with 29 additions and 22 deletions
|
@ -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}`
|
||||
);
|
||||
})
|
||||
);
|
||||
});
|
||||
};
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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}`);
|
||||
});
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Reference in a new issue