diff --git a/package.json b/package.json index a3193a4..e4eb96e 100644 --- a/package.json +++ b/package.json @@ -4,7 +4,7 @@ "description": "", "main": "index.js", "scripts": { - "dev": "nodemon --ignore 'data/*.json' -r dotenv/config src/index.ts", + "dev": "nodemon -r dotenv/config src/index.ts", "build": "tsc", "start": "node build/index.js" }, diff --git a/src/client.ts b/src/client.ts index b53a0f4..dda0122 100644 --- a/src/client.ts +++ b/src/client.ts @@ -1,5 +1,6 @@ import { Client, Collection, GatewayIntentBits, User, Options } from "discord.js"; import { glob } from "glob"; +import path from "path"; import db from "./utils/db"; import logger from "./utils/logger"; @@ -31,16 +32,18 @@ class Bot extends Client { this.login(process.env.TOKEN); this.log.debug("Loading commands and events..."); - const commandFiles: string[] = await glob(`${__dirname}/commands/**/*{.ts,.js}`); + const commandFiles: string[] = await glob(`${__dirname}/commands/**/*.ts`); commandFiles.map(async (fileName: string) => { - const file: Command = await import(`../${fileName}`); + const filePath = path.resolve(fileName); + const file: Command = await import(filePath); this.commands.set(file.name, file); if (file.aliases) file.aliases.map((alias) => this.commands.set(alias, file)); }); - const eventFiles: string[] = await glob(`${__dirname}/events/**/*{.ts,.js}`); + const eventFiles: string[] = await glob(`${__dirname}/events/**/*.ts`); eventFiles.map(async (fileName: string) => { - const file: Event = await import(`../${fileName}`); + const filePath = path.resolve(fileName); + const file: Event = await import(filePath); this.events.set(file.name, file); this.on(file.event, file.run.bind(this, this)); }); diff --git a/src/commands/info.ts b/src/commands/other/info.ts similarity index 94% rename from src/commands/info.ts rename to src/commands/other/info.ts index ed790f6..b4834f1 100644 --- a/src/commands/info.ts +++ b/src/commands/other/info.ts @@ -1,6 +1,6 @@ import { EmbedBuilder } from "discord.js"; -import { RunFunction } from "../interfaces/commands"; +import { RunFunction } from "../../interfaces/commands"; export const run: RunFunction = async (client, message) => { const embed = new EmbedBuilder()