swc/bundler/tests/.cache/deno/11f0bd5f0035639283309990494297d8e582b77e.ts
강동윤 d60c3242af
fix(swc): Fix bugs (#1739)
swc_bundler:
 - Fix cycle detection for complex circular imports. (denoland/deno#10752)

swc_ecma_transforms_typescript:
 - Allow using large values for an enum variant.
2021-05-25 14:30:17 +09:00

22 lines
963 B
TypeScript

// Loaded from https://deno.land/x/discordeno@11.0.0-rc.2/src/helpers/roles/edit_role.ts
import { rest } from "../../rest/rest.ts";
import { structures } from "../../structures/mod.ts";
import type { CreateGuildRole } from "../../types/guilds/create_guild_role.ts";
import type { Role } from "../../types/permissions/role.ts";
import { endpoints } from "../../util/constants.ts";
import { calculateBits, requireBotGuildPermissions } from "../../util/permissions.ts";
/** Edit a guild role. Requires the MANAGE_ROLES permission. */
export async function editRole(guildId: bigint, id: bigint, options: CreateGuildRole) {
await requireBotGuildPermissions(guildId, ["MANAGE_ROLES"]);
const result = await rest.runMethod<Role>("patch", endpoints.GUILD_ROLE(guildId, id), {
...options,
permissions: options.permissions ? calculateBits(options.permissions) : undefined,
});
return await structures.createDiscordenoRole({ role: result, guildId });
}