'(Discord.js v13) Unable to fetch messages from channel
Node.js: v16.13.0 | Discord.js: v13.3.1
Hello, I've been getting trying to fetch all the messages from a channel. However, I get the following errors:
TypeError: Cannot read properties of undefined (reading 'cache')
TypeError: Cannot read properties of undefined (reading 'fetch')
My code goes like this:
if(message.content == "!q test")
{
const channelS = client.channels.cache.get('880814576692789258')
channelS.messages.fetch().then(messages => { //<---error here
messages.forEach(msg => console.log(msg.content));
});
}
What should I do to fix this problem?
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
