diff --git a/src/tools/discord.ts b/src/tools/discord.ts index 00bbc1d..1bec92b 100644 --- a/src/tools/discord.ts +++ b/src/tools/discord.ts @@ -2,11 +2,15 @@ import { GuildBasedChannel, GuildTextBasedChannel, PermissionsBitField } from "d import client from "../client"; export async function getGuildChannel(guildID: string, channelID: string): Promise { - const guild = await client.guilds.fetch(guildID); - if (!guild) return null; + try { + const guild = await client.guilds.fetch(guildID); + if (!guild) return null; - const channel = await guild.channels.fetch(channelID); - return channel; + const channel = await guild.channels.fetch(channelID); + return channel; + } catch (_error) { + return null; + } } export async function getChannelPermission(channel: GuildTextBasedChannel): Promise | null> {