mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-13 18:13:29 +01:00
feat(GuildManager): allow setting with_counts to false (#6407)
This commit is contained in:
@@ -246,6 +246,7 @@ class GuildManager extends CachedManager {
|
||||
* Options used to fetch a single guild.
|
||||
* @typedef {BaseFetchOptions} FetchGuildOptions
|
||||
* @property {GuildResolvable} guild The guild to fetch
|
||||
* @property {boolean} [withCounts=true] Whether the approximate member and presence counts should be returned
|
||||
*/
|
||||
|
||||
/**
|
||||
@@ -270,7 +271,7 @@ class GuildManager extends CachedManager {
|
||||
if (existing) return existing;
|
||||
}
|
||||
|
||||
const data = await this.client.api.guilds(id).get({ query: { with_counts: true } });
|
||||
const data = await this.client.api.guilds(id).get({ query: { with_counts: options.withCounts ?? true } });
|
||||
return this._add(data, options.cache);
|
||||
}
|
||||
|
||||
|
||||
1
typings/index.d.ts
vendored
1
typings/index.d.ts
vendored
@@ -3578,6 +3578,7 @@ export interface FetchedThreads {
|
||||
|
||||
export interface FetchGuildOptions extends BaseFetchOptions {
|
||||
guild: GuildResolvable;
|
||||
withCounts?: boolean;
|
||||
}
|
||||
|
||||
export interface FetchGuildsOptions {
|
||||
|
||||
Reference in New Issue
Block a user