messages
getting messages of a discord channel?
get TypeError: Cannot read properties of undefined (reading 'fetch')
12 Replies
• What's your exact discord.js
npm list discord.js
and node node -v
version?
• Post the full error stack trace, not just the top part!
• Show your code!
• Explain what exactly your issue is.
• Not a discord.js issue? Check out #useful-servers.Channel is not a TextBasedChannel
I get channel from
const channel = await interaction.client.channels.cache.get(config.channels.jobPickups);;
so what do I need?
The guilds intent
And getting from cache isnt async, no need to await
And if you have the guilds intent, your id might be invalid
Yes
so do interaction.guild?
can u explain me about guilds intent
Thats not an intent
I have it enabled
it refers to a text channel, I am able to send messages directly to this channel, now I want to retrieve all messages from it
now it works, getting this channel is wrapped in async function, forgot to await, cheers
channel.messages.fetch().then(messages => {
});
Is there a limit of how many messages it will fetch?
50 by default
100 max
thank you