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
types(GuildChannelManager): correct fetch
return type
#8549
Conversation
The latest updates on your projects. Learn more about Vercel for Git ↗︎
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation needs to be updated too:
discord.js/packages/discord.js/src/managers/GuildChannelManager.js
Lines 316 to 332 in 249ba0a
/** | |
* Obtains one or more guild channels from Discord, or the channel cache if they're already available. | |
* @param {Snowflake} [id] The channel's id | |
* @param {BaseFetchOptions} [options] Additional options for this fetch | |
* @returns {Promise<?GuildChannel|Collection<Snowflake, GuildChannel>>} | |
* @example | |
* // Fetch all channels from the guild (excluding threads) | |
* message.guild.channels.fetch() | |
* .then(channels => console.log(`There are ${channels.size} channels.`)) | |
* .catch(console.error); | |
* @example | |
* // Fetch a single channel | |
* message.guild.channels.fetch('222197033908436994') | |
* .then(channel => console.log(`The channel name is: ${channel.name}`)) | |
* .catch(console.error); | |
*/ | |
async fetch(id, { cache = true, force = false } = {}) { |
GuildChannel
doesn't include thread channels.
87bfaef
to
281811c
Compare
c7d9603
to
0b5c130
Compare
…etch-channels-threads
Done. |
Co-authored-by: Almeida <almeidx@pm.me>
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Fetching multiple channels actually calls ChannelManager#_add()
so it appears even channels in the collection may be null
.
Codecov Report
@@ Coverage Diff @@
## main #8549 +/- ##
==========================================
+ Coverage 86.47% 92.01% +5.53%
==========================================
Files 87 75 -12
Lines 8675 7160 -1515
Branches 1110 1023 -87
==========================================
- Hits 7502 6588 -914
+ Misses 1131 531 -600
+ Partials 42 41 -1
Flags with carried forward coverage won't be shown. Click here to find out more.
📣 We’re building smart automated test selection to slash your CI/CD build times. Learn more |
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Signed-off-by: RedGuy12 <61329810+RedGuy12@users.noreply.github.com>
Please describe the changes this PR makes and why it should be merged:
The documentation for
/channels/{channelId}
says:This causes me to believe that this route, and
GuildChannelManager#fetch
, can fetch threads. I tested it and it works.Note that the bulk fetch type doesn't need to be updated, as the documentation for that specifically mentions the exclusion of threads:
Status and versioning classification: