🚚 correct path for registers
This commit is contained in:
parent
b5d20088f1
commit
051d122729
2 changed files with 7 additions and 9 deletions
|
@ -5,7 +5,7 @@ import logger from "../../middlewares/logger";
|
|||
|
||||
export const register = async (client: Client) => {
|
||||
// Get name of directories containing commands
|
||||
const commandNames = await listDir("plugins/commands");
|
||||
const commandNames = await listDir("commands");
|
||||
if (!commandNames) throw new Error("📦 No commands available");
|
||||
|
||||
const amountOfCommands = commandNames.length;
|
||||
|
@ -13,10 +13,8 @@ export const register = async (client: Client) => {
|
|||
logger.info(`📦 Trying to load ${amountOfCommands} commands`);
|
||||
|
||||
const importCommand = async (commandName: string) => {
|
||||
// Import command from plugins/commands
|
||||
const command: ICommand = await import(
|
||||
`../../plugins/commands/${commandName}`
|
||||
);
|
||||
// Import command from commands
|
||||
const command: ICommand = await import(`../../commands/${commandName}`);
|
||||
if (!command)
|
||||
throw new Error(`📦 No command found while importing "${commandName}"`);
|
||||
if (!command.builder)
|
||||
|
|
|
@ -6,7 +6,7 @@ import logger from "../../middlewares/logger";
|
|||
|
||||
// Registers all available events
|
||||
export const register = async (client: Client) => {
|
||||
const eventNames = await listDir("plugins/events");
|
||||
const eventNames = await listDir("events");
|
||||
if (!eventNames) throw new Error("📦 No events available");
|
||||
|
||||
const amountOfEvents = eventNames.length;
|
||||
|
@ -14,8 +14,8 @@ export const register = async (client: Client) => {
|
|||
logger.info(`📦 Trying to load ${amountOfEvents} events`);
|
||||
|
||||
const importEvent = async (eventName: string) => {
|
||||
// Import event from plugins/events
|
||||
const event: IEvent = await import(`../../plugins/events/${eventName}`);
|
||||
// Import event from events
|
||||
const event: IEvent = await import(`../../events/${eventName}`);
|
||||
if (!event)
|
||||
throw new Error(`📦 No event found while importing "${eventName}"`);
|
||||
if (!event.options)
|
||||
|
@ -76,7 +76,7 @@ export const register = async (client: Client) => {
|
|||
});
|
||||
|
||||
// for await (const eventName of eventNames) {
|
||||
// const event: IEvent = await import(`../../plugins/events/${eventName}`);
|
||||
// const event: IEvent = await import(`../../events/${eventName}`);
|
||||
// const eventExecutor = async (...args: Promise<void>[]) =>
|
||||
// event.execute(...args).catch(async (err) => {
|
||||
// logger.error(`${err}`);
|
||||
|
|
Loading…
Add table
Reference in a new issue