Table of Contents

Class GuildUser

Namespace
NetCord
Assembly
NetCord.dll

Represents a user as a member of the guild indicated by the GuildId.

public class GuildUser : PartialGuildUser, IEntity, ISpanFormattable, IFormattable, IEquatable<Entity>, IJsonModel<JsonUser>, IJsonModel<JsonGuildUser>
Inheritance
GuildUser
Implements
Derived
Inherited Members
Extension Methods

Constructors

GuildUser(JsonGuildUser, ulong, RestClient)

Represents a user as a member of the guild indicated by the GuildId.

public GuildUser(JsonGuildUser jsonModel, ulong guildId, RestClient client)

Parameters

jsonModel JsonGuildUser
guildId ulong
client RestClient

Properties

GuildId

The ID of the guild the GuildUser object belongs to.

public ulong GuildId { get; }

Property Value

ulong

Methods

AddRoleAsync(ulong, RestRequestProperties?, CancellationToken)

public Task AddRoleAsync(ulong roleId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

roleId ulong
properties RestRequestProperties
cancellationToken CancellationToken

Returns

Task

BanAsync(int, RestRequestProperties?, CancellationToken)

public Task BanAsync(int deleteMessageSeconds = 0, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

deleteMessageSeconds int
properties RestRequestProperties
cancellationToken CancellationToken

Returns

Task

GetAsync(RestRequestProperties?, CancellationToken)

public Task<GuildUser> GetAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

properties RestRequestProperties
cancellationToken CancellationToken

Returns

Task<GuildUser>

GetGuildAvatarUrl(ImageFormat?)

Gets the ImageUrl of the user's guild avatar.

public ImageUrl? GetGuildAvatarUrl(ImageFormat? format = null)

Parameters

format ImageFormat?

The format of the returned ImageUrl. Defaults to Png (or Gif for animated avatars).

Returns

ImageUrl

An ImageUrl pointing to the user's guild avatar. If the user does not have one set, returns null.

GetGuildBannerUrl(ImageFormat?)

Gets the ImageUrl of the user's guild banner.

public ImageUrl? GetGuildBannerUrl(ImageFormat? format = null)

Parameters

format ImageFormat?

The format of the returned ImageUrl. Defaults to Png (or Gif for animated banners).

Returns

ImageUrl

An ImageUrl pointing to the user's guild banner. If the user does not have one set, returns null.

GetInfoAsync(RestRequestProperties?)

Returns a GuildUserInfo object representing the GuildUser.

public Task<GuildUserInfo> GetInfoAsync(RestRequestProperties? properties = null)

Parameters

properties RestRequestProperties

Additional properties to apply to the REST request.

Returns

Task<GuildUserInfo>

Exceptions

EntityNotFoundException

GetVoiceStateAsync(RestRequestProperties?, CancellationToken)

public Task<VoiceState> GetVoiceStateAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

properties RestRequestProperties
cancellationToken CancellationToken

Returns

Task<VoiceState>

KickAsync(RestRequestProperties?, CancellationToken)

public Task KickAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

properties RestRequestProperties
cancellationToken CancellationToken

Returns

Task

ModifyAsync(Action<GuildUserOptions>, RestRequestProperties?, CancellationToken)

public Task<GuildUser> ModifyAsync(Action<GuildUserOptions> action, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

action Action<GuildUserOptions>
properties RestRequestProperties
cancellationToken CancellationToken

Returns

Task<GuildUser>

ModifyVoiceStateAsync(ulong, Action<VoiceStateOptions>, RestRequestProperties?, CancellationToken)

public Task ModifyVoiceStateAsync(ulong channelId, Action<VoiceStateOptions> action, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

channelId ulong
action Action<VoiceStateOptions>
properties RestRequestProperties
cancellationToken CancellationToken

Returns

Task

RemoveRoleAsync(ulong, RestRequestProperties?, CancellationToken)

public Task RemoveRoleAsync(ulong roleId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

roleId ulong
properties RestRequestProperties
cancellationToken CancellationToken

Returns

Task

TimeOutAsync(DateTimeOffset, RestRequestProperties?)

Applies a timeout to the GuildUser for a specified DateTimeOffset.

public Task<GuildUser> TimeOutAsync(DateTimeOffset until, RestRequestProperties? properties = null)

Parameters

until DateTimeOffset

How long to time the GuildUser out for, specified as the time to wait until.

properties RestRequestProperties

Additional properties to apply to the REST request.

Returns

Task<GuildUser>

A GuildUser object updated with the new timeout.

UnbanAsync(RestRequestProperties?, CancellationToken)

public Task UnbanAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

properties RestRequestProperties
cancellationToken CancellationToken

Returns

Task