async function createRole(
  guildId,
  options,
  reason,
) {
  await requireBotGuildPermissions(guildId, [
    "MANAGE_ROLES",
  ]);
  const result = await rest.runMethod("post", endpoints.GUILD_ROLES(guildId), {
    ...options,
    permissions: calculateBits(options?.permissions || []),
    reason,
  });
  const role = await structures.createDiscordenoRole({
    role: result,
    guildId,
  });
  const guild = await cacheHandlers.get("guilds", guildId);
  if (guild) {
    guild.roles.set(role.id, role);
    await cacheHandlers.set("guilds", guildId, guild);
  }
  return role;
}
/** Create a new role for the guild. Requires the MANAGE_ROLES permission. */
Create a new role for the guild. Requires the MANAGE_ROLES permission.
Create a new role for the guild . Requires the MANAGE_ROLES permission .
async function createRole(
  guildId,
  options,
  reason,
) {
  await requireBotGuildPermissions(guildId, [
    "MANAGE_ROLES",
  ]);
  const result = await rest.runMethod("post", endpoints.GUILD_ROLES(guildId), {
    ...options,
    permissions: calculateBits(options?.permissions || []),
    reason,
  });
  const role = await structures.createDiscordenoRole({
    role: result,
    guildId,
  });
  const guild = await cacheHandlers.get("guilds", guildId);
  if (guild) {
    guild.roles.set(role.id, role);
    await cacheHandlers.set("guilds", guildId, guild);
  }
  return role;
}
async function createRole ( guildId , options , reason , ) { await requireBotGuildPermissions ( guildId , [ "MANAGE_ROLES" , ] ) ; const result = await rest . runMethod ( "post" , endpoints . GUILD_ROLES ( guildId ) , { ... options , permissions : calculateBits ( options ?. permissions || [ ] ) , reason , } ) ; const role = await structures . createDiscordenoRole ( { role : result , guildId , } ) ; const guild = await cacheHandlers . get ( "guilds" , guildId ) ; if ( guild ) { guild . roles . set ( role . id , role ) ; await cacheHandlers . set ( "guilds" , guildId , guild ) ; } return role ; }
Create a new role for the guild.
Create a new role for the guild .