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

refactor(Channels): fix incorrectly shared properties #6262

Merged
merged 8 commits into from
Aug 4, 2021

Conversation

monbrey
Copy link
Member

@monbrey monbrey commented Aug 1, 2021

This addresses a number of issues with various channel properties being defined too generically, resulting in them existing on channel subclasses where they aren't supported by the API.

Changes

  • New class BaseGuildTextChannel extends GuildChannel, implements TextBasedChannel
  • TextChannel and NewsChannel both extend BaseGuildTextChannel
  • rateLimitPerUser now only exists on TextChannel
  • GuildChannel#setTopic moved to BaseGuildTextChannel and StageChannel
  • GuildChannel#createInvite moved to BaseGuildTextChannel, BaseGuildVoiceChannel and StoreChannel
  • GuildChannel#fetchInvites moved to BaseGuildTextChannel, BaseGuildVoiceChannel and StoreChannel
  • BaseGuildTextChannel#setType now has override types

Status and versioning classification:

  • I know how to update typings and have done so, or typings don't need updating
  • This PR includes breaking changes (methods removed or renamed, parameters moved or removed)

src/structures/BaseGuildTextChannel.js Outdated Show resolved Hide resolved
@ImRodry
Copy link
Contributor

ImRodry commented Aug 1, 2021

Should probably link #4831

@kyranet kyranet linked an issue Aug 1, 2021 that may be closed by this pull request
typings/index.d.ts Show resolved Hide resolved
typings/index.d.ts Show resolved Hide resolved
typings/index.d.ts Outdated Show resolved Hide resolved
src/structures/TextChannel.js Show resolved Hide resolved
src/structures/TextChannel.js Show resolved Hide resolved
Copy link
Member

@Jiralite Jiralite left a comment

Choose a reason for hiding this comment

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

GuildChannel#setTopic moved to BaseGuildTextChannel

Stage channels would receive this method from BaseGuildVoiceChannel which extends GuildChannel, which means this would be lost and needs implementing back in somewhere...

Perhaps just stick it in the stage channel itself? That way, we could customise the description of it as it's a unique case for a stage channel?

@ckohen
Copy link
Member

ckohen commented Aug 1, 2021

Stage channel topics seem to have no purpose at this point. The api accepts and sends topic on stage channels, but it doesn't exist in the UI. I suspect this is a remnant after moving to stage instances. But, it probably should be added back directly.

@Jiralite
Copy link
Member

Jiralite commented Aug 1, 2021

Is it still documented that it can be used in a stage channel? I see only text channels and announcement channels here upon editing a channel, which is how it is currently called!

Despite the API accepting it, if it does nothing and doesn't seem to be documented... probably best to not add it back in, since stage instances are the way to go right now?

@ckohen
Copy link
Member

ckohen commented Aug 1, 2021

If its undocumented, lets yeet it.

src/structures/GuildChannel.js Show resolved Hide resolved
src/structures/BaseGuildTextChannel.js Outdated Show resolved Hide resolved
src/structures/BaseGuildTextChannel.js Outdated Show resolved Hide resolved
@iCrawl
Copy link
Member

iCrawl commented Aug 1, 2021

This needs a rebase.

@iCrawl iCrawl requested a review from SpaceEEC August 3, 2021 22:09
@iCrawl iCrawl merged commit 5be471b into discordjs:master Aug 4, 2021
@monbrey monbrey deleted the text-channel-refactor branch August 6, 2021 23:01
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.

Some channels that extend GuildChannel improperly inherit setTopic
9 participants