more logging
This commit is contained in:
@@ -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<VoiceChannel>
|
||||
{
|
||||
/***
|
||||
*/
|
||||
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();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -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;
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user