mirror of
https://github.com/JonnyBro/JaBa.git
synced 2025-01-19 17:03:47 +05:00
refactor: added debug in many loading func
This commit is contained in:
parent
cc10969ccf
commit
a0309c164a
4 changed files with 10 additions and 1 deletions
|
@ -37,6 +37,7 @@ const registerGlobalCommands = async (client: ExtendedClient, commands: CommandF
|
|||
logger.log(`Edited command globally: ${data.name}`);
|
||||
} else if (!targetCommand) {
|
||||
await appCommandsManager.create(data).catch(() => logger.error(`Failed to register command: ${data.name}`));
|
||||
logger.debug(`Command ${data.name} loaded globally`);
|
||||
}
|
||||
}),
|
||||
);
|
||||
|
@ -77,6 +78,7 @@ const registerDevCommands = async (client: ExtendedClient, commands: CommandFile
|
|||
logger.log(`Edited command globally: ${data.name}`);
|
||||
} else if (!targetCommand) {
|
||||
await guildCommands.create(data).catch(() => logger.error(`Failed to register command: ${data.name} in ${guildCommands.guild.name} server`));
|
||||
logger.debug(`Command ${data.name} loaded in dev`);
|
||||
}
|
||||
});
|
||||
}),
|
||||
|
|
|
@ -94,7 +94,7 @@ export class CommandHandler {
|
|||
interaction,
|
||||
});
|
||||
} catch (error) {
|
||||
logger.error(error);
|
||||
logger.error(error, "Command cannot be executed");
|
||||
}
|
||||
});
|
||||
}
|
||||
|
|
|
@ -53,6 +53,8 @@ export class EventHandler {
|
|||
}
|
||||
|
||||
this.events.push({ data, run });
|
||||
|
||||
logger.debug(`Event ${eventFilePath} loaded`);
|
||||
}
|
||||
} catch (error) {
|
||||
logger.error("Error build events: ", error);
|
||||
|
|
|
@ -1,3 +1,4 @@
|
|||
import useClient from "@/utils/use-client.js";
|
||||
import chalk from "chalk";
|
||||
|
||||
function format(tDate: Date | number) {
|
||||
|
@ -34,6 +35,10 @@ export default {
|
|||
},
|
||||
|
||||
debug(...content: unknown[]) {
|
||||
const client = useClient();
|
||||
const isProd = client.configService.get("production");
|
||||
console.log(isProd);
|
||||
if (isProd) return;
|
||||
return console.log(`[${format(Date.now())}]: ${logLevels.DEBUG} ${content.join(" ")}`);
|
||||
},
|
||||
|
||||
|
|
Loading…
Reference in a new issue