feat: integrate pino logger for improved error handling and logging consistency
This commit is contained in:
@@ -1,3 +1,4 @@
|
||||
import logger from "../../core/lib/logger";
|
||||
import {ButtonInteraction, MessageFlags} from 'discord.js';
|
||||
import {clearGlobalCommands} from '../../core/api/discordAPI';
|
||||
import type { Button } from '../../core/types/components';
|
||||
@@ -21,7 +22,7 @@ export default {
|
||||
await clearGlobalCommands();
|
||||
await interaction.editReply('🧹 Comandos GLOBAL eliminados.');
|
||||
} catch (e: any) {
|
||||
console.error('Error limpiando comandos globales:', e);
|
||||
logger.error('Error limpiando comandos globales:', e);
|
||||
if (interaction.deferred || interaction.replied) {
|
||||
await interaction.editReply('❌ Error limpiando comandos globales.');
|
||||
} else {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import logger from "../../core/lib/logger";
|
||||
import {ButtonInteraction, MessageFlags} from 'discord.js';
|
||||
import { clearAllCommands } from '../../core/api/discordAPI';
|
||||
import type { Button } from '../../core/types/components';
|
||||
@@ -21,7 +22,7 @@ export default {
|
||||
await clearAllCommands();
|
||||
await interaction.editReply('🧹 Comandos de GUILD eliminados.');
|
||||
} catch (e: any) {
|
||||
console.error('Error limpiando comandos guild:', e);
|
||||
logger.error('Error limpiando comandos guild:', e);
|
||||
if (interaction.deferred || interaction.replied) {
|
||||
await interaction.editReply('❌ Error limpiando comandos de guild.');
|
||||
} else {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import logger from "../../core/lib/logger";
|
||||
import {ButtonInteraction, MessageFlags} from 'discord.js';
|
||||
import { buildAdminPanel } from '../../commands/messages/net/commandsAdmin';
|
||||
|
||||
@@ -15,7 +16,7 @@ export default {
|
||||
// Edita el mensaje original reemplazando componentes (solo el contenedor con filas internas)
|
||||
await interaction.message.edit({ components: [panel] });
|
||||
} catch (e) {
|
||||
console.error('Error refrescando panel de memoria:', e);
|
||||
logger.error('Error refrescando panel de memoria:', e);
|
||||
if (!interaction.deferred && !interaction.replied)
|
||||
await interaction.reply({ content: '❌ Error refrescando panel.', flags: MessageFlags.Ephemeral });
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import logger from "../../core/lib/logger";
|
||||
import {ButtonInteraction, MessageFlags} from 'discord.js';
|
||||
import { registeringGlobalCommands } from '../../core/api/discordAPI';
|
||||
|
||||
@@ -19,7 +20,7 @@ export default {
|
||||
await registeringGlobalCommands();
|
||||
await interaction.editReply('✅ Comandos GLOBAL registrados (propagación puede tardar).');
|
||||
} catch (e: any) {
|
||||
console.error('Error registrando comandos globales:', e);
|
||||
logger.error('Error registrando comandos globales:', e);
|
||||
if (interaction.deferred || interaction.replied) {
|
||||
await interaction.editReply('❌ Error registrando comandos globales.');
|
||||
} else {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import logger from "../../core/lib/logger";
|
||||
import {ButtonInteraction, MessageFlags} from 'discord.js';
|
||||
import { registeringCommands } from '../../core/api/discordAPI';
|
||||
import type { Button } from '../../core/types/components';
|
||||
@@ -21,7 +22,7 @@ export default {
|
||||
await registeringCommands();
|
||||
await interaction.editReply('✅ Comandos de GUILD registrados correctamente.');
|
||||
} catch (e: any) {
|
||||
console.error('Error registrando comandos guild:', e);
|
||||
logger.error('Error registrando comandos guild:', e);
|
||||
if (interaction.deferred || interaction.replied) {
|
||||
await interaction.editReply('❌ Error registrando comandos de guild. Revisa logs.');
|
||||
} else {
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import logger from "../../core/lib/logger";
|
||||
import { ButtonInteraction, MessageFlags } from 'discord.js';
|
||||
import { buildLeaderboardPanel } from '../../commands/messages/alliaces/leaderboard';
|
||||
|
||||
@@ -14,7 +15,7 @@ export default {
|
||||
const panel = await buildLeaderboardPanel(fakeMessage);
|
||||
await interaction.message.edit({ components: [panel] });
|
||||
} catch (e) {
|
||||
console.error('Error refrescando leaderboard:', e);
|
||||
logger.error('Error refrescando leaderboard:', e);
|
||||
if (!interaction.deferred && !interaction.replied)
|
||||
await interaction.reply({ content: '❌ Error refrescando leaderboard.', flags: MessageFlags.Ephemeral });
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
import logger from "../../core/lib/logger";
|
||||
import {ModalSubmitInteraction, MessageFlags} from "discord.js";
|
||||
import type { Modal } from '../../core/types/components';
|
||||
import type Amayo from '../../core/client';
|
||||
@@ -22,7 +23,7 @@ export default {
|
||||
flags: MessageFlags.Ephemeral
|
||||
});
|
||||
} catch (error) {
|
||||
console.error('Error cambiando prefix:', error);
|
||||
logger.error('Error cambiando prefix:', error);
|
||||
await interaction.reply({
|
||||
content: '❌ Error al cambiar el prefix.',
|
||||
flags: MessageFlags.Ephemeral
|
||||
|
||||
Reference in New Issue
Block a user