mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-09 16:13:31 +01:00
feat(GuildsAPI): add getRoleMemberCounts (#11353)
Co-authored-by: Jiralite <33201955+Jiralite@users.noreply.github.com>
This commit is contained in:
@@ -1,6 +1,6 @@
|
||||
/* eslint-disable jsdoc/check-param-names */
|
||||
|
||||
import { makeURLSearchParams, type RawFile, type REST, type RequestData } from '@discordjs/rest';
|
||||
import { makeURLSearchParams, type REST, type RawFile, type RequestData } from '@discordjs/rest';
|
||||
import {
|
||||
Routes,
|
||||
type GuildWidgetStyle,
|
||||
@@ -27,6 +27,7 @@ import {
|
||||
type RESTGetAPIGuildPruneCountResult,
|
||||
type RESTGetAPIGuildQuery,
|
||||
type RESTGetAPIGuildResult,
|
||||
type RESTGetAPIGuildRoleMemberCountsResult,
|
||||
type RESTGetAPIGuildRoleResult,
|
||||
type RESTGetAPIGuildRolesResult,
|
||||
type RESTGetAPIGuildScheduledEventQuery,
|
||||
@@ -35,6 +36,8 @@ import {
|
||||
type RESTGetAPIGuildScheduledEventUsersResult,
|
||||
type RESTGetAPIGuildScheduledEventsQuery,
|
||||
type RESTGetAPIGuildScheduledEventsResult,
|
||||
type RESTGetAPIGuildSoundboardSoundResult,
|
||||
type RESTGetAPIGuildSoundboardSoundsResult,
|
||||
type RESTGetAPIGuildStickerResult,
|
||||
type RESTGetAPIGuildStickersResult,
|
||||
type RESTGetAPIGuildTemplatesResult,
|
||||
@@ -62,6 +65,8 @@ import {
|
||||
type RESTPatchAPIGuildRoleResult,
|
||||
type RESTPatchAPIGuildScheduledEventJSONBody,
|
||||
type RESTPatchAPIGuildScheduledEventResult,
|
||||
type RESTPatchAPIGuildSoundboardSoundJSONBody,
|
||||
type RESTPatchAPIGuildSoundboardSoundResult,
|
||||
type RESTPatchAPIGuildStickerJSONBody,
|
||||
type RESTPatchAPIGuildStickerResult,
|
||||
type RESTPatchAPIGuildTemplateJSONBody,
|
||||
@@ -84,6 +89,8 @@ import {
|
||||
type RESTPostAPIGuildRoleResult,
|
||||
type RESTPostAPIGuildScheduledEventJSONBody,
|
||||
type RESTPostAPIGuildScheduledEventResult,
|
||||
type RESTPostAPIGuildSoundboardSoundJSONBody,
|
||||
type RESTPostAPIGuildSoundboardSoundResult,
|
||||
type RESTPostAPIGuildStickerFormDataBody,
|
||||
type RESTPostAPIGuildStickerResult,
|
||||
type RESTPostAPIGuildTemplatesJSONBody,
|
||||
@@ -96,12 +103,6 @@ import {
|
||||
type RESTPutAPIGuildOnboardingJSONBody,
|
||||
type RESTPutAPIGuildOnboardingResult,
|
||||
type RESTPutAPIGuildTemplateSyncResult,
|
||||
type RESTGetAPIGuildSoundboardSoundResult,
|
||||
type RESTGetAPIGuildSoundboardSoundsResult,
|
||||
type RESTPatchAPIGuildSoundboardSoundJSONBody,
|
||||
type RESTPatchAPIGuildSoundboardSoundResult,
|
||||
type RESTPostAPIGuildSoundboardSoundJSONBody,
|
||||
type RESTPostAPIGuildSoundboardSoundResult,
|
||||
type Snowflake,
|
||||
} from 'discord-api-types/v10';
|
||||
|
||||
@@ -1461,4 +1462,18 @@ export class GuildsAPI {
|
||||
signal,
|
||||
}) as Promise<RESTPutAPIGuildIncidentActionsResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Fetches role member counts for a guild.
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-role-member-counts}
|
||||
* @param guildId - The id of the guild to fetch role member counts for
|
||||
* @param options - The options for fetching role member counts
|
||||
*/
|
||||
public async getRoleMemberCounts(guildId: Snowflake, { auth, signal }: Pick<RequestData, 'auth' | 'signal'> = {}) {
|
||||
return this.rest.get(Routes.guildRoleMemberCounts(guildId), {
|
||||
auth,
|
||||
signal,
|
||||
}) as Promise<RESTGetAPIGuildRoleMemberCountsResult>;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user