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