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:
Almeida
2024-08-21 23:14:33 +01:00
committed by GitHub
parent 00accf7470
commit bba0e72e22
2 changed files with 34 additions and 7 deletions

View File

@@ -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
*