Skip to content
New issue

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

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

Already on GitHub? Sign in to your account

Use Channel.from() in channel event handlers #572

Closed
wants to merge 4 commits into from

Conversation

Khaaz
Copy link
Contributor

@Khaaz Khaaz commented Nov 24, 2019

This PR changes the implementation of CHANNEL_CREATE and CHANNEL_UPDATE to works with changes in #565 .
Since the guild is resolved inside the channel constructor, I first instantiate the Channel and then check for the guild.

This change was tested and it works / actually fix the bug. However please double check that everything is fine.
I am also concerned about the instanceof check toknowif the Guild is valid (cached) or not. Maybe this can be replaced with checking specifically for one of the property always included in Guild (eg: guild.name)

@Khaaz Khaaz changed the title This PR hotfix #565. CHANNEL_CREATE / CHANNEL_UPDATE were not updated to the new implementation This PR hotfix #565. CHANNEL_CREATE / CHANNEL_UPDATE gateway events were not updated to the new channel implementation Nov 24, 2019
if the channel was created as Channel (Channel.from)
@Khaaz
Copy link
Contributor Author

Khaaz commented Nov 24, 2019

Switched that to actually use Channel.from which makes more sense overall.
This also entirely add support to the new StoreChannel added in #565 .

In CHANNEL_CREATE, with Channel.from it means that if channel.type is undefined or not one of known type, it will create a Channel.
That would mean it doesn't have a guild property so we then manually try to add the Guild.
In case of uncached Guild we don't add the Channel to the cache.

@abalabahaha abalabahaha changed the title This PR hotfix #565. CHANNEL_CREATE / CHANNEL_UPDATE gateway events were not updated to the new channel implementation Use Channel.from() in channel event handlers Nov 24, 2019
@abalabahaha
Copy link
Owner

Implemented alternatively in b0c7a07

@Khaaz Khaaz deleted the 565-hotfix branch November 25, 2019 19:00
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants