Search Results for

    Show / Hide Table of Contents

    Class DiscordRole

    Represents a discord role, to which users can be assigned.

    Inheritance
    System.Object
    SnowflakeObject
    DiscordRole
    Inherited Members
    SnowflakeObject.Id
    SnowflakeObject.CreationTimestamp
    Namespace: DisCatSharp.Entities
    Assembly: DisCatSharp.dll
    Syntax
    public class DiscordRole : SnowflakeObject, IEquatable<DiscordRole>

    Properties

    | Improve this Doc View Source

    Color

    Gets the color of this role.

    Declaration
    public DiscordColor Color { get; }
    Property Value
    Type Description
    DiscordColor
    | Improve this Doc View Source

    Flags

    Gets the role flags.

    Declaration
    public RoleFlags Flags { get; }
    Property Value
    Type Description
    RoleFlags
    | Improve this Doc View Source

    IconHash

    Gets the role icon's hash.

    Declaration
    public string IconHash { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    IconUrl

    Gets the role icon's url.

    Declaration
    public string IconUrl { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    IsHoisted

    Gets whether this role is hoisted.

    Declaration
    public bool IsHoisted { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsManaged

    Gets whether this role is managed by an integration.

    Declaration
    public bool IsManaged { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    IsMentionable

    Gets whether this role is mentionable.

    Declaration
    public bool IsMentionable { get; }
    Property Value
    Type Description
    System.Boolean
    | Improve this Doc View Source

    Mention

    Gets a mention string for this role. If the role is mentionable, this string will mention all the users that belong to this role.

    Declaration
    public string Mention { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    Name

    Gets the name of this role.

    Declaration
    public string Name { get; }
    Property Value
    Type Description
    System.String
    | Improve this Doc View Source

    Permissions

    Gets the permissions set for this role.

    Declaration
    public Permissions Permissions { get; }
    Property Value
    Type Description
    Permissions
    | Improve this Doc View Source

    Position

    Gets the position of this role in the role hierarchy.

    Declaration
    public int Position { get; }
    Property Value
    Type Description
    System.Int32
    | Improve this Doc View Source

    Tags

    Gets the tags this role has.

    Declaration
    public DiscordRoleTags Tags { get; }
    Property Value
    Type Description
    DiscordRoleTags
    | Improve this Doc View Source

    UnicodeEmoji

    Gets the unicode emoji.

    Declaration
    public DiscordEmoji UnicodeEmoji { get; }
    Property Value
    Type Description
    DiscordEmoji

    Methods

    | Improve this Doc View Source

    CheckPermission(Permissions)

    Checks whether this role has specific permissions.

    Declaration
    public PermissionLevel CheckPermission(Permissions permission)
    Parameters
    Type Name Description
    Permissions permission

    Permissions to check for.

    Returns
    Type Description
    PermissionLevel

    Whether the permissions are allowed or not.

    | Improve this Doc View Source

    DeleteAsync(String)

    Deletes this role.

    Declaration
    public Task DeleteAsync(string reason = null)
    Parameters
    Type Name Description
    System.String reason

    Reason as to why this role has been deleted.

    Returns
    Type Description
    System.Threading.Tasks.Task
    Exceptions
    Type Condition
    UnauthorizedException

    Thrown when the client does not have the ManageRoles permission.

    NotFoundException

    Thrown when the role does not exist.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    | Improve this Doc View Source

    Equals(DiscordRole)

    Checks whether this DiscordRole is equal to another DiscordRole.

    Declaration
    public bool Equals(DiscordRole e)
    Parameters
    Type Name Description
    DiscordRole e

    DiscordRole to compare to.

    Returns
    Type Description
    System.Boolean

    Whether the DiscordRole is equal to this DiscordRole.

    | Improve this Doc View Source

    Equals(Object)

    Checks whether this DiscordRole is equal to another object.

    Declaration
    public override bool Equals(object obj)
    Parameters
    Type Name Description
    System.Object obj

    Object to compare to.

    Returns
    Type Description
    System.Boolean

    Whether the object is equal to this DiscordRole.

    Overrides
    System.Object.Equals(System.Object)
    | Improve this Doc View Source

    GetHashCode()

    Gets the hash code for this DiscordRole.

    Declaration
    public override int GetHashCode()
    Returns
    Type Description
    System.Int32

    The hash code for this DiscordRole.

    Overrides
    System.Object.GetHashCode()
    | Improve this Doc View Source

    ModifyAsync(Action<RoleEditModel>)

    Updates this role.

    Declaration
    public Task ModifyAsync(Action<RoleEditModel> action)
    Parameters
    Type Name Description
    System.Action<RoleEditModel> action

    The action.

    Returns
    Type Description
    System.Threading.Tasks.Task
    Exceptions
    Type Condition
    UnauthorizedException

    Thrown when the client does not have theManageRoles permission.

    NotFoundException

    Thrown when the role does not exist.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    | Improve this Doc View Source

    ModifyAsync(String, Nullable<Permissions>, Nullable<DiscordColor>, Nullable<Boolean>, Nullable<Boolean>, String)

    Updates this role.

    Declaration
    public Task ModifyAsync(string name = null, Permissions? permissions = null, DiscordColor? color = null, bool? hoist = null, bool? mentionable = null, string reason = null)
    Parameters
    Type Name Description
    System.String name

    New role name.

    System.Nullable<Permissions> permissions

    New role permissions.

    System.Nullable<DiscordColor> color

    New role color.

    System.Nullable<System.Boolean> hoist

    New role hoist.

    System.Nullable<System.Boolean> mentionable

    Whether this role is mentionable.

    System.String reason

    Audit log reason.

    Returns
    Type Description
    System.Threading.Tasks.Task
    Exceptions
    Type Condition
    UnauthorizedException

    Thrown when the client does not have the ManageRoles permission.

    NotFoundException

    Thrown when the role does not exist.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    | Improve this Doc View Source

    ModifyPositionAsync(Int32, String)

    Modifies this role's position.

    Declaration
    public Task ModifyPositionAsync(int position, string reason = null)
    Parameters
    Type Name Description
    System.Int32 position

    New position

    System.String reason

    Reason why we moved it

    Returns
    Type Description
    System.Threading.Tasks.Task
    Exceptions
    Type Condition
    UnauthorizedException

    Thrown when the client does not have the ManageRoles permission.

    NotFoundException

    Thrown when the role does not exist.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    | Improve this Doc View Source

    ToString()

    Returns a string representation of this role.

    Declaration
    public override string ToString()
    Returns
    Type Description
    System.String

    String representation of this role.

    Overrides
    System.Object.ToString()

    Operators

    | Improve this Doc View Source

    Equality(DiscordRole, DiscordRole)

    Gets whether the two DiscordRole objects are equal.

    Declaration
    public static bool operator ==(DiscordRole e1, DiscordRole e2)
    Parameters
    Type Name Description
    DiscordRole e1

    First role to compare.

    DiscordRole e2

    Second role to compare.

    Returns
    Type Description
    System.Boolean

    Whether the two roles are equal.

    | Improve this Doc View Source

    Inequality(DiscordRole, DiscordRole)

    Gets whether the two DiscordRole objects are not equal.

    Declaration
    public static bool operator !=(DiscordRole e1, DiscordRole e2)
    Parameters
    Type Name Description
    DiscordRole e1

    First role to compare.

    DiscordRole e2

    Second role to compare.

    Returns
    Type Description
    System.Boolean

    Whether the two roles are not equal.

    Extension Methods

    ReflectionUtilities.ToDictionary<T>(T)
    • Improve this Doc
    • View Source
    In This Article
    Back to top © 2021-2022 Aiko IT Systems