Skip to content
New issue

Have a question about this project? # for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “#”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? # to your account

Nuke the ChannelCache from existence #555

Merged
merged 2 commits into from
Apr 19, 2024
Merged

Nuke the ChannelCache from existence #555

merged 2 commits into from
Apr 19, 2024

Conversation

jb3
Copy link
Collaborator

@jb3 jb3 commented Apr 19, 2024

After we changed the behaviour of the ChannelCache to only store DM channels, we were then hit with behaviour that the cache never filled up at all.

This is because Discord does not send CHANNEL_CREATE events for private channels, nor does it send the private_channels field in the READY payload for bots.

As such, we can no longer identify DM channels the bot has open and put them into a cache (nor is it particularly useful to do so).

This PR indirectly closes #537 as we no longer have a channel cache.

Closes #537

@jb3 jb3 merged commit 984e052 into master Apr 19, 2024
7 checks passed
@jb3 jb3 deleted the jb3/nuke-channel-cache branch April 19, 2024 22:52
@jb3
Copy link
Collaborator Author

jb3 commented Apr 19, 2024

Thanks!


The [`ChannelCache`](`Nostrum.Cache.ChannelCache`) module provides functionality for you to retrieve information about any channel that your application can see. It provides two functions: [`get/1`](`Nostrum.Cache.ChannelCache.get/1`) and [`get!/1`](`Nostrum.Cache.ChannelCache.get!/1`).
Channels are cached within the guild object they are a member of. To fetch a cached channel you should use the `Nostrum.Cache.ChannelGuildMapping` cache to map a cache to a guild ID.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We should document here that DM channels are never cached due to the way Discord gateway works here.

# for free to join this conversation on GitHub. Already have an account? # to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

ChannelCache documentation enhancements
2 participants