timotejroiko / discord.js-light

All the power of discord.js, zero caching. This library modifies discord.js's internal classes and functions in order to give you full control over its caching behaviour.
Apache License 2.0
292 stars 29 forks source link

<message>.channel.name returns undefined #60

Closed TheQazwsx closed 3 years ago

TheQazwsx commented 3 years ago

I'm trying to check if a channel name is what I want, but .channel.name doesn't return a name, just undefined

timotejroiko commented 3 years ago

channel names require either caching channels or fetching them.

to cache all channels, set cacheChannels:true in your client options.

to fetch the channel only when you need it, use let channel = await client.channels.fetch(message.channel.id) if you want to keep it in the cache afterwards, or let channel = await client.channels.fetch(message.channel.id, false) if you want to fetch it without caching.