Class SocketRole
Represents a WebSocket-based role to be given to a guild user.
public class SocketRole : SocketEntity<ulong>, IRole, ISnowflakeEntity, IEntity<ulong>, 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
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
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
Guild
Gets the guild that owns this role.
public SocketGuild Guild { get; }
Property Value
- SocketGuild
A SocketGuild representing the parent guild of this role.
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
Returns a value that determines if the role is an @everyone role.
public bool IsEveryone { get; }
Property Value
IsHoisted
Gets a value that indicates whether the role can be separated in the user list.
public bool IsHoisted { get; }
Property Value
IsManaged
Gets a value that indicates whether the role is managed by Discord.
public bool IsManaged { get; }
Property Value
IsMentionable
Gets a value that indicates whether the role is mentionable.
public bool IsMentionable { get; }
Property Value
Members
Returns an IEnumerable containing all SocketGuildUser that have this role.
public IEnumerable<SocketGuildUser> Members { get; }
Property Value
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
Tags
Gets the tags related to this role.
public RoleTags Tags { 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
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
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()