mirror of
https://github.com/discordjs/discord.js.git
synced 2026-03-14 18:43:31 +01:00
refactor: use get guild role endpoint (#10443)
* refactor: use get guild role endpoint * style: import order --------- Co-authored-by: kodiakhq[bot] <49736102+kodiakhq[bot]@users.noreply.github.com>
This commit is contained in:
@@ -28,6 +28,7 @@ import {
|
||||
type RESTGetAPIGuildPruneCountResult,
|
||||
type RESTGetAPIGuildQuery,
|
||||
type RESTGetAPIGuildResult,
|
||||
type RESTGetAPIGuildRoleResult,
|
||||
type RESTGetAPIGuildRolesResult,
|
||||
type RESTGetAPIGuildScheduledEventQuery,
|
||||
type RESTGetAPIGuildScheduledEventResult,
|
||||
@@ -397,6 +398,18 @@ export class GuildsAPI {
|
||||
return this.rest.get(Routes.guildRoles(guildId), { signal }) as Promise<RESTGetAPIGuildRolesResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Get a role in a guild
|
||||
*
|
||||
* @see {@link https://discord.com/developers/docs/resources/guild#get-guild-role}
|
||||
* @param guildId - The id of the guild to fetch the role from
|
||||
* @param roleId - The id of the role to fetch
|
||||
* @param options - The options for fetching the guild role
|
||||
*/
|
||||
public async getRole(guildId: Snowflake, roleId: Snowflake, { signal }: Pick<RequestData, 'signal'> = {}) {
|
||||
return this.rest.get(Routes.guildRole(guildId, roleId), { signal }) as Promise<RESTGetAPIGuildRoleResult>;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates a guild role
|
||||
*
|
||||
|
||||
Reference in New Issue
Block a user