mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
refactor: fetch options consistency (#5824)
This commit is contained in:
@@ -122,8 +122,7 @@ class GuildChannelManager extends BaseManager {
|
||||
/**
|
||||
* Obtains one or more guild channels from Discord, or the channel cache if they're already available.
|
||||
* @param {Snowflake} [id] ID of the channel
|
||||
* @param {boolean} [cache=true] Whether to cache the new channel objects if it weren't already
|
||||
* @param {boolean} [force=false] Whether to skip the cache check and request the API
|
||||
* @param {BaseFetchOptions} [options] Additional options for this fetch
|
||||
* @returns {Promise<?GuildChannel|Collection<Snowflake, GuildChannel>>}
|
||||
* @example
|
||||
* // Fetch all channels from the guild
|
||||
@@ -136,7 +135,7 @@ class GuildChannelManager extends BaseManager {
|
||||
* .then(channel => console.log(`The channel name is: ${channel.name}`))
|
||||
* .catch(console.error);
|
||||
*/
|
||||
async fetch(id, cache = true, force = false) {
|
||||
async fetch(id, { cache = true, force = false } = {}) {
|
||||
if (id && !force) {
|
||||
const existing = this.cache.get(id);
|
||||
if (existing) return existing;
|
||||
|
||||
Reference in New Issue
Block a user