Search Results for

    Show / Hide Table of Contents

    Class DiscordUser

    Represents a Discord user.

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

    Properties

    | Improve this Doc View Source

    AvatarHash

    Gets the user's avatar hash.

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

    AvatarUrl

    Gets the user's avatar URL.s

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

    BannerColor

    Gets the user's banner color, if set. Mutually exclusive with BannerHash.

    Declaration
    public virtual DiscordColor? BannerColor { get; }
    Property Value
    Type Description
    System.Nullable<DiscordColor>
    | Improve this Doc View Source

    BannerHash

    Gets the user's profile banner hash. Mutually exclusive with BannerColor.

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

    BannerUrl

    Gets the user's banner url

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

    Bio

    Gets the users bio. This is not available to bots tho.

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

    DefaultAvatarUrl

    Gets the URL of default avatar for this user.

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

    Discriminator

    Gets the user's 4-digit discriminator.

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

    Email

    Gets the user's email address.

    This is only present in OAuth.

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

    Flags

    Gets the user's flags.

    Declaration
    public virtual UserFlags? Flags { get; }
    Property Value
    Type Description
    System.Nullable<UserFlags>
    | Improve this Doc View Source

    IsBot

    Gets whether the user is a bot.

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

    IsBotDev

    Whether this member is a VerifiedDeveloper

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

    IsCurrent

    Gets whether this user is the Client which created this object.

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

    IsMod

    Whether this member is a CertifiedModerator

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

    IsPartner

    Whether this member is a Partner

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

    IsStaff

    Whether this member is a Staff

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

    IsSystem

    Gets whether the user is an official Discord system user.

    Declaration
    public bool? IsSystem { get; }
    Property Value
    Type Description
    System.Nullable<System.Boolean>
    | Improve this Doc View Source

    IsVerifiedBot

    Whether this member is a VerifiedBot

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

    Locale

    Gets the user's chosen language

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

    Mention

    Gets the user's mention string.

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

    MfaEnabled

    Gets whether the user has multi-factor authentication enabled.

    Declaration
    public virtual bool? MfaEnabled { get; }
    Property Value
    Type Description
    System.Nullable<System.Boolean>
    | Improve this Doc View Source

    OAuthFlags

    Gets the user's flags for OAuth.

    Declaration
    public virtual UserFlags? OAuthFlags { get; }
    Property Value
    Type Description
    System.Nullable<UserFlags>
    | Improve this Doc View Source

    PremiumType

    Gets the user's premium type.

    Declaration
    public virtual PremiumType? PremiumType { get; }
    Property Value
    Type Description
    System.Nullable<PremiumType>
    | Improve this Doc View Source

    Presence

    Gets this user's presence.

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

    ProfileUri

    Returns a uri to this users profile.

    Declaration
    public Uri ProfileUri { get; }
    Property Value
    Type Description
    System.Uri
    | Improve this Doc View Source

    ProfileUrl

    Returns a string representing the direct URL to this users profile.

    Declaration
    public string ProfileUrl { get; }
    Property Value
    Type Description
    System.String

    The URL of this users profile.

    | Improve this Doc View Source

    Pronouns

    Gets the user's pronouns.

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

    Username

    Gets this user's username.

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

    UsernameWithDiscriminator

    Gets this user's username with the discriminator. Example: Discord#0000

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

    Verified

    Gets whether the user is verified.

    This is only present in OAuth.

    Declaration
    public virtual bool? Verified { get; }
    Property Value
    Type Description
    System.Nullable<System.Boolean>

    Methods

    | Improve this Doc View Source

    ConvertToMember(DiscordGuild)

    Returns the DiscordMember in the specified DiscordGuild

    Declaration
    public async Task<DiscordMember> ConvertToMember(DiscordGuild guild)
    Parameters
    Type Name Description
    DiscordGuild guild

    The DiscordGuild to get this user on.

    Returns
    Type Description
    System.Threading.Tasks.Task<DiscordMember>

    The DiscordMember.

    Exceptions
    Type Condition
    NotFoundException

    Thrown when the user is not part of the guild.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    | Improve this Doc View Source

    Equals(DiscordUser)

    Checks whether this DiscordUser is equal to another DiscordUser.

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

    DiscordUser to compare to.

    Returns
    Type Description
    System.Boolean

    Whether the DiscordUser is equal to this DiscordUser.

    | Improve this Doc View Source

    Equals(Object)

    Checks whether this DiscordUser 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 DiscordUser.

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

    GetAvatarUrl(ImageFormat, UInt16)

    Gets the user's avatar URL, in requested format and size.

    Declaration
    public string GetAvatarUrl(ImageFormat fmt, ushort size = 1024)
    Parameters
    Type Name Description
    ImageFormat fmt

    Format of the avatar to get.

    System.UInt16 size

    Maximum size of the avatar. Must be a power of two, minimum 16, maximum 2048.

    Returns
    Type Description
    System.String

    URL of the user's avatar.

    | Improve this Doc View Source

    GetFromApiAsync()

    Fetches the user from the API.

    Declaration
    public async Task<DiscordUser> GetFromApiAsync()
    Returns
    Type Description
    System.Threading.Tasks.Task<DiscordUser>

    The user with fresh data from the API.

    | Improve this Doc View Source

    GetHashCode()

    Gets the hash code for this DiscordUser.

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

    The hash code for this DiscordUser.

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

    IsInGuild(DiscordGuild)

    Whether this user is in a DiscordGuild

    Declaration
    public async Task<bool> IsInGuild(DiscordGuild guild)
    Parameters
    Type Name Description
    DiscordGuild guild DiscordGuild
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean> System.Boolean
    Examples
    DiscordGuild guild = await Client.GetGuildAsync(806675511555915806);
    DiscordUser user = await Client.GetUserAsync(469957180968271873);
    Console.WriteLine($"{user.Username} {(user.IsInGuild(guild) ? "is a" : "is not a")} member of {guild.Name}");

    results to J_M_Lutra is a member of Project Nyaw~.

    | Improve this Doc View Source

    IsNotInGuild(DiscordGuild)

    Whether this user is not in a DiscordGuild

    Declaration
    public async Task<bool> IsNotInGuild(DiscordGuild guild)
    Parameters
    Type Name Description
    DiscordGuild guild DiscordGuild
    Returns
    Type Description
    System.Threading.Tasks.Task<System.Boolean> System.Boolean
    | Improve this Doc View Source

    ToString()

    Returns a string representation of this user.

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

    String representation of this user.

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

    UnbanAsync(DiscordGuild, String)

    Unbans this user from a guild.

    Declaration
    public Task UnbanAsync(DiscordGuild guild, string reason = null)
    Parameters
    Type Name Description
    DiscordGuild guild

    Guild to unban this user from.

    System.String reason

    Reason for audit logs.

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

    Thrown when the client does not have the BanMembers permission.

    NotFoundException

    Thrown when the user does not exist.

    BadRequestException

    Thrown when an invalid parameter was provided.

    ServerErrorException

    Thrown when Discord is unable to process the request.

    Operators

    | Improve this Doc View Source

    Equality(DiscordUser, DiscordUser)

    Gets whether the two DiscordUser objects are equal.

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

    First user to compare.

    DiscordUser e2

    Second user to compare.

    Returns
    Type Description
    System.Boolean

    Whether the two users are equal.

    | Improve this Doc View Source

    Inequality(DiscordUser, DiscordUser)

    Gets whether the two DiscordUser objects are not equal.

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

    First user to compare.

    DiscordUser e2

    Second user to compare.

    Returns
    Type Description
    System.Boolean

    Whether the two users 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