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

fix(MessageMentions#channels): Fix type of channels of mentions #5370

Merged
merged 5 commits into from
Apr 14, 2021
Merged

fix(MessageMentions#channels): Fix type of channels of mentions #5370

merged 5 commits into from
Apr 14, 2021

Conversation

GrapeColor
Copy link
Contributor

Please describe the changes this PR makes and why it should be merged:
Change type of channels mentions from TextChannel to GuildChannel.
MessageMentions#channels are defined as Collection<Snowflake, TextChannels> even though they return Collection<Snowflake, GuildChannels>.

Status and versioning classification:

  • Code changes have been tested against the Discord API, or there are no code changes
  • I know how to update typings and have done so, or typings don't need updating

Change type of channels mentions from TextChannel to GuildChannel.
@almostSouji
Copy link
Member

almostSouji commented Mar 4, 2021

Incorrect, since we parse channel mentions from content and resolve them based on the available cache it can be any channel type, including DMChannel, the only requirement is <#id> to be present and the corresponding channel to be cached.

(meaning the docs and typings are wrong)

Change type of channels mentions from GuildChannel to Channel.
@GrapeColor
Copy link
Contributor Author

When I verified it, it was exactly as you said.
I fixed it again and committed.

@almostSouji
Copy link
Member

Docstring also needs updating

@GrapeColor
Copy link
Contributor Author

Oops.
Excuse me again and again.

Is it all right like this?

@SpaceEEC
Copy link
Member

Can you also update the types for the private properties?

private _channels: Collection<Snowflake, GuildChannel> | null;

* @type {?Collection<Snowflake, GuildChannel>}

@GrapeColor
Copy link
Contributor Author

Thank you for telling me.
It seems that #has() was also wrong, so I fixed it together.

@iCrawl iCrawl merged commit 565d7b3 into discordjs:master Apr 14, 2021
@iCrawl iCrawl added this to the Version 13 milestone Jun 27, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants