Class RestGuildUser
Represents a REST-based guild user.
public class RestGuildUser : RestUser, IUpdateable, IGuildUser, IUser, ISnowflakeEntity, IEntity<ulong>, IMentionable, IPresence, IVoiceState
- Inheritance
-
RestGuildUser
- Implements
- Inherited Members
- Extension Methods
Properties
DisplayAvatarId
Gets the displayed avatar for this user.
public string DisplayAvatarId { get; }
Property Value
- string
The users displayed avatar hash. If the user does not have a guild avatar, this will be the regular avatar. If the user also does not have a regular avatar, this will be null.
DisplayName
Gets the displayed name for this user.
public string DisplayName { get; }
Property Value
- string
A string representing the display name of the user; If the nickname is null, this will be the username.
Flags
Gets the public flags for this guild member.
public GuildUserFlags Flags { get; }
Property Value
GuildAvatarId
Gets the guild specific avatar for this user.
public string GuildAvatarId { get; }
Property Value
GuildBannerHash
Gets the guild specific banner for this user.
public string GuildBannerHash { get; }
Property Value
GuildId
Gets the ID of the guild for this user.
public ulong GuildId { get; }
Property Value
GuildPermissions
Gets the guild-level permissions for this user.
public GuildPermissions GuildPermissions { get; }
Property Value
- GuildPermissions
A GuildPermissions structure for this user, representing what permissions this user has in the guild.
Exceptions
- InvalidOperationException
Resolving permissions requires the parent guild to be downloaded.
Hierarchy
Gets the users position within the role hierarchy.
public int Hierarchy { get; }
Property Value
IsDeafened
Gets a value that indicates whether this user is deafened by the guild.
public bool IsDeafened { get; }
Property Value
- bool
true if the user is deafened (i.e. not permitted to listen to or speak to others) by the guild; otherwise false.
IsMuted
Gets a value that indicates whether this user is muted (i.e. not permitted to speak via voice) by the guild.
public bool IsMuted { get; }
Property Value
IsPending
Whether the user has passed the guild's Membership Screening requirements.
public bool? IsPending { get; }
Property Value
- bool?
JoinedAt
Gets when this user joined the guild.
public DateTimeOffset? JoinedAt { get; }
Property Value
- DateTimeOffset?
A DateTimeOffset representing the time of which the user has joined the guild; null when it cannot be obtained.
Nickname
Gets the nickname for this user.
public string Nickname { get; }
Property Value
PremiumSince
Gets the date and time for when this user's guild boost began.
public DateTimeOffset? PremiumSince { get; }
Property Value
- DateTimeOffset?
A DateTimeOffset for when the user began boosting this guild; null if they are not boosting the guild.
RoleIds
Gets a collection of IDs for the roles that this user currently possesses in the guild.
public IReadOnlyCollection<ulong> RoleIds { get; }
Property Value
- IReadOnlyCollection<ulong>
A read-only collection of ulong, each representing a snowflake identifier for a role that this user possesses.
Remarks
This property returns a read-only collection of the identifiers of the roles that this user possesses. For WebSocket users, a Roles property can be found in place of this property. Due to the REST implementation, only a collection of identifiers can be retrieved instead of the full role objects.
TimedOutUntil
Gets the date and time that indicates if and for how long a user has been timed out.
public DateTimeOffset? TimedOutUntil { get; }
Property Value
- DateTimeOffset?
A DateTimeOffset indicating how long the user will be timed out for.
Remarks
null or a timestamp in the past if the user is not timed out.
Methods
AddRoleAsync(IRole, RequestOptions)
Adds the specified role to this user in the guild.
public Task AddRoleAsync(IRole role, RequestOptions options = null)
Parameters
role
IRoleThe role to be added to the user.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous role addition operation.
AddRoleAsync(ulong, RequestOptions)
Adds the specified role to this user in the guild.
public Task AddRoleAsync(ulong roleId, RequestOptions options = null)
Parameters
roleId
ulongThe role to be added to the user.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous role addition operation.
AddRolesAsync(IEnumerable<IRole>, RequestOptions)
Adds the specified roles
to this user in the guild.
public Task AddRolesAsync(IEnumerable<IRole> roles, RequestOptions options = null)
Parameters
roles
IEnumerable<IRole>The roles to be added to the user.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous role addition operation.
AddRolesAsync(IEnumerable<ulong>, RequestOptions)
Adds the specified roleIds
to this user in the guild.
public Task AddRolesAsync(IEnumerable<ulong> roleIds, RequestOptions options = null)
Parameters
roleIds
IEnumerable<ulong>The roles to be added to the user.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous role addition operation.
GetDisplayAvatarUrl(ImageFormat, ushort)
Gets the display avatar URL for this user.
public override string GetDisplayAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128)
Parameters
format
ImageFormatThe format of the image.
size
ushortThe size of the image that matches any power of two, ranging from 16 to 2048.
Returns
- string
A string representing the user's display avatar URL.
Remarks
This method will return GetDefaultAvatarUrl() if the user has no avatar set.
GetGuildAvatarUrl(ImageFormat, ushort)
Gets the guild-specific avatar URL for this user, if it is set.
public string GetGuildAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128)
Parameters
format
ImageFormatThe format of the image.
size
ushortThe size of the image that matches any power of two, ranging from 16 to 2048.
Returns
- string
A string representing the user's guild-specific avatar URL; null if the user has no guild avatar set.
Remarks
tip
If you wish to retrieve the display avatar for this user, consider using GetDisplayAvatarUrl(ImageFormat, ushort).
GetGuildBannerUrl(ImageFormat, ushort)
Gets the guild-specific banner URL for this user, if it is set.
public string GetGuildBannerUrl(ImageFormat format = ImageFormat.Auto, ushort size = 128)
Parameters
format
ImageFormatThe format of the image.
size
ushortThe size of the image that matches any power of two, ranging from 16 to 2048.
Returns
- string
A string representing the user's guild-specific banner URL; null if the user has no guild banner set.
GetPermissions(IGuildChannel)
Gets the level permissions granted to this user to a given channel.
public ChannelPermissions GetPermissions(IGuildChannel channel)
Parameters
channel
IGuildChannelThe channel to get the permission from.
Returns
- ChannelPermissions
A ChannelPermissions structure representing the permissions that a user has in the specified channel.
Examples
The following example checks if the current user has the ability to send a message with attachment in this channel; if so, uploads a file via SendFileAsync(string, string, bool, Embed, RequestOptions, bool, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags, PollProperties).
if (currentUser?.GetPermissions(targetChannel)?.AttachFiles)
await targetChannel.SendFileAsync("fortnite.png");
Exceptions
- InvalidOperationException
Resolving permissions requires the parent guild to be downloaded.
KickAsync(string, RequestOptions)
Kicks this user from this guild.
public Task KickAsync(string reason = null, RequestOptions options = null)
Parameters
reason
stringThe reason for the kick which will be recorded in the audit log.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous kick operation.
ModifyAsync(Action<GuildUserProperties>, RequestOptions)
Modifies this user's properties in this guild.
public Task ModifyAsync(Action<GuildUserProperties> func, RequestOptions options = null)
Parameters
func
Action<GuildUserProperties>The delegate containing the properties to modify the user 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 the current guild user with the specified properties. To see an example of this method and what properties are available, please refer to GuildUserProperties.
RemoveRoleAsync(IRole, RequestOptions)
Removes the specified role
from this user in the guild.
public Task RemoveRoleAsync(IRole role, RequestOptions options = null)
Parameters
role
IRoleThe role to be removed from the user.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous role removal operation.
RemoveRoleAsync(ulong, RequestOptions)
Removes the specified roleId
from this user in the guild.
public Task RemoveRoleAsync(ulong roleId, RequestOptions options = null)
Parameters
roleId
ulongThe role to be removed from the user.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous role removal operation.
RemoveRolesAsync(IEnumerable<IRole>, RequestOptions)
Removes the specified roles
from this user in the guild.
public Task RemoveRolesAsync(IEnumerable<IRole> roles, RequestOptions options = null)
Parameters
roles
IEnumerable<IRole>The roles to be removed from the user.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous role removal operation.
RemoveRolesAsync(IEnumerable<ulong>, RequestOptions)
Removes the specified roleIds
from this user in the guild.
public Task RemoveRolesAsync(IEnumerable<ulong> roleIds, RequestOptions options = null)
Parameters
roleIds
IEnumerable<ulong>The roles to be removed from the user.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous role removal operation.
RemoveTimeOutAsync(RequestOptions)
Removes the current timeout from the user in this guild if one exists.
public Task RemoveTimeOutAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous timeout removal operation.
SetTimeOutAsync(TimeSpan, RequestOptions)
Sets a timeout based on provided TimeSpan to this user in the guild.
public Task SetTimeOutAsync(TimeSpan span, RequestOptions options = null)
Parameters
span
TimeSpanThe TimeSpan indicating how long a user should be timed out for.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous timeout creation operation.
UpdateAsync(RequestOptions)
Updates this object's properties with its current state.
public override Task UpdateAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe options to be used when sending the request.