interaction.channel = null

Sometimes interaction.channel = null. This is often fixed by restarting the bot. But I don't want to restart the bot every 24 hours.
It's a command interaction that was executed in a guild. The bot is in this guild and the guild is cached.

// It returned "true" anyways
if (!interaction.inCachedGuild()) await client.guilds.fetch(client.config.guild_id); 


Along with that I fetch the channel if I am receiveing a chanel partial
const channel = interaction.channel == null ? await interaction.channel.fetch() : interaction.channel;


But I am still getting this error
| [ERR] | DiscordAPIError[10003]: Unknown Channel
/root/DiscordBot/Multibot/node_modules/@discordjs/rest/dist/index.js:640
      throw new DiscordAPIError(data, "code" in data ? data.code : data.error, status, method, url, requestData);
Was this page helpful?