async function addRole(
  guildId,
  memberId,
  roleId,
  reason,
) {
  const isHigherRolePosition = await isHigherPosition(guildId, botId, roleId);
  if (!isHigherRolePosition) {
    throw new Error(Errors.BOTS_HIGHEST_ROLE_TOO_LOW);
  }
  await requireBotGuildPermissions(guildId, [
    "MANAGE_ROLES",
  ]);
  return await rest.runMethod(
    "put",
    endpoints.GUILD_MEMBER_ROLE(guildId, memberId, roleId),
    {
      reason,
    },
  );
}
/** Add a role to the member */
Add a role to the member
Add a role to the member
async function addRole(
  guildId,
  memberId,
  roleId,
  reason,
) {
  const isHigherRolePosition = await isHigherPosition(guildId, botId, roleId);
  if (!isHigherRolePosition) {
    throw new Error(Errors.BOTS_HIGHEST_ROLE_TOO_LOW);
  }
  await requireBotGuildPermissions(guildId, [
    "MANAGE_ROLES",
  ]);
  return await rest.runMethod(
    "put",
    endpoints.GUILD_MEMBER_ROLE(guildId, memberId, roleId),
    {
      reason,
    },
  );
}
async function addRole ( guildId , memberId , roleId , reason , ) { const isHigherRolePosition = await isHigherPosition ( guildId , botId , roleId ) ; if ( ! isHigherRolePosition ) { throw new Error ( Errors . BOTS_HIGHEST_ROLE_TOO_LOW ) ; } await requireBotGuildPermissions ( guildId , [ "MANAGE_ROLES" , ] ) ; return await rest . runMethod ( "put" , endpoints . GUILD_MEMBER_ROLE ( guildId , memberId , roleId ) , { reason , } , ) ; }
Add a role to the member
Add a role to the member