Show / Hide Table of Contents

# Class SocketRole

Represents a WebSocket-based role to be given to a guild user.

##### Inheritance

System.Object
SocketEntity<System.UInt64>
SocketRole

##### Implements

IRole
ISnowflakeEntity
IEntity<System.UInt64>
IDeletable
IMentionable
System.IComparable<IRole>

##### Inherited Members

SocketEntity<UInt64>.Id
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()

###### Namespace: Discord.WebSocket

###### Assembly: Discord.Net.WebSocket.dll

##### Syntax

    public class SocketRole : SocketEntity<ulong>, IRole, ISnowflakeEntity, IEntity<ulong>, IDeletable, IMentionable, IComparable<IRole>

### Properties

| Improve this Doc View Source

#### Color

Gets the color given to users of this role.

##### Declaration

    public Color Color { get; }

##### Property Value

Type | Description
--- | ---
Color | A Color struct representing the color of this role.

| Improve this Doc View Source

#### CreatedAt

Gets when the snowflake was created.

##### Declaration

    public DateTimeOffset CreatedAt { get; }

##### Property Value

Type | Description
--- | ---
System.DateTimeOffset | A System.DateTimeOffset representing when the entity was first created.

| Improve this Doc View Source

#### Guild

Gets the guild that owns this role.

##### Declaration

    public SocketGuild Guild { get; }

##### Property Value

Type | Description
--- | ---
SocketGuild | A SocketGuild representing the parent guild of this role.

| Improve this Doc View Source

#### IsEveryone

Returns a value that determines if the role is an @everyone role.

##### Declaration

    public bool IsEveryone { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean | `true` if the role is @everyone; otherwise `false`.

| Improve this Doc View Source

#### IsHoisted

Gets a value that indicates whether the role can be separated in the user list.

##### Declaration

    public bool IsHoisted { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean | `true` if users of this role are separated in the user list; otherwise `false`.

| Improve this Doc View Source

#### IsManaged

Gets a value that indicates whether the role is managed by Discord.

##### Declaration

    public bool IsManaged { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean | `true` if this role is automatically managed by Discord; otherwise `false`.

| Improve this Doc View Source

#### IsMentionable

Gets a value that indicates whether the role is mentionable.

##### Declaration

    public bool IsMentionable { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean | `true` if this role may be mentioned in messages; otherwise `false`.

| Improve this Doc View Source

#### Members

##### Declaration

    public IEnumerable<SocketGuildUser> Members { get; }

##### Property Value

Type | Description
--- | ---
System.Collections.Generic.IEnumerable<SocketGuildUser> |

| Improve this Doc View Source

#### Mention

Returns a special string used to mention this object.

##### Declaration

    public string Mention { get; }

##### Property Value

Type | Description
--- | ---
System.String | A string that is recognized by Discord as a mention (e.g. <@168693960628371456>).

| Improve this Doc View Source

#### Name

Gets the name of this role.

##### Declaration

    public string Name { get; }

##### Property Value

Type | Description
--- | ---
System.String | A string containing the name of this role.

| Improve this Doc View Source

#### Permissions

Gets the permissions granted to members of this role.

##### Declaration

    public GuildPermissions Permissions { get; }

##### Property Value

Type | Description
--- | ---
GuildPermissions | A GuildPermissions struct that this role possesses.

| Improve this Doc View Source

#### Position

Gets this role's position relative to other roles in the same guild.

##### Declaration

    public int Position { get; }

##### Property Value

Type | Description
--- | ---
System.Int32 | An System.Int32 representing the position of the role in the role list of the guild.

### Methods

| Improve this Doc View Source

#### CompareTo(IRole)

##### Declaration

    public int CompareTo(IRole role)

##### Parameters

Type | Name | Description
--- | --- | ---
IRole | role |

##### Returns

Type | Description
--- | ---
System.Int32 |

| Improve this Doc View Source

#### DeleteAsync(RequestOptions)

Deletes this object and all its children.

##### Declaration

    public Task DeleteAsync(RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options | The options to be used when sending the request.

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

| Improve this Doc View Source

#### ModifyAsync(Action<RoleProperties>, RequestOptions)

Modifies this role.

##### Declaration

    public Task ModifyAsync(Action<RoleProperties> func, RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Action<RoleProperties> | func | A delegate containing the properties to modify the role with.
RequestOptions | options | The options to be used when sending the request.

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task | A task that represents the asynchronous modification operation.

##### Remarks

This method modifies this role with the specified properties. To see an example of this method and what properties are available, please refer to RoleProperties.

| Improve this Doc View Source

#### ToString()

Gets the name of the role.

##### Declaration

    public override string ToString()

##### Returns

Type | Description
--- | ---
System.String | A string that resolves to Name.

##### Overrides

System.Object.ToString()

### Explicit Interface Implementations

| Improve this Doc View Source

#### IRole.Guild

Gets the guild that owns this role.

##### Declaration

    IGuild IRole.Guild { get; }

##### Returns

Type | Description
--- | ---
IGuild | A guild representing the parent guild of this role.

### Implements

IRole
ISnowflakeEntity
IEntity<TId>
IDeletable
IMentionable
System.IComparable<T>