Skip to content

Code returns error #494

Discussion options

You must be logged in to vote

The error is being caused because the guild.channels object is undefined or the guild.channels.cache object is undefined. This means that either the fetch() method is not returning a guild object, or the guild object being returned does not have a channels property.

You should check if the fetch() method is being passed the correct guild ID, and if the returned guild object has a channels property.

Additionally, you can check if the cache property exists before trying to access it.

let guild = await client.guilds.fetch('**guildid**'); if(guild && guild.channels && guild.channels.cache){ let channel = guild.channels.cache.get('**cid**'); if(channel && channel.messages) { channel.messages.f…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by YourPersonalAcc
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants