From f20bdde4e6514ddb5e1b48e75e5a1942f1a70fe8 Mon Sep 17 00:00:00 2001 From: mo Date: Sun, 1 Mar 2026 17:52:06 +0100 Subject: [PATCH] more logging --- .../entities/channels/voice/voice-channels.service.ts | 10 ++++++++-- .../features/reaction-roles/reaction-roles.service.ts | 6 ++++-- .../listeners/interactions/interactions.listener.ts | 8 ++++++++ 3 files changed, 20 insertions(+), 4 deletions(-) diff --git a/adapters/discord/src/entities/channels/voice/voice-channels.service.ts b/adapters/discord/src/entities/channels/voice/voice-channels.service.ts index 5b560b2..8838060 100644 --- a/adapters/discord/src/entities/channels/voice/voice-channels.service.ts +++ b/adapters/discord/src/entities/channels/voice/voice-channels.service.ts @@ -2,19 +2,24 @@ import type { VoiceChannelsServiceInterface } from "@avocadi/bot-core/entities/c import { config } from "config"; import { ChannelType, type VoiceChannel } from "discord.js"; import client from "lib/client"; +import { logger } from "lib/common-logger"; export class VoiceChannelsService implements VoiceChannelsServiceInterface { + /*** + */ async getVoiceChannelById(channelId: string) { const channel = await client.channels.fetch(channelId); if (!channel) { - throw new Error(`Channel with id ${channelId} not found`); + logger.error(`Channel with id ${channelId} not found`); + return null; } if (channel.type !== ChannelType.GuildVoice) { - throw new Error(`Channel with id ${channelId} is not a voice channel`); + logger.error(`Channel with id ${channelId} is not a voice channel`); + return null; } return channel; @@ -43,6 +48,7 @@ export class VoiceChannelsService async deleteVoiceChannel(channelId: string) { const channel = await this.getVoiceChannelById(channelId); + if (!channel) return; await channel.delete(); } } diff --git a/adapters/discord/src/features/reaction-roles/reaction-roles.service.ts b/adapters/discord/src/features/reaction-roles/reaction-roles.service.ts index c3dc129..b6cf3e1 100644 --- a/adapters/discord/src/features/reaction-roles/reaction-roles.service.ts +++ b/adapters/discord/src/features/reaction-roles/reaction-roles.service.ts @@ -27,14 +27,16 @@ export class ReactionRolesService { if (!message) { this.logger.error(`Message with ID ${reaction.message.id} not found.`); - throw new Error("Message not found"); + return; + // throw new Error("Message not found"); } if (!config.reactionRoles.allowedMessageIds.includes(message.id)) { this.logger.error( `Message with ID ${message.id} is not allowed for reaction roles.`, ); - throw new Error("Message not allowed for reaction roles"); + return; + // throw new Error("Message not allowed for reaction roles"); } return; diff --git a/adapters/discord/src/listeners/interactions/interactions.listener.ts b/adapters/discord/src/listeners/interactions/interactions.listener.ts index 2c5ad14..4dd98c9 100644 --- a/adapters/discord/src/listeners/interactions/interactions.listener.ts +++ b/adapters/discord/src/listeners/interactions/interactions.listener.ts @@ -1,19 +1,27 @@ import client from "lib/client"; +import { logger } from "lib/common-logger"; import { handleButtonInteraction } from "./handle-button"; import { handleChatInputCommandInteraction } from "./handle-chat-input-command"; import { handleModalSubmitInteraction } from "./handle-modal-submit"; client.on("interactionCreate", async (interaction) => { if (interaction.isModalSubmit()) { + logger.debug("isModalSubmit"); await handleModalSubmitInteraction(interaction); return; } if (interaction.isChatInputCommand()) { + logger.debug("isChatInputCommand"); await handleChatInputCommandInteraction(interaction); return; } + if (interaction.isCommand()) { + logger.debug("isCommand"); + return; + } if (interaction.isButton()) { + logger.debug("isButton"); await handleButtonInteraction(interaction); return; }