provide debugging information when developping
All checks were successful
Lint and Format Check / lint-and-format (pull_request) Successful in 10s

This commit is contained in:
Mylloon 2024-09-17 19:02:18 +02:00
parent 9f7f3e7ba8
commit 30fe586e66
Signed by: Anri
GPG key ID: A82D63DFF8D1317F
2 changed files with 10 additions and 3 deletions

View file

@ -1,10 +1,12 @@
const isDev = process.env.NODE_ENV !== "production";
/** Load the app */ /** Load the app */
const start_app = () => { const start_app = () => {
import("./load").then((l) => l.run().catch((error) => console.error(error))); import("./load").then((l) => l.run(isDev).catch((error) => console.error(error)));
}; };
// Load .env if not in prod // Load .env if not in prod
if (process.env.NODE_ENV !== "production") { if (isDev) {
// eslint-disable-next-line @typescript-eslint/ban-ts-comment // eslint-disable-next-line @typescript-eslint/ban-ts-comment
// @ts-ignore // @ts-ignore
import("dotenv").then((c) => { import("dotenv").then((c) => {

View file

@ -7,13 +7,18 @@ import loadClient, { quit } from "./utils/client";
import { logStart } from "./utils/misc"; import { logStart } from "./utils/misc";
/** Run the bot */ /** Run the bot */
export const run = async () => { export const run = async (isDev: boolean) => {
console.log("Starting Botanique..."); console.log("Starting Botanique...");
// Client Discord.JS // Client Discord.JS
const client_name = "Client"; const client_name = "Client";
await loadClient() await loadClient()
.then(async (client) => { .then(async (client) => {
if (isDev) {
// Attach debugging listeners
client.on("debug", console.log).on("warn", console.warn);
}
// Events Discord.JS and Player // Events Discord.JS and Player
const events_name = "Events"; const events_name = "Events";
await loadEvents(client) await loadEvents(client)