Show / Hide Table of Contents

Interface IGuildUser

Represents a generic guild user.

Inherited Members
IUser.AvatarId
IUser.GetAvatarUrl(ImageFormat, UInt16)
IUser.GetDefaultAvatarUrl()
IUser.Discriminator
IUser.DiscriminatorValue
IUser.IsBot
IUser.IsWebhook
IUser.Username
IUser.GetOrCreateDMChannelAsync(RequestOptions)
ISnowflakeEntity.CreatedAt
IEntity<UInt64>.Id
IMentionable.Mention
IPresence.Activity
IPresence.Status
IPresence.ActiveClients
IVoiceState.IsDeafened
IVoiceState.IsMuted
IVoiceState.IsSelfDeafened
IVoiceState.IsSelfMuted
IVoiceState.IsSuppressed
IVoiceState.VoiceChannel
IVoiceState.VoiceSessionId
IVoiceState.IsStreaming
Namespace: Discord
Assembly: Discord.Net.Core.dll
Syntax
public interface IGuildUser : IUser, ISnowflakeEntity, IEntity<ulong>, IMentionable, IPresence, IVoiceState

Properties

| Improve this Doc View Source

Guild

Gets the guild for this user.

Declaration
IGuild Guild { get; }
Property Value
Type Description
IGuild

A guild object that this user belongs to.

| Improve this Doc View Source

GuildId

Gets the ID of the guild for this user.

Declaration
ulong GuildId { get; }
Property Value
Type Description
System.UInt64

An System.UInt64 representing the snowflake identifier of the guild that this user belongs to.

| Improve this Doc View Source

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.

| Improve this Doc View Source

JoinedAt

Gets when this user joined the guild.

Declaration
DateTimeOffset? JoinedAt { get; }
Property Value
Type Description
System.Nullable<System.DateTimeOffset>

A System.DateTimeOffset representing the time of which the user has joined the guild; null when it cannot be obtained.

| Improve this Doc View Source

Nickname

Gets the nickname for this user.

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

A string representing the nickname of the user; null if none is set.

| Improve this Doc View Source

PremiumSince

Gets the date and time for when this user's guild boost began.

Declaration
DateTimeOffset? PremiumSince { get; }
Property Value
Type Description
System.Nullable<System.DateTimeOffset>

A System.DateTimeOffset for when the user began boosting this guild; null if they are not boosting the guild.

| Improve this Doc View Source

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
System.Collections.Generic.IReadOnlyCollection<System.UInt64>

A read-only collection of System.UInt64, 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.

Methods

| Improve this Doc View Source

AddRoleAsync(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
System.Threading.Tasks.Task

A task that represents the asynchronous role addition operation.

| Improve this Doc View Source

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
System.Collections.Generic.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
System.Threading.Tasks.Task

A task that represents the asynchronous role addition operation.

| Improve this Doc View Source

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).

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
System.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
System.Threading.Tasks.Task

A task that represents the asynchronous kick operation.

| Improve this Doc View Source

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
System.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
System.Threading.Tasks.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.

| Improve this Doc View Source

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
System.Threading.Tasks.Task

A task that represents the asynchronous role removal operation.

| Improve this Doc View Source

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
System.Collections.Generic.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
System.Threading.Tasks.Task

A task that represents the asynchronous role removal operation.

Extension Methods

UserExtensions.SendMessageAsync(IUser, String, Boolean, Embed, RequestOptions)
UserExtensions.SendFileAsync(IUser, Stream, String, String, Boolean, Embed, RequestOptions)
UserExtensions.SendFileAsync(IUser, String, String, Boolean, Embed, RequestOptions)
UserExtensions.BanAsync(IGuildUser, Int32, String, RequestOptions)
  • Improve this Doc
  • View Source
Back to top Generated by DocFX