refactor(ThreadManager)!: match parent ID when fetching a single thread #10557
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Please describe the changes this PR makes and why it should be merged:
Currently as it stands, when fetching a single thread, discord.js simply returns
ChannelManager#fetch
, so ideally, one can fetch any channel of a guild, not just a thread in the channel of the manager, this is misleading as the docs state the return type to be aThreadChannel
(or equivalent). This pr adds in a check to match the parent id of the returned channel with the id of manager's channel and throws an error if it doesn't match. It also makes sense to have it this way, as one would expect to only get a thread of the channel the manager is of, similar to howfetchActive
(and others) do.I don't think it's breaking in any way as it doesn't change the return type or anything, just adds in a way to ensure it returns a thread of the parent channel.
Status and versioning classification: