Interface IGuildUser
Represents a generic guild user.
Inherited Members
Namespace: Discord
Assembly: Discord.Net.Core.dll
Syntax
public interface IGuildUser : IUser, ISnowflakeEntity, IEntity<ulong>, IMentionable, IPresence, IVoiceState
Properties
| Improve this Doc View SourceDisplayAvatarId
Gets the displayed avatar for this user.
Declaration
string DisplayAvatarId { get; }
Property Value
Type | Description |
---|---|
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.
Declaration
string DisplayName { get; }
Property Value
Type | Description |
---|---|
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.
Declaration
GuildUserFlags Flags { get; }
Property Value
Type | Description |
---|---|
GuildUserFlags |
Guild
Gets the guild for this user.
Declaration
IGuild Guild { get; }
Property Value
Type | Description |
---|---|
IGuild | A guild object that this user belongs to. |
GuildAvatarId
Gets the guild specific avatar for this user.
Declaration
string GuildAvatarId { get; }
Property Value
Type | Description |
---|---|
String | The users guild avatar hash if they have one; otherwise null. |
GuildId
Gets the ID of the guild for this user.
Declaration
ulong GuildId { get; }
Property Value
Type | Description |
---|---|
UInt64 | An |
GuildPermissions
Gets the guild-level permissions for this user.
Declaration
GuildPermissions GuildPermissions { get; }
Property Value
Type | Description |
---|---|
GuildPermissions | A GuildPermissions structure for this user, representing what permissions this user has in the guild. |
Hierarchy
Gets the users position within the role hierarchy.
Declaration
int Hierarchy { get; }
Property Value
Type | Description |
---|---|
Int32 |
IsPending
Whether the user has passed the guild's Membership Screening requirements.
Declaration
bool? IsPending { get; }
Property Value
Type | Description |
---|---|
Nullable<Boolean> |
JoinedAt
Gets when this user joined the guild.
Declaration
DateTimeOffset? JoinedAt { get; }
Property Value
Type | Description |
---|---|
Nullable<DateTimeOffset> | A |
Nickname
Gets the nickname for this user.
Declaration
string Nickname { get; }
Property Value
Type | Description |
---|---|
String | A string representing the nickname of the user; null if none is set. |
PremiumSince
Gets the date and time for when this user's guild boost began.
Declaration
DateTimeOffset? PremiumSince { get; }
Property Value
Type | Description |
---|---|
Nullable<DateTimeOffset> | A |
RoleIds
Gets a collection of IDs for the roles that this user currently possesses in the guild.
Declaration
IReadOnlyCollection<ulong> RoleIds { get; }
Property Value
Type | Description |
---|---|
IReadOnlyCollection<UInt64> | A read-only collection of |
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.
Declaration
DateTimeOffset? TimedOutUntil { get; }
Property Value
Type | Description |
---|---|
Nullable<DateTimeOffset> | A |
Remarks
null or a timestamp in the past if the user is not timed out.
Methods
| Improve this Doc View SourceAddRoleAsync(IRole, RequestOptions)
Adds the specified role to this user in the guild.
Declaration
Task AddRoleAsync(IRole role, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
IRole | role | The role to be added to the user. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous role addition operation. |
AddRoleAsync(UInt64, RequestOptions)
Adds the specified role to this user in the guild.
Declaration
Task AddRoleAsync(ulong roleId, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | roleId | The role to be added to the user. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous role addition operation. |
AddRolesAsync(IEnumerable<IRole>, RequestOptions)
Adds the specified roles
to this user in the guild.
Declaration
Task AddRolesAsync(IEnumerable<IRole> roles, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IRole> | roles | The roles to be added to the user. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous role addition operation. |
AddRolesAsync(IEnumerable<UInt64>, RequestOptions)
Adds the specified roleIds
to this user in the guild.
Declaration
Task AddRolesAsync(IEnumerable<ulong> roleIds, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<UInt64> | roleIds | The roles to be added to the user. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous role addition operation. |
GetDisplayAvatarUrl(ImageFormat, UInt16)
Gets the display avatar URL for this user.
Declaration
string GetDisplayAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = null)
Parameters
Type | Name | Description |
---|---|---|
ImageFormat | format | The format to return. |
UInt16 | size | The size of the image to return in. This can be any power of two between 16 and 2048. |
Returns
Type | Description |
---|---|
String | A string representing the URL of the displayed avatar for this user. null if the user does not have an avatar in place. |
Remarks
This property retrieves an URL for this guild user's displayed avatar. If the user does not have a guild avatar, this will be the user's regular avatar.
GetGuildAvatarUrl(ImageFormat, UInt16)
Gets the guild avatar URL for this user.
Declaration
string GetGuildAvatarUrl(ImageFormat format = ImageFormat.Auto, ushort size = null)
Parameters
Type | Name | Description |
---|---|---|
ImageFormat | format | The format to return. |
UInt16 | size | The size of the image to return in. This can be any power of two between 16 and 2048. |
Returns
Type | Description |
---|---|
String | A string representing the user's avatar URL; null if the user does not have an avatar in place. |
Remarks
This property retrieves a URL for this guild user's guild specific avatar. In event that the user does not have a valid guild avatar (i.e. their avatar identifier is not set), this method will return null.
GetPermissions(IGuildChannel)
Gets the level permissions granted to this user to a given channel.
Declaration
ChannelPermissions GetPermissions(IGuildChannel channel)
Parameters
Type | Name | Description |
---|---|---|
IGuildChannel | channel | The channel to get the permission from. |
Returns
Type | Description |
---|---|
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, Boolean, Embed, RequestOptions, Boolean, AllowedMentions, MessageReference, MessageComponent, ISticker[], Embed[], MessageFlags).
if (currentUser?.GetPermissions(targetChannel)?.AttachFiles)
await targetChannel.SendFileAsync("fortnite.png");
|
Improve this Doc
View Source
KickAsync(String, RequestOptions)
Kicks this user from this guild.
Declaration
Task KickAsync(string reason = null, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | reason | The reason for the kick which will be recorded in the audit log. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous kick operation. |
ModifyAsync(Action<GuildUserProperties>, RequestOptions)
Modifies this user's properties in this guild.
Declaration
Task ModifyAsync(Action<GuildUserProperties> func, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Action<GuildUserProperties> | func | The delegate containing the properties to modify the user with. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
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.
Declaration
Task RemoveRoleAsync(IRole role, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
IRole | role | The role to be removed from the user. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous role removal operation. |
RemoveRoleAsync(UInt64, RequestOptions)
Removes the specified roleId
from this user in the guild.
Declaration
Task RemoveRoleAsync(ulong roleId, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | roleId | The role to be removed from the user. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous role removal operation. |
RemoveRolesAsync(IEnumerable<IRole>, RequestOptions)
Removes the specified roles
from this user in the guild.
Declaration
Task RemoveRolesAsync(IEnumerable<IRole> roles, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IRole> | roles | The roles to be removed from the user. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous role removal operation. |
RemoveRolesAsync(IEnumerable<UInt64>, RequestOptions)
Removes the specified roleIds
from this user in the guild.
Declaration
Task RemoveRolesAsync(IEnumerable<ulong> roleIds, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<UInt64> | roleIds | The roles to be removed from the user. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
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.
Declaration
Task RemoveTimeOutAsync(RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous timeout removal operation. |
SetTimeOutAsync(TimeSpan, RequestOptions)
Sets a timeout based on provided
Declaration
Task SetTimeOutAsync(TimeSpan span, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
TimeSpan | span | The |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous timeout creation operation. |