Skip to content
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

feat(GuildManager): allow setting with_counts to false #6407

Merged
merged 1 commit into from Aug 12, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
3 changes: 2 additions & 1 deletion src/managers/GuildManager.js
Expand Up @@ -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
*/

/**
Expand All @@ -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);
}

Expand Down
3 changes: 2 additions & 1 deletion typings/index.d.ts
Expand Up @@ -130,7 +130,7 @@ import {
RawWelcomeChannelData,
RawWelcomeScreenData,
RawWidgetData,
RawWidgetMemberData
RawWidgetMemberData,
} from './rawDataTypes';

//#region Classes
Expand Down Expand Up @@ -3524,6 +3524,7 @@ export interface FetchedThreads {

export interface FetchGuildOptions extends BaseFetchOptions {
guild: GuildResolvable;
withCounts?: boolean;
}

export interface FetchGuildsOptions {
Expand Down