mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-15 19:13:31 +01:00
feat(api): add getMemberBans() query options and getMemberBan() (#9569)
This commit is contained in:
@@ -11,6 +11,8 @@ import type {
|
|||||||
RESTGetAPIAuditLogResult,
|
RESTGetAPIAuditLogResult,
|
||||||
RESTGetAPIAutoModerationRuleResult,
|
RESTGetAPIAutoModerationRuleResult,
|
||||||
RESTGetAPIAutoModerationRulesResult,
|
RESTGetAPIAutoModerationRulesResult,
|
||||||
|
RESTGetAPIGuildBanResult,
|
||||||
|
RESTGetAPIGuildBansQuery,
|
||||||
RESTGetAPIGuildBansResult,
|
RESTGetAPIGuildBansResult,
|
||||||
RESTGetAPIGuildChannelsResult,
|
RESTGetAPIGuildChannelsResult,
|
||||||
RESTGetAPIGuildEmojiResult,
|
RESTGetAPIGuildEmojiResult,
|
||||||
@@ -241,12 +243,32 @@ export class GuildsAPI {
|
|||||||
/**
|
/**
|
||||||
* Fetches a guild member ban
|
* Fetches a guild member ban
|
||||||
*
|
*
|
||||||
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-bans}
|
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-ban}
|
||||||
* @param guildId - The id of the guild to fetch the ban from
|
* @param guildId - The id of the guild to fetch the ban from
|
||||||
* @param options - The options for fetching the guild member ban
|
* @param userId - The id of the user to fetch the ban
|
||||||
|
* @param options - The options for fetching the ban
|
||||||
*/
|
*/
|
||||||
public async getMemberBans(guildId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
public async getMemberBan(guildId: Snowflake, userId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||||
return this.rest.get(Routes.guildBans(guildId), { signal }) as Promise<RESTGetAPIGuildBansResult>;
|
return this.rest.get(Routes.guildBan(guildId, userId), { signal }) as Promise<RESTGetAPIGuildBanResult>;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Fetches guild member bans
|
||||||
|
*
|
||||||
|
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-bans}
|
||||||
|
* @param guildId - The id of the guild to fetch the bans from
|
||||||
|
* @param query - The query options for fetching the bans
|
||||||
|
* @param options - The options for fetching the bans
|
||||||
|
*/
|
||||||
|
public async getMemberBans(
|
||||||
|
guildId: Snowflake,
|
||||||
|
query: RESTGetAPIGuildBansQuery = {},
|
||||||
|
{ signal }: Pick<RequestData, 'signal'> = {},
|
||||||
|
) {
|
||||||
|
return this.rest.get(Routes.guildBans(guildId), {
|
||||||
|
query: makeURLSearchParams(query),
|
||||||
|
signal,
|
||||||
|
}) as Promise<RESTGetAPIGuildBansResult>;
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user