From 14aea1290061c225feb9d9f5378508d937e34a69 Mon Sep 17 00:00:00 2001 From: Jan <66554238+vaporox@users.noreply.github.com> Date: Thu, 12 Aug 2021 23:12:11 +0200 Subject: [PATCH] feat(GuildManager): allow setting with_counts to false (#6407) --- src/managers/GuildManager.js | 3 ++- typings/index.d.ts | 1 + 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/src/managers/GuildManager.js b/src/managers/GuildManager.js index 1656940408db..76eacd4e7855 100644 --- a/src/managers/GuildManager.js +++ b/src/managers/GuildManager.js @@ -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); } diff --git a/typings/index.d.ts b/typings/index.d.ts index fe80b1c27554..3dfdb7bd4a0b 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -3578,6 +3578,7 @@ export interface FetchedThreads { export interface FetchGuildOptions extends BaseFetchOptions { guild: GuildResolvable; + withCounts?: boolean; } export interface FetchGuildsOptions {