Class DiscordMember
Represents a Discord guild member.
Inherited Members
Namespace: DisCatSharp.Entities
Assembly: DisCatSharp.dll
Syntax
public class DiscordMember : DiscordUser, IEquatable<DiscordUser>, IEquatable<DiscordMember>
Properties
| Improve this Doc View SourceAvatarHash
Gets the member's avatar hash.
Declaration
public override string AvatarHash { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
| Improve this Doc View SourceBannerColor
The color of this member's banner. Mutually exclusive with GuildBannerHash.
Declaration
public override DiscordColor? BannerColor { get; }
Property Value
Type | Description |
---|---|
System.Nullable<DiscordColor> |
Overrides
| Improve this Doc View SourceBannerHash
Gets the member's banner hash.
Declaration
public override string BannerHash { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
| Improve this Doc View SourceColor
Gets the color associated with this user's top color-giving role, otherwise 0 (no color).
Declaration
public DiscordColor Color { get; }
Property Value
Type | Description |
---|---|
DiscordColor |
CommunicationDisabledUntil
Date until the can communicate again.
Declaration
public DateTime? CommunicationDisabledUntil { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTime> |
Discriminator
Gets the member's 4-digit discriminator.
Declaration
public override string Discriminator { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
| Improve this Doc View SourceDisplayName
Gets this member's display name.
Declaration
public string DisplayName { get; }
Property Value
Type | Description |
---|---|
System.String |
Gets the member's email address.
This is only present in OAuth.
Declaration
public override string Email { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
| Improve this Doc View SourceFlags
Gets the member's flags for OAuth.
Declaration
public override UserFlags? Flags { get; }
Property Value
Type | Description |
---|---|
System.Nullable<UserFlags> |
Overrides
| Improve this Doc View SourceGuild
Gets the guild of which this member is a part of.
Declaration
public DiscordGuild Guild { get; }
Property Value
Type | Description |
---|---|
DiscordGuild |
GuildAvatarHash
Gets the members avatar hash.
Declaration
public virtual string GuildAvatarHash { get; }
Property Value
Type | Description |
---|---|
System.String |
GuildAvatarUrl
Gets the members avatar URL.
Declaration
public string GuildAvatarUrl { get; }
Property Value
Type | Description |
---|---|
System.String |
GuildBannerHash
Gets the members banner hash.
Declaration
public virtual string GuildBannerHash { get; }
Property Value
Type | Description |
---|---|
System.String |
GuildBannerUrl
Gets the members banner URL.
Declaration
public string GuildBannerUrl { get; }
Property Value
Type | Description |
---|---|
System.String |
GuildBio
Gets the members guild bio. This is not available to bots tho.
Declaration
public string GuildBio { get; }
Property Value
Type | Description |
---|---|
System.String |
Hierarchy
Gets the member's position in the role hierarchy, which is the member's highest role's position. Returns System.Int32.MaxValue for the guild's owner.
Declaration
public int Hierarchy { get; }
Property Value
Type | Description |
---|---|
System.Int32 |
IsBot
Gets whether the member is a bot.
Declaration
public override bool IsBot { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
Overrides
| Improve this Doc View SourceIsDeafened
If the user is deafened
Declaration
public bool IsDeafened { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsMuted
If the user is muted
Declaration
public bool IsMuted { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsOwner
Gets whether this member is the Guild owner.
Declaration
public bool IsOwner { get; }
Property Value
Type | Description |
---|---|
System.Boolean |
IsPending
Whether the user has not passed the guild's Membership Screening requirements yet.
Declaration
public bool? IsPending { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Boolean> |
JoinedAt
Date the user joined the guild
Declaration
public DateTimeOffset JoinedAt { get; }
Property Value
Type | Description |
---|---|
System.DateTimeOffset |
Locale
Gets the member's chosen language
Declaration
public override string Locale { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
| Improve this Doc View SourceMemberFlags
Gets the members flags.
Declaration
public MemberFlags MemberFlags { get; }
Property Value
Type | Description |
---|---|
MemberFlags |
MfaEnabled
Gets whether the member has multi-factor authentication enabled.
Declaration
public override bool? MfaEnabled { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Boolean> |
Overrides
| Improve this Doc View SourceNickname
Gets this member's nickname.
Declaration
public string Nickname { get; }
Property Value
Type | Description |
---|---|
System.String |
OAuthFlags
Gets the user's flags.
Declaration
public override UserFlags? OAuthFlags { get; }
Property Value
Type | Description |
---|---|
System.Nullable<UserFlags> |
Overrides
| Improve this Doc View SourcePermissions
Gets the permissions for the current member.
Declaration
public Permissions Permissions { get; }
Property Value
Type | Description |
---|---|
Permissions |
PremiumSince
Date the user started boosting this server
Declaration
public DateTimeOffset? PremiumSince { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.DateTimeOffset> |
Roles
Gets the list of roles associated with this member.
Declaration
public IEnumerable<DiscordRole> Roles { get; }
Property Value
Type | Description |
---|---|
System.Collections.Generic.IEnumerable<DiscordRole> |
Username
Gets this member's username.
Declaration
public override string Username { get; }
Property Value
Type | Description |
---|---|
System.String |
Overrides
| Improve this Doc View SourceVerified
Gets whether the member is verified.
This is only present in OAuth.
Declaration
public override bool? Verified { get; }
Property Value
Type | Description |
---|---|
System.Nullable<System.Boolean> |
Overrides
| Improve this Doc View SourceVoiceState
Gets this member's voice state.
Declaration
public DiscordVoiceState VoiceState { get; }
Property Value
Type | Description |
---|---|
DiscordVoiceState |
Methods
| Improve this Doc View SourceBanAsync(Int32, String)
Bans this member from their guild.
Declaration
public Task BanAsync(int deleteMessageDays = 0, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.Int32 | deleteMessageDays | How many days to remove messages 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 member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
CreateDmChannelAsync()
Creates a direct message channel to this member.
Declaration
public Task<DiscordDmChannel> CreateDmChannelAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordDmChannel> | Direct message channel to this member. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the member has the bot blocked, the member is no longer in the guild, or if the member has Allow DM from server members off. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
Equals(DiscordMember)
Checks whether this DiscordMember is equal to another DiscordMember.
Declaration
public bool Equals(DiscordMember e)
Parameters
Type | Name | Description |
---|---|---|
DiscordMember | e | DiscordMember to compare to. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the DiscordMember is equal to this DiscordMember. |
Equals(Object)
Checks whether this DiscordMember 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 DiscordMember. |
Overrides
| Improve this Doc View SourceGetHashCode()
Gets the hash code for this DiscordMember.
Declaration
public override int GetHashCode()
Returns
Type | Description |
---|---|
System.Int32 | The hash code for this DiscordMember. |
Overrides
| Improve this Doc View SourceGrantRoleAsync(DiscordRole, String)
Grants a role to the member.
Declaration
public Task GrantRoleAsync(DiscordRole role, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
DiscordRole | role | Role to grant. |
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 ManageRoles permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
MakeSpeakerAsync()
Makes the user a speaker.
Declaration
public async Task MakeSpeakerAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when the user is not inside an stage channel. |
UnauthorizedException | Thrown when the client does not have the MuteMembers permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
ModifyAsync(Action<MemberEditModel>)
Modifies this member.
Declaration
public async Task ModifyAsync(Action<MemberEditModel> action)
Parameters
Type | Name | Description |
---|---|---|
System.Action<MemberEditModel> | action | Action to perform on this member. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the ManageNicknames permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
MoveToAudienceAsync()
Moves the user to audience.
Declaration
public async Task MoveToAudienceAsync()
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when the user is not inside an stage channel. |
UnauthorizedException | Thrown when the client does not have the MuteMembers permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
PermissionsIn(DiscordChannel)
Calculates permissions in a given channel for this member.
Declaration
public Permissions PermissionsIn(DiscordChannel channel)
Parameters
Type | Name | Description |
---|---|---|
DiscordChannel | channel | Channel to calculate permissions for. |
Returns
Type | Description |
---|---|
Permissions | Calculated permissions for this member in the channel. |
PlaceInAsync(DiscordChannel)
Moves this member to the specified voice channel
Declaration
public Task PlaceInAsync(DiscordChannel channel)
Parameters
Type | Name | Description |
---|---|---|
DiscordChannel | channel |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the MoveMembers permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
RemoveAsync(String)
Kicks this member from their guild.
Declaration
public Task RemoveAsync(string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | reason | Reason for audit logs. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Equivalent names
KickAsync
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have the KickMembers permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
RemoveTimeoutAsync(String)
Removes the timeout from a member.
Declaration
public Task RemoveTimeoutAsync(string reason = null)
Parameters
Type | Name | Description |
---|---|---|
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 ModerateMembers permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
ReplaceRolesAsync(IEnumerable<DiscordRole>, String)
Sets the member's roles to ones specified.
Declaration
public Task ReplaceRolesAsync(IEnumerable<DiscordRole> roles, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.Collections.Generic.IEnumerable<DiscordRole> | roles | Roles to set. |
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 ManageRoles permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
RevokeRoleAsync(DiscordRole, String)
Revokes a role from a member.
Declaration
public Task RevokeRoleAsync(DiscordRole role, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
DiscordRole | role | Role to revoke. |
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 ManageRoles permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
SendMessageAsync(DiscordEmbed)
Sends a direct message to this member. Creates a direct message channel if one does not exist already.
Declaration
public async Task<DiscordMessage> SendMessageAsync(DiscordEmbed embed)
Parameters
Type | Name | Description |
---|---|---|
DiscordEmbed | embed | Embed to attach to the message. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordMessage> | The sent message. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the member has the bot blocked, the member is no longer in the guild, or if the member has Allow DM from server members off. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
SendMessageAsync(DiscordMessageBuilder)
Sends a direct message to this member. Creates a direct message channel if one does not exist already.
Declaration
public async Task<DiscordMessage> SendMessageAsync(DiscordMessageBuilder message)
Parameters
Type | Name | Description |
---|---|---|
DiscordMessageBuilder | message | Builder to with the message. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordMessage> | The sent message. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the member has the bot blocked, the member is no longer in the guild, or if the member has Allow DM from server members off. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
SendMessageAsync(String)
Sends a direct message to this member. Creates a direct message channel if one does not exist already.
Declaration
public async Task<DiscordMessage> SendMessageAsync(string content)
Parameters
Type | Name | Description |
---|---|---|
System.String | content | Content of the message to send. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordMessage> | The sent message. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the member has the bot blocked, the member is no longer in the guild, or if the member has Allow DM from server members off. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
SendMessageAsync(String, DiscordEmbed)
Sends a direct message to this member. Creates a direct message channel if one does not exist already.
Declaration
public async Task<DiscordMessage> SendMessageAsync(string content, DiscordEmbed embed)
Parameters
Type | Name | Description |
---|---|---|
System.String | content | Content of the message to send. |
DiscordEmbed | embed | Embed to attach to the message. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task<DiscordMessage> | The sent message. |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the member has the bot blocked, the member is no longer in the guild, or if the member has Allow DM from server members off. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
SetDeafAsync(Boolean, String)
Sets this member's voice deaf status.
Declaration
public Task SetDeafAsync(bool deaf, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | deaf | Whether the member is to be deafened. |
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 DeafenMembers permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
SetMuteAsync(Boolean, String)
Sets this member's voice mute status.
Declaration
public Task SetMuteAsync(bool mute, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.Boolean | mute | Whether the member is to be muted. |
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 MuteMembers permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
TimeoutAsync(DateTime, String)
Adds a timeout to a member.
Declaration
public Task TimeoutAsync(DateTime until, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.DateTime | until | The datetime to time out the user. Up to 28 days. |
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 ModerateMembers permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
TimeoutAsync(DateTimeOffset, String)
Adds a timeout to a member.
Declaration
public Task TimeoutAsync(DateTimeOffset until, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.DateTimeOffset | until | The datetime offset to time out the user. Up to 28 days. |
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 ModerateMembers permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
TimeoutAsync(TimeSpan, String)
Adds a timeout to a member.
Declaration
public Task TimeoutAsync(TimeSpan until, string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.TimeSpan | until | The timespan to time out the user. Up to 28 days. |
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 ModerateMembers permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
ToString()
Returns a string representation of this member.
Declaration
public override string ToString()
Returns
Type | Description |
---|---|
System.String | String representation of this member. |
Overrides
| Improve this Doc View SourceUnbanAsync(String)
Unbans this member from their guild.
Declaration
public Task UnbanAsync(string reason = null)
Parameters
Type | Name | Description |
---|---|---|
System.String | reason |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
UnauthorizedException | Thrown when the client does not have theBanMembers permission. |
NotFoundException | Thrown when the member does not exist. |
BadRequestException | Thrown when an invalid parameter was provided. |
ServerErrorException | Thrown when Discord is unable to process the request. |
UpdateVoiceStateAsync(DiscordChannel, Nullable<Boolean>)
Updates the member's suppress state in a stage channel.
Declaration
public async Task UpdateVoiceStateAsync(DiscordChannel channel, bool? suppress)
Parameters
Type | Name | Description |
---|---|---|
DiscordChannel | channel | The channel the member is currently in. |
System.Nullable<System.Boolean> | suppress | Toggles the member's suppress state. |
Returns
Type | Description |
---|---|
System.Threading.Tasks.Task |
Exceptions
Type | Condition |
---|---|
System.ArgumentException | Thrown when the channel in not a voice channel. |
Operators
| Improve this Doc View SourceEquality(DiscordMember, DiscordMember)
Gets whether the two DiscordMember objects are equal.
Declaration
public static bool operator ==(DiscordMember e1, DiscordMember e2)
Parameters
Type | Name | Description |
---|---|---|
DiscordMember | e1 | First member to compare. |
DiscordMember | e2 | Second member to compare. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two members are equal. |
Inequality(DiscordMember, DiscordMember)
Gets whether the two DiscordMember objects are not equal.
Declaration
public static bool operator !=(DiscordMember e1, DiscordMember e2)
Parameters
Type | Name | Description |
---|---|---|
DiscordMember | e1 | First member to compare. |
DiscordMember | e2 | Second member to compare. |
Returns
Type | Description |
---|---|
System.Boolean | Whether the two members are not equal. |