Table of Contents

Class SocketRole

Namespace
Kook.WebSocket
Assembly
Kook.Net.WebSocket.dll

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

public class SocketRole : SocketEntity<uint>, IRole, IEntity<uint>, IDeletable, IMentionable, IComparable<IRole>
Inheritance
SocketRole
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.

ColorType

Gets the type of the color given to users of this role.

public ColorType ColorType { get; }

Property Value

ColorType

A ColorType struct representing the color type of this role.

GradientColor

Gets the gradient color given to users of this role.

public GradientColor? GradientColor { get; }

Property Value

GradientColor?

A GradientColor struct representing the gradient color of this role; null if the role does not have a gradient color.

Guild

Gets the guild that owns this role.

public SocketGuild Guild { get; }

Property Value

SocketGuild

A SocketGuild representing the parent guild of this role.

IsEveryone

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

public bool IsEveryone { get; }

Property Value

bool

true if the role is @everyone; otherwise false.

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.

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.

KMarkdownMention

Returns a special string used to mention this object in KMarkdown formatted text.

public string KMarkdownMention { get; }

Property Value

string

A string that is recognized by Kook as a mention in KMarkdown formatted text.

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.

PlainTextMention

Returns a special string used to mention this object in plain text formatted text.

public string PlainTextMention { get; }

Property Value

string

A string that is recognized by Kook as a mention in plain text formatted text.

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.

Type

Gets the type of this role.

public RoleType? Type { get; }

Property Value

RoleType?

A RoleType representing the type of 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

GetUsersAsync(RequestOptions)

Gets a collection of users with this role.

public IAsyncEnumerable<IReadOnlyCollection<SocketGuildUser>> GetUsersAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

IAsyncEnumerable<IReadOnlyCollection<SocketGuildUser>>

Paged collection of users with this role.

Remarks

If the guild this role belongs to does not has all members cached locally by checking HasAllMembers, this method will request the data via REST and update the guild users cache, otherwise it will return the cached data.

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 resolves to Name.