Class SocketRole
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
ColorType
Gets the type of the color given to users of this role.
public ColorType ColorType { get; }
Property Value
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; otherwisefalse
.
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; otherwisefalse
.
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; otherwisefalse
.
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
Type
Gets the type of this role.
public RoleType Type { get; }
Property Value
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
RequestOptionsThe options to be used when sending the request.
Returns
GetUsersAsync(RequestOptions?)
Gets a collection of users with this role.
public IAsyncEnumerable<IReadOnlyCollection<SocketGuildUser>> GetUsersAsync(RequestOptions? options = null)
Parameters
options
RequestOptionsThe 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
RequestOptionsThe 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()