Table of Contents

Class RestRole

Namespace
Discord.Rest
Assembly
Discord.Net.Rest.dll

Represents a REST-based role.

public class RestRole : RestEntity<ulong>, IRole, ISnowflakeEntity, IEntity<ulong>, IDeletable, IMentionable, IComparable<IRole>
Inheritance
RestRole
Implements
Inherited Members

Properties

Color

Gets the color given to users of this role.

public Color Color { get; }

Property Value

Color

A Color struct representing the color of this role.

CreatedAt

Gets when the snowflake was created.

public DateTimeOffset CreatedAt { get; }

Property Value

DateTimeOffset

A DateTimeOffset representing when the entity was first created.

Emoji

Gets the unicode emoji of this role.

public Emoji Emoji { get; }

Property Value

Emoji

Remarks

This field is mutually exclusive with Icon, either icon is set or emoji is set.

Flags

Gets flags related to this role.

public RoleFlags Flags { get; }

Property Value

RoleFlags

Icon

Gets the icon of this role.

public string Icon { get; }

Property Value

string

A string containing the hash of this role's icon.

IsEveryone

Gets if this role is the @everyone role of the guild or not.

public bool IsEveryone { get; }

Property Value

bool

IsHoisted

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

public bool IsHoisted { get; }

Property Value

bool

true if users of this role are separated in the user list; otherwise false.

IsManaged

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

public bool IsManaged { get; }

Property Value

bool

true if this role is automatically managed by Discord; otherwise false.

IsMentionable

Gets a value that indicates whether the role is mentionable.

public bool IsMentionable { get; }

Property Value

bool

true if this role may be mentioned in messages; otherwise false.

Mention

Returns a special string used to mention this object.

public string Mention { get; }

Property Value

string

A string that is recognized by Discord as a mention (e.g. <@168693960628371456>).

Name

Gets the name of this role.

public string Name { get; }

Property Value

string

A string containing the name of this role.

Permissions

Gets the permissions granted to members of this role.

public GuildPermissions Permissions { get; }

Property Value

GuildPermissions

A GuildPermissions struct that this role possesses.

Position

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

public int Position { get; }

Property Value

int

An int representing the position of the role in the role list of the guild.

Tags

Gets the tags related to this role.

public RoleTags Tags { get; }

Property Value

RoleTags

A RoleTags object containing all tags related to this role.

Methods

CompareTo(IRole)

Compares the current instance with another object of the same type and returns an integer that indicates whether the current instance precedes, follows, or occurs in the same position in the sort order as the other object.

public int CompareTo(IRole role)

Parameters

role IRole

Returns

int

A value that indicates the relative order of the objects being compared. The return value has these meanings:

Value Meaning
Less than zero This instance precedes other in the sort order.
Zero This instance occurs in the same position in the sort order as other.
Greater than zero This instance follows other in the sort order.

DeleteAsync(RequestOptions)

Deletes this object and all its children.

public Task DeleteAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

GetIconUrl()

Gets the image url of the icon role.

public string GetIconUrl()

Returns

string

An image url of the icon role.

ModifyAsync(Action<RoleProperties>, RequestOptions)

Modifies this role.

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

Parameters

func Action<RoleProperties>

A delegate containing the properties to modify the role with.

options RequestOptions

The options to be used when sending the request.

Returns

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.

ToString()

Gets the name of the role.

public override string ToString()

Returns

string

A string that is the name of the role.