messages

getting messages of a discord channel?
channel.messages.fetch().then(messages => {
console.log(messages);
});
channel.messages.fetch().then(messages => {
console.log(messages);
});
get TypeError: Cannot read properties of undefined (reading 'fetch')
12 Replies
d.js toolkit
d.js toolkit2y ago
• 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.
treble/luna
treble/luna2y ago
Channel is not a TextBasedChannel
Deerlo
DeerloOP2y ago
I get channel from const channel = await interaction.client.channels.cache.get(config.channels.jobPickups);; so what do I need?
treble/luna
treble/luna2y ago
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
Jordan
Jordan2y ago
Yes
Deerlo
DeerloOP2y ago
so do interaction.guild? can u explain me about guilds intent
d.js docs
d.js docs2y ago
guide Popular Topics: Gateway Intents read more
treble/luna
treble/luna2y ago
Thats not an intent
Deerlo
DeerloOP2y ago
Deerlo
DeerloOP2y ago
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?
treble/luna
treble/luna2y ago
50 by default 100 max
Deerlo
DeerloOP2y ago
thank you
Want results from more Discord servers?
Add your server