mirror of
https://github.com/discordeno/discordeno.git
synced 2026-06-04 09:50:07 +00:00
17 lines
745 B
TypeScript
17 lines
745 B
TypeScript
import type { CreateGuildRole } from "../../types/guilds/createGuildRole.ts";
|
|
import type { Role } from "../../types/permissions/role.ts";
|
|
import type { Bot } from "../../bot.ts";
|
|
|
|
/** Edit a guild role. Requires the MANAGE_ROLES permission. */
|
|
export async function editRole(bot: Bot, guildId: bigint, id: bigint, options: CreateGuildRole) {
|
|
const result = await bot.rest.runMethod<Role>(bot.rest, "patch", bot.constants.endpoints.GUILD_ROLE(guildId, id), {
|
|
name: options.name,
|
|
color: options.color,
|
|
hoist: options.hoist,
|
|
mentionable: options.mentionable,
|
|
permissions: options.permissions ? bot.utils.calculateBits(options.permissions) : undefined,
|
|
});
|
|
|
|
return bot.transformers.role(bot, { role: result, guildId });
|
|
}
|