refactor: replace console.* with logger in core lib files

Update loaders, handlers, and BotClient to use centralized logger:
- CommandLoader.ts and EventLoader.ts
- AutocompleteHandler.ts, CommandHandler.ts, ComponentInteractionHandler.ts
- BotClient.ts

Provides consistent formatting across all core library logging.
This commit is contained in:
syntaxbullet
2025-12-24 21:56:50 +01:00
parent a53d30a0b3
commit 10a760edf4
6 changed files with 34 additions and 28 deletions

View File

@@ -2,6 +2,7 @@ import { ChatInputCommandInteraction, MessageFlags } from "discord.js";
import { AuroraClient } from "@/lib/BotClient";
import { userService } from "@/modules/user/user.service";
import { createErrorEmbed } from "@lib/embeds";
import { logger } from "@lib/logger";
/**
* Handles slash command execution
@@ -12,7 +13,7 @@ export class CommandHandler {
const command = AuroraClient.commands.get(interaction.commandName);
if (!command) {
console.error(`No command matching ${interaction.commandName} was found.`);
logger.error(`No command matching ${interaction.commandName} was found.`);
return;
}
@@ -20,13 +21,13 @@ export class CommandHandler {
try {
await userService.getOrCreateUser(interaction.user.id, interaction.user.username);
} catch (error) {
console.error("Failed to ensure user exists:", error);
logger.error("Failed to ensure user exists:", error);
}
try {
await command.execute(interaction);
} catch (error) {
console.error(error);
logger.error(String(error));
const errorEmbed = createErrorEmbed('There was an error while executing this command!');
if (interaction.replied || interaction.deferred) {