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
JsonGuildUserguildId
ulongclient
RestClient
Properties
GuildId
The ID of the guild the GuildUser object belongs to.
public ulong GuildId { get; }
Property Value
Methods
AddRoleAsync(ulong, RestRequestProperties?, CancellationToken)
public Task AddRoleAsync(ulong roleId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
roleId
ulongproperties
RestRequestPropertiescancellationToken
CancellationToken
Returns
BanAsync(int, RestRequestProperties?, CancellationToken)
public Task BanAsync(int deleteMessageSeconds = 0, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
deleteMessageSeconds
intproperties
RestRequestPropertiescancellationToken
CancellationToken
Returns
GetAsync(RestRequestProperties?, CancellationToken)
public Task<GuildUser> GetAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
properties
RestRequestPropertiescancellationToken
CancellationToken
Returns
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
RestRequestPropertiesAdditional properties to apply to the REST request.
Returns
Exceptions
GetVoiceStateAsync(RestRequestProperties?, CancellationToken)
public Task<VoiceState> GetVoiceStateAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
properties
RestRequestPropertiescancellationToken
CancellationToken
Returns
KickAsync(RestRequestProperties?, CancellationToken)
public Task KickAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
properties
RestRequestPropertiescancellationToken
CancellationToken
Returns
ModifyAsync(Action<GuildUserOptions>, RestRequestProperties?, CancellationToken)
public Task<GuildUser> ModifyAsync(Action<GuildUserOptions> action, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
action
Action<GuildUserOptions>properties
RestRequestPropertiescancellationToken
CancellationToken
Returns
ModifyVoiceStateAsync(ulong, Action<VoiceStateOptions>, RestRequestProperties?, CancellationToken)
public Task ModifyVoiceStateAsync(ulong channelId, Action<VoiceStateOptions> action, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
channelId
ulongaction
Action<VoiceStateOptions>properties
RestRequestPropertiescancellationToken
CancellationToken
Returns
RemoveRoleAsync(ulong, RestRequestProperties?, CancellationToken)
public Task RemoveRoleAsync(ulong roleId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
roleId
ulongproperties
RestRequestPropertiescancellationToken
CancellationToken
Returns
TimeOutAsync(DateTimeOffset, RestRequestProperties?)
Applies a timeout to the GuildUser for a specified DateTimeOffset.
public Task<GuildUser> TimeOutAsync(DateTimeOffset until, RestRequestProperties? properties = null)
Parameters
until
DateTimeOffsetHow long to time the GuildUser out for, specified as the time to wait until.
properties
RestRequestPropertiesAdditional properties to apply to the REST request.
Returns
UnbanAsync(RestRequestProperties?, CancellationToken)
public Task UnbanAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)
Parameters
properties
RestRequestPropertiescancellationToken
CancellationToken