Class Role
- Namespace
- NetCord
- Assembly
- NetCord.dll
Represents a role in a guild.
public class Role : ClientEntity, IEntity, ISpanFormattable, IFormattable, IEquatable<Entity>, IJsonModel<JsonRole>
- Inheritance
-
Role
- Implements
- Inherited Members
Constructors
Role(JsonRole, ulong, RestClient)
public Role(JsonRole jsonModel, ulong guildId, RestClient client)
Parameters
jsonModelJsonRoleguildIdulongclientRestClient
Properties
Colors
The Role's colors.
public RoleColors Colors { get; }
Property Value
Flags
The Role's flags combined as a bitfield.
public RoleFlags Flags { get; }
Property Value
GuildId
The ID of the guild this Role belongs to.
public ulong GuildId { get; }
Property Value
Hoist
Whether this Role causes users with it to be displayed in a separate section in the guild users list.
public bool Hoist { get; }
Property Value
IconHash
The Role's icon hash.
public string? IconHash { get; }
Property Value
Id
The Role's ID.
public override ulong Id { get; }
Property Value
Managed
Whether this Role is managed by an integration.
public bool Managed { get; }
Property Value
Mentionable
Whether this Role is mentionable.
public bool Mentionable { get; }
Property Value
Name
The name of the Role.
public string Name { get; }
Property Value
Permissions
The permission bit set for this Role.
public Permissions Permissions { get; }
Property Value
Position
The position of this Role for sorting and comparing.
public RolePosition Position { get; }
Property Value
RawPosition
The raw position of this Role.
public int RawPosition { get; }
Property Value
Remarks
Use Position to get a properly comparable and sortable position value.
Tags
The tags this Role has.
public RoleTags? Tags { get; }
Property Value
UnicodeEmoji
The Role's Unicode emoji.
public string? UnicodeEmoji { get; }
Property Value
Methods
DeleteAsync(RestRequestProperties?, CancellationToken)
public Task DeleteAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
propertiesRestRequestPropertiescancellationTokenCancellationToken
Returns
GetIconUrl(ImageFormat)
public ImageUrl? GetIconUrl(ImageFormat format)
Parameters
formatImageFormatThe format of the returned ImageUrl.
Returns
ModifyAsync(Action<RoleOptions>, RestRequestProperties?, CancellationToken)
public Task<Role> ModifyAsync(Action<RoleOptions> action, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
actionAction<RoleOptions>propertiesRestRequestPropertiescancellationTokenCancellationToken
Returns
ToString()
public override string ToString()
Returns
TryFormat(Span<char>, out int, ReadOnlySpan<char>, IFormatProvider?)
public override bool TryFormat(Span<char> destination, out int charsWritten, ReadOnlySpan<char> format = default, IFormatProvider? provider = null)
Parameters
destinationSpan<char>charsWrittenintformatReadOnlySpan<char>providerIFormatProvider