Get all messages in channel

I'm trying to get the content of posts from a specific channel by its ID, but the content is always empty even though the posts contain understandable text
const channelId = interaction.options.getChannel("channel").id

const receiveChannel = client.channels.cache.get(channelId);
const message = await receiveChannel.messages.fetch({ limit: 10 })
.then(messages=> console.log(messages))
.catch(console.error);
const channelId = interaction.options.getChannel("channel").id

const receiveChannel = client.channels.cache.get(channelId);
const message = await receiveChannel.messages.fetch({ limit: 10 })
.then(messages=> console.log(messages))
.catch(console.error);
3 Replies
Unknown User
Unknown User2y ago
Message Not Public
Sign In & Join Server To View
chewie
chewie2y ago
you are missing good ol MessageContent intent @prayforukraine
Alexcitten
AlexcittenOP2y ago
Ah, my bad Thanks
Want results from more Discord servers?
Add your server