client.channels.cache.get(channelId) returning undefined
Hello, I'm unsure why a specific message is returning undefined from a channel. Could use another set of eyes since I've been staring for so long.
const { Client, Events, GatewayIntentBits, Partials, ReactionManager, SlashCommandBuilder,} = require("discord.js");
const clientInstance = require("../../bot.js");
module.exports = {
data: new SlashCommandBuilder()
.setName("verify")
.setDescription("assign and remove the verify role for the rules."),
async execute(interaction, client) {
const botMessage = await interaction.deferReply({
fetchReply: true,
});
const message = client.channels.cache
.get(1103869557849997403)
.messages.cache.get(1164272120994463744); //message id;
console.log(message);
if (!message) {
console.error('Message not found.');
return;
}