mirror of
https://github.com/discordeno/discordeno.git
synced 2026-09-17 08:47:22 +00:00
api-docs: Guild Role Member Counts endpoint (#4628)
This commit is contained in:
@@ -180,6 +180,9 @@ export function createBotHelpers<TProps extends TransformersDesiredProperties, T
|
||||
createInvite: async (channelId, options, reason) => {
|
||||
return await bot.rest.createInvite(channelId, options, reason)
|
||||
},
|
||||
getGuildRoleMemberCounts: async (guildId) => {
|
||||
return await bot.rest.getGuildRoleMemberCounts(guildId)
|
||||
},
|
||||
createRole: async (guildId, options, reason) => {
|
||||
return bot.transformers.role(bot, snakelize(await bot.rest.createRole(guildId, options, reason)), { guildId })
|
||||
},
|
||||
@@ -866,6 +869,7 @@ export type BotHelpers<TProps extends TransformersDesiredProperties, TBehavior e
|
||||
) => Promise<SetupDesiredProps<Sticker, TProps, TBehavior>>
|
||||
createGuildTemplate: (guildId: BigString, options: CreateTemplate) => Promise<Template>
|
||||
createInvite: (channelId: BigString, options?: CreateChannelInvite, reason?: string) => Promise<Camelize<DiscordInvite>>
|
||||
getGuildRoleMemberCounts: (guildId: BigString) => Promise<Record<string, number>>
|
||||
createRole: (guildId: BigString, options: CreateGuildRole, reason?: string) => Promise<SetupDesiredProps<Role, TProps, TBehavior>>
|
||||
createScheduledEvent: (
|
||||
guildId: BigString,
|
||||
|
||||
@@ -819,6 +819,10 @@ export function createRestManager(options: CreateRestManagerOptions): RestManage
|
||||
return await rest.post<DiscordInvite>(rest.routes.channels.invites(channelId), { body, reason })
|
||||
},
|
||||
|
||||
async getGuildRoleMemberCounts(guildId) {
|
||||
return await rest.get<Record<string, number>>(rest.routes.guilds.roles.memberCounts(guildId))
|
||||
},
|
||||
|
||||
async createRole(guildId, body, reason) {
|
||||
return await rest.post<DiscordRole>(rest.routes.guilds.roles.all(guildId), { body, reason })
|
||||
},
|
||||
|
||||
@@ -458,6 +458,9 @@ export function createRoutes(): RestRoutes {
|
||||
member: (guildId, memberId, roleId) => {
|
||||
return `/guilds/${guildId}/members/${memberId}/roles/${roleId}`
|
||||
},
|
||||
memberCounts: (guildId) => {
|
||||
return `/guilds/${guildId}/roles/member-counts`
|
||||
},
|
||||
},
|
||||
stickers: (guildId) => {
|
||||
return `/guilds/${guildId}/stickers`
|
||||
|
||||
@@ -558,6 +558,16 @@ export interface RestManager {
|
||||
* @see {@link https://discord.com/developers/docs/resources/channel#create-channel-invite}
|
||||
*/
|
||||
createInvite: (channelId: BigString, options?: CreateChannelInvite, reason?: string) => Promise<Camelize<DiscordInvite>>
|
||||
/**
|
||||
* Get guild role member counts
|
||||
*
|
||||
* Returns a map of role IDs to the number of members with the role. Does not include the \@everyone role.
|
||||
*
|
||||
* @param guildId - The ID of the guild to get role member counts for.
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-role-member-counts}
|
||||
*/
|
||||
getGuildRoleMemberCounts: (guildId: BigString) => Promise<Record<string, number>>
|
||||
/**
|
||||
* Creates a role in a guild.
|
||||
*
|
||||
|
||||
@@ -215,6 +215,8 @@ export interface RestRoutes {
|
||||
all: (guildId: BigString) => string
|
||||
/** Route for handling a members roles in a guild. */
|
||||
member: (guildId: BigString, memberId: BigString, roleId: BigString) => string
|
||||
/** Route for the role member counts */
|
||||
memberCounts: (guildId: BigString) => string
|
||||
}
|
||||
/** Route for handling a specific guild sticker. */
|
||||
stickers: (guildId: BigString) => string
|
||||
|
||||
Reference in New Issue
Block a user