mirror of
https://github.com/MrTalon63/lets-go-gambling.git
synced 2026-03-09 09:17:58 +01:00
Fix command and event file paths
This commit is contained in:
parent
0e2b7c0087
commit
fa77a856ca
3 changed files with 9 additions and 6 deletions
|
|
@ -4,7 +4,7 @@
|
||||||
"description": "",
|
"description": "",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
"dev": "nodemon --ignore 'data/*.json' -r dotenv/config src/index.ts",
|
"dev": "nodemon -r dotenv/config src/index.ts",
|
||||||
"build": "tsc",
|
"build": "tsc",
|
||||||
"start": "node build/index.js"
|
"start": "node build/index.js"
|
||||||
},
|
},
|
||||||
|
|
|
||||||
|
|
@ -1,5 +1,6 @@
|
||||||
import { Client, Collection, GatewayIntentBits, User, Options } from "discord.js";
|
import { Client, Collection, GatewayIntentBits, User, Options } from "discord.js";
|
||||||
import { glob } from "glob";
|
import { glob } from "glob";
|
||||||
|
import path from "path";
|
||||||
|
|
||||||
import db from "./utils/db";
|
import db from "./utils/db";
|
||||||
import logger from "./utils/logger";
|
import logger from "./utils/logger";
|
||||||
|
|
@ -31,16 +32,18 @@ class Bot extends Client {
|
||||||
this.login(process.env.TOKEN);
|
this.login(process.env.TOKEN);
|
||||||
|
|
||||||
this.log.debug("Loading commands and events...");
|
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) => {
|
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);
|
this.commands.set(file.name, file);
|
||||||
if (file.aliases) file.aliases.map((alias) => this.commands.set(alias, 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) => {
|
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.events.set(file.name, file);
|
||||||
this.on(file.event, file.run.bind(this, this));
|
this.on(file.event, file.run.bind(this, this));
|
||||||
});
|
});
|
||||||
|
|
|
||||||
|
|
@ -1,6 +1,6 @@
|
||||||
import { EmbedBuilder } from "discord.js";
|
import { EmbedBuilder } from "discord.js";
|
||||||
|
|
||||||
import { RunFunction } from "../interfaces/commands";
|
import { RunFunction } from "../../interfaces/commands";
|
||||||
|
|
||||||
export const run: RunFunction = async (client, message) => {
|
export const run: RunFunction = async (client, message) => {
|
||||||
const embed = new EmbedBuilder()
|
const embed = new EmbedBuilder()
|
||||||
Loading…
Add table
Reference in a new issue