From 8ce724479712a840b4188f9cc31594b9ac603dcd Mon Sep 17 00:00:00 2001 From: Vaporox Date: Thu, 12 Aug 2021 16:53:05 +0200 Subject: [PATCH] feat(GuildManager): allow setting with_counts to false --- src/managers/GuildManager.js | 3 ++- typings/index.d.ts | 3 ++- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/src/managers/GuildManager.js b/src/managers/GuildManager.js index 42ac60578abc..fd2b1bd49769 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 a5ca9b5aa335..344bc774b9d9 100644 --- a/typings/index.d.ts +++ b/typings/index.d.ts @@ -130,7 +130,7 @@ import { RawWelcomeChannelData, RawWelcomeScreenData, RawWidgetData, - RawWidgetMemberData + RawWidgetMemberData, } from './rawDataTypes'; //#region Classes @@ -3524,6 +3524,7 @@ export interface FetchedThreads { export interface FetchGuildOptions extends BaseFetchOptions { guild: GuildResolvable; + withCounts?: boolean; } export interface FetchGuildsOptions {