mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-11 00:53:31 +01:00
feat(Guild#fetch): withCount param (#4111)
This commit is contained in:
@@ -305,6 +305,26 @@ class Guild extends Base {
|
||||
*/
|
||||
if (typeof data.max_presences !== 'undefined') this.maximumPresences = data.max_presences || 25000;
|
||||
|
||||
/**
|
||||
* The approximate amount of members the guild has
|
||||
* <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info>
|
||||
* @type {?number}
|
||||
* @name Guild#approximateMemberCount
|
||||
*/
|
||||
if (typeof data.approximate_member_count !== 'undefined') {
|
||||
this.approximateMemberCount = data.approximate_member_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* The approximate amount of presences the guild has
|
||||
* <info>You will need to fetch the guild using {@link Guild#fetch} if you want to receive this parameter</info>
|
||||
* @type {?number}
|
||||
* @name Guild#approximatePresenceCount
|
||||
*/
|
||||
if (typeof data.approximate_presence_count !== 'undefined') {
|
||||
this.approximatePresenceCount = data.approximate_presence_count;
|
||||
}
|
||||
|
||||
/**
|
||||
* The vanity URL code of the guild, if any
|
||||
* @type {?string}
|
||||
@@ -593,7 +613,7 @@ class Guild extends Base {
|
||||
fetch() {
|
||||
return this.client.api
|
||||
.guilds(this.id)
|
||||
.get()
|
||||
.get({ query: { with_counts: true } })
|
||||
.then(data => {
|
||||
this._patch(data);
|
||||
return this;
|
||||
|
||||
2
typings/index.d.ts
vendored
2
typings/index.d.ts
vendored
@@ -588,6 +588,8 @@ declare module 'discord.js' {
|
||||
public afkChannelID: Snowflake | null;
|
||||
public afkTimeout: number;
|
||||
public applicationID: Snowflake | null;
|
||||
public approximateMemberCount?: number;
|
||||
public approximatePresenceCount?: number;
|
||||
public available: boolean;
|
||||
public banner: string | null;
|
||||
public channels: GuildChannelManager;
|
||||
|
||||
Reference in New Issue
Block a user