Table of Contents

Class SocketGuild

Namespace
Kook.WebSocket
Assembly
Kook.Net.WebSocket.dll

Represents a WebSocket-based guild object.

public class SocketGuild : SocketEntity<ulong>, IGuild, IEntity<ulong>, IDisposable, IUpdateable
Inheritance
SocketGuild
Implements
Inherited Members
Extension Methods

Properties

AudioClient

Gets the IAudioClient associated with this guild.

public IAudioClient AudioClient { get; }

Property Value

IAudioClient

AutoDeleteTime

TODO: To be documented.

public string AutoDeleteTime { get; }

Property Value

string

Banner

Gets the URL of this guild's banner image.

public string Banner { get; }

Property Value

string

A URL pointing to the guild's banner image; null if none is set.

BoostLevel

Gets the level of guild boosting in this guild.

public BoostLevel BoostLevel { get; }

Property Value

BoostLevel

The level of guild boosting in this guild.

BoostSubscriptionCount

Gets the number of boost subscribers of this guild.

public int BoostSubscriptionCount { get; }

Property Value

int

The number of boost subscribers of this guild.

BoostSubscriptions

Gets a dictionary of all boost subscriptions for this guild.

public ImmutableDictionary<IUser, IReadOnlyCollection<BoostSubscriptionMetadata>> BoostSubscriptions { get; }

Property Value

ImmutableDictionary<IUser, IReadOnlyCollection<BoostSubscriptionMetadata>>

A read-only dictionary containing all boost subscription metadata for this guild grouped by users; or null if the boost subscription data has never been cached.

Remarks

warning

Only when AlwaysDownloadBoostSubscriptions is set to true will this property be populated upon startup. Due to the lack of event support for boost subscriptions, this property will never be updated. The changes of BoostSubscriptionCount will trigger the update of this property, but KOOK gateway will not publish this event resulting from the changes of total boost subscription count. To fetch the latest boost subscription data, use DownloadBoostSubscriptionsAsync(RequestOptions) or DownloadBoostSubscriptionsAsync(IEnumerable<IGuild>, RequestOptions) upon a KookSocketClient to manually download the latest boost subscription data, or GetBoostSubscriptionsAsync(RequestOptions).

See Also

BufferBoostSubscriptionCount

Gets the number of boost subscribers who activates buffer of this guild.

public int BufferBoostSubscriptionCount { get; }

Property Value

int

The number of boost subscribers who activates buffer of this guild.

CategoryChannels

Gets a collection of all stage channels in this guild.

public IReadOnlyCollection<SocketCategoryChannel> CategoryChannels { get; }

Property Value

IReadOnlyCollection<SocketCategoryChannel>

A read-only collection of stage channels found within this guild.

Channels

Gets a collection of all channels in this guild.

public IReadOnlyCollection<SocketGuildChannel> Channels { get; }

Property Value

IReadOnlyCollection<SocketGuildChannel>

A read-only collection of generic channels found within this guild.

CurrentUser

Gets the current logged-in user.

public SocketGuildUser CurrentUser { get; }

Property Value

SocketGuildUser

DefaultChannel

Gets the default text channel for this guild.

public SocketTextChannel DefaultChannel { get; }

Property Value

SocketTextChannel

A SocketTextChannel representing the default text channel for this guild.

Remarks

This property retrieves default text channel for this guild.

DefaultChannelId

Gets the default channel ID for this guild.

public ulong? DefaultChannelId { get; }

Property Value

ulong?

A ulong representing the default channel ID for this guild.

DownloadedMemberCount

Gets the number of members downloaded to the local guild cache.

public int DownloadedMemberCount { get; }

Property Value

int

Emotes

Gets a collection of all custom emotes for this guild.

public IReadOnlyCollection<GuildEmote> Emotes { get; }

Property Value

IReadOnlyCollection<GuildEmote>

A read-only collection of all custom emotes for this guild.

See Also

EveryoneRole

Gets the built-in role containing all users in this guild.

public SocketRole EveryoneRole { get; }

Property Value

SocketRole

A role object that represents an @everyone role in this guild.

Features

Gets the features of this guild.

public GuildFeatures Features { get; }

Property Value

GuildFeatures

An array of string representing the features of this guild.

HasAllMembers

Indicates whether the client has all the members downloaded to the local guild cache.

public bool? HasAllMembers { get; }

Property Value

bool?

Remarks

warning

If MemberCount is null, this property will always return null, which means that the client is unable to determine whether all the members are downloaded or not.

Icon

Gets the URL of this guild's icon.

public string Icon { get; }

Property Value

string

A URL pointing to the guild's icon; null if none is set.

IsConnected

Indicates whether the client is connected to this guild.

public bool IsConnected { get; }

Property Value

bool

IsOpenEnabled

Gets whether this guild is public.

public bool IsOpenEnabled { get; }

Property Value

bool

true if this guild is public; false otherwise.

MaxBitrate

Gets the max bitrate for voice channels in this guild.

public int MaxBitrate { get; }

Property Value

int

A int representing the maximum bitrate value allowed by Kook in this guild.

MaxUploadLimit

Gets the upload limit in bytes for this guild. This number is dependent on the guild's boost status.

public ulong MaxUploadLimit { get; }

Property Value

ulong

MemberCount

Gets the number of members.

public int? MemberCount { get; }

Property Value

int?

Remarks

This property retrieves the number of members returned by Kook.

tip

Due to how this property is returned by Kook instead of relying on the WebSocket cache, the number here is the most accurate in terms of counting the number of users within this guild.

Use this instead of enumerating the count of the Users collection, as you may see discrepancy between that and this property.

warning

Only when AlwaysDownloadUsers is set to true will this property be populated upon startup. Otherwise, this property will be null, and will be populated when DownloadUsersAsync(RequestOptions) is called.

Name

Gets the name of this guild.

public string Name { get; }

Property Value

string

A string containing the name of this guild.

NotifyType

Gets the default notification type for this guild.

public NotifyType NotifyType { get; }

Property Value

NotifyType

A NotifyType representing the default notification type for this guild.

OpenId

Gets the open ID for this guild.

public uint? OpenId { get; }

Property Value

uint?

A uint representing the open ID for this guild; this property should be null if IsOpenEnabled is false.

Owner

Gets the user that owns this guild.

public SocketGuildUser Owner { get; }

Property Value

SocketGuildUser

OwnerId

Gets the ID of the user that owns this guild.

public ulong OwnerId { get; }

Property Value

ulong

A ulong representing the identifier of the user that owns this guild.

RecommendInfo

Gets the recommendation information for this guild.

public RecommendInfo RecommendInfo { get; }

Property Value

RecommendInfo

A recommendation object that represents the recommendation information for this guild; null if the guild does not have a recommendation.

Region

Gets the default voice region for this guild.

public string Region { get; }

Property Value

string

A string representing the default voice region for this guild.

Roles

Gets a collection of all roles in this guild.

public IReadOnlyCollection<SocketRole> Roles { get; }

Property Value

IReadOnlyCollection<SocketRole>

A read-only collection of roles found within this guild.

Remarks

warning

Due to the lack of event args which should contains the reordered roles data when roles are reordered, this property may not be completely accurate. To ensure the most accurate results, it is recommended to call UpdateAsync(RequestOptions) before this property is used.

Status

TODO: To be documented.

public int Status { get; }

Property Value

int

TextChannels

Gets a collection of all text channels in this guild.

public IReadOnlyCollection<SocketTextChannel> TextChannels { get; }

Property Value

IReadOnlyCollection<SocketTextChannel>

A read-only collection of message channels found within this guild.

Topic

Gets the topic for the guild.

public string Topic { get; }

Property Value

string

The description for the guild; null if none is set.

Users

Gets a collection of users in this guild.

public IReadOnlyCollection<SocketGuildUser> Users { get; }

Property Value

IReadOnlyCollection<SocketGuildUser>

A collection of guild users found within this guild.

Remarks

This property retrieves all users found within this guild.

warning

This property may not always return all the members for large guilds (i.e. guilds containing 100+ users). If you are simply looking to get the number of users present in this guild, consider using MemberCount instead.

Otherwise, you may need to enable AlwaysDownloadUsers to fetch the full user list upon startup, or use DownloadUsersAsync(RequestOptions) to manually download the users.

See Also

ValidBoostSubscriptions

Gets a dictionary of all boost subscriptions which have not expired for this guild.

public ImmutableDictionary<IUser, IReadOnlyCollection<BoostSubscriptionMetadata>> ValidBoostSubscriptions { get; }

Property Value

ImmutableDictionary<IUser, IReadOnlyCollection<BoostSubscriptionMetadata>>

A read-only dictionary containing all boost subscription metadata which have not expired for this guild grouped by users; or null if the boost subscription data has never been cached.

Remarks

warning

Only when AlwaysDownloadBoostSubscriptions is set to true will this property be populated upon startup. Due to the lack of event support for boost subscriptions, this property will never be updated. The changes of BoostSubscriptionCount will trigger the update of this property, but KOOK gateway will not publish this event resulting from the changes of total boost subscription count. To fetch the latest boost subscription data, use DownloadBoostSubscriptionsAsync(RequestOptions) or DownloadBoostSubscriptionsAsync(IEnumerable<IGuild>, RequestOptions) upon a KookSocketClient to manually download the latest boost subscription data, or GetBoostSubscriptionsAsync(RequestOptions).

See Also

VoiceChannels

Gets a collection of all voice channels in this guild.

public IReadOnlyCollection<SocketVoiceChannel> VoiceChannels { get; }

Property Value

IReadOnlyCollection<SocketVoiceChannel>

A read-only collection of voice channels found within this guild.

WelcomeChannel

Gets the welcome text channel for this guild.

public SocketTextChannel WelcomeChannel { get; }

Property Value

SocketTextChannel

A SocketTextChannel representing the default text channel for this guild.

Remarks

This property retrieves default text channel for this guild.

WelcomeChannelId

Gets the welcome channel ID for this guild.

public ulong? WelcomeChannelId { get; }

Property Value

ulong?

A ulong representing the welcome channel ID for this guild.

Methods

AddBanAsync(IUser, int, string, RequestOptions)

Bans the user from this guild and optionally prunes their recent messages.

public Task AddBanAsync(IUser user, int pruneDays = 0, string reason = null, RequestOptions options = null)

Parameters

user IUser

The user to ban.

pruneDays int

The number of days to remove messages from this user for, and this number must be between [0, 7].

reason string

The reason of the ban to be written in the audit log.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous add operation for the ban.

Exceptions

ArgumentException

pruneDays is not between 0 to 7.

AddBanAsync(ulong, int, string, RequestOptions)

Bans the user from this guild and optionally prunes their recent messages.

public Task AddBanAsync(ulong userId, int pruneDays = 0, string reason = null, RequestOptions options = null)

Parameters

userId ulong

The identifier of the user to ban.

pruneDays int

The number of days to remove messages from this user for, and this number must be between [0, 7].

reason string

The reason of the ban to be written in the audit log.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous add operation for the ban.

Exceptions

ArgumentException

pruneDays is not between 0 to 7.

CreateCategoryChannelAsync(string, Action<CreateCategoryChannelProperties>, RequestOptions)

Creates a new channel category in this guild.

public Task<RestCategoryChannel> CreateCategoryChannelAsync(string name, Action<CreateCategoryChannelProperties> func = null, RequestOptions options = null)

Parameters

name string

The new name for the category.

func Action<CreateCategoryChannelProperties>

The delegate containing the properties to be applied to the channel upon its creation.

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestCategoryChannel>

A task that represents the asynchronous creation operation. The task result contains the newly created category channel.

Exceptions

ArgumentNullException

name is null.

CreateEmoteAsync(string, Image, RequestOptions)

Creates a new GuildEmote in this guild.

public Task<GuildEmote> CreateEmoteAsync(string name, Image image, RequestOptions options = null)

Parameters

name string

The name of the guild emote.

image Image

The image of the new emote.

options RequestOptions

The options to be used when sending the request.

Returns

Task<GuildEmote>

A task that represents the asynchronous creation operation. The task result contains the created emote.

CreateInviteAsync(InviteMaxAge, InviteMaxUses, RequestOptions)

Creates a new invite to this channel.

public Task<IInvite> CreateInviteAsync(InviteMaxAge maxAge = InviteMaxAge._604800, InviteMaxUses maxUses = InviteMaxUses.Unlimited, RequestOptions options = null)

Parameters

maxAge InviteMaxAge

The time until the invite expires. Set to InviteMaxAge.NeverExpires to never expire.

maxUses InviteMaxUses

The max amount of times this invite may be used. Set to InviteMaxUses.Unlimited to have unlimited uses.

options RequestOptions

The options to be used when sending the request.

Returns

Task<IInvite>

A task that represents the asynchronous invite creation operation. The task result contains an invite metadata object containing information for the created invite.

CreateInviteAsync(int?, int?, RequestOptions)

Creates a new invite to this channel.

public Task<IInvite> CreateInviteAsync(int? maxAge = 604800, int? maxUses = null, RequestOptions options = null)

Parameters

maxAge int?

The time (in seconds) until the invite expires. Set to null to never expire.

maxUses int?

The max amount of times this invite may be used. Set to null to have unlimited uses.

options RequestOptions

The options to be used when sending the request.

Returns

Task<IInvite>

A task that represents the asynchronous invite creation operation. The task result contains an invite metadata object containing information for the created invite.

CreateRoleAsync(string, RequestOptions)

Creates a new role with the provided name.

public Task<RestRole> CreateRoleAsync(string name, RequestOptions options = null)

Parameters

name string

The new name for the role.

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestRole>

A task that represents the asynchronous creation operation. The task result contains the newly created role.

Exceptions

ArgumentNullException

name is null.

CreateTextChannelAsync(string, Action<CreateTextChannelProperties>, RequestOptions)

Creates a new text channel in this guild.

public Task<RestTextChannel> CreateTextChannelAsync(string name, Action<CreateTextChannelProperties> func = null, RequestOptions options = null)

Parameters

name string

The new name for the text channel.

func Action<CreateTextChannelProperties>

The delegate containing the properties to be applied to the channel upon its creation.

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestTextChannel>

A task that represents the asynchronous creation operation. The task result contains the newly created text channel.

CreateVoiceChannelAsync(string, Action<CreateVoiceChannelProperties>, RequestOptions)

Creates a new voice channel in this guild.

public Task<RestVoiceChannel> CreateVoiceChannelAsync(string name, Action<CreateVoiceChannelProperties> func = null, RequestOptions options = null)

Parameters

name string

The new name for the voice channel.

func Action<CreateVoiceChannelProperties>

The delegate containing the properties to be applied to the channel upon its creation.

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestVoiceChannel>

A task that represents the asynchronous creation operation. The task result contains the newly created voice channel.

Exceptions

ArgumentNullException

name is null.

DeleteEmoteAsync(GuildEmote, RequestOptions)

Deletes an existing GuildEmote from this guild.

public Task DeleteEmoteAsync(GuildEmote emote, RequestOptions options = null)

Parameters

emote GuildEmote

The emote to delete.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous removal operation.

Dispose()

Performs application-defined tasks associated with freeing, releasing, or resetting unmanaged resources.

public void Dispose()

DownloadBoostSubscriptionsAsync(RequestOptions)

Downloads all boost subscriptions for this guild.

public Task DownloadBoostSubscriptionsAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous download operation.

Remarks

This method downloads all boost subscriptions for this guild through the Gateway and caches them. To download all boost subscriptions, the current user must has the ManageGuild permission.

DownloadUsersAsync(RequestOptions)

Downloads all users for this guild if the current list is incomplete.

public Task DownloadUsersAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous download operation.

Remarks

This method downloads all users found within this guild through the Gateway and caches them.

DownloadVoiceStatesAsync(RequestOptions)

Downloads all voice states for this guild.

public Task DownloadVoiceStatesAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous download operation.

Remarks

This method downloads all voice states for this guild through the Gateway and caches them.

GetActiveBoostSubscriptionsAsync(RequestOptions)

Gets subscriptions which are not expired for this guild.

public Task<ImmutableDictionary<IUser, IReadOnlyCollection<BoostSubscriptionMetadata>>> GetActiveBoostSubscriptionsAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<ImmutableDictionary<IUser, IReadOnlyCollection<BoostSubscriptionMetadata>>>

A task that represents the asynchronous retrieval operation. The task result contains a collection of BoostSubscriptionMetadata which are not expired, each representing the subscriptions information.

GetBadgeAsync(BadgeStyle, RequestOptions)

Gets a badge which is associated with this guild.

public Task<Stream> GetBadgeAsync(BadgeStyle style = BadgeStyle.GuildName, RequestOptions options = null)

Parameters

style BadgeStyle

The BadgeStyle that specifies the style of the badge.

options RequestOptions

The options to be used when sending the request.

Returns

Task<Stream>

A task that represents the asynchronous get operation. The task result contains the stream of the badge associated with this guild.

GetBanAsync(IUser, RequestOptions)

Gets a ban object for a banned user.

public Task<RestBan> GetBanAsync(IUser user, RequestOptions options = null)

Parameters

user IUser

The banned user.

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestBan>

A task that represents the asynchronous get operation. The task result contains a ban object, which contains the user information and the reason for the ban; null if the ban entry cannot be found.

GetBanAsync(ulong, RequestOptions)

Gets a ban object for a banned user.

public Task<RestBan> GetBanAsync(ulong userId, RequestOptions options = null)

Parameters

userId ulong

The identifier for the banned user.

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestBan>

A task that represents the asynchronous get operation. The task result contains a ban object, which contains the user information and the reason for the ban; null if the ban entry cannot be found.

GetBansAsync(RequestOptions)

Gets a collection of all users banned in this guild.

public Task<IReadOnlyCollection<RestBan>> GetBansAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<RestBan>>

A task that represents the asynchronous get operation. The task result contains a read-only collection of ban objects that this guild currently possesses, with each object containing the user banned and reason behind the ban.

GetBoostSubscriptionsAsync(RequestOptions)

Gets all subscriptions for this guild.

public Task<ImmutableDictionary<IUser, IReadOnlyCollection<BoostSubscriptionMetadata>>> GetBoostSubscriptionsAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<ImmutableDictionary<IUser, IReadOnlyCollection<BoostSubscriptionMetadata>>>

A task that represents the asynchronous retrieval operation. The task result contains a collection of BoostSubscriptionMetadata, each representing the subscriptions information.

GetCategoryChannel(ulong)

Gets a category channel in this guild.

public SocketCategoryChannel GetCategoryChannel(ulong id)

Parameters

id ulong

The snowflake identifier for the category channel.

Returns

SocketCategoryChannel

A category channel associated with the specified id; null if none is found.

GetChannel(ulong)

Gets a channel in this guild.

public SocketGuildChannel GetChannel(ulong id)

Parameters

id ulong

The identifier for the channel.

Returns

SocketGuildChannel

A generic channel associated with the specified id; null if none is found.

GetEmote(string)

Gets a guild emoji in this guild.

public GuildEmote GetEmote(string id)

Parameters

id string

The identifier for the guild emoji.

Returns

GuildEmote

A guild emoji associated with the specified id; null if none is found.

GetEmoteAsync(string, RequestOptions)

Gets a specific emote from this guild.

public Task<GuildEmote> GetEmoteAsync(string id, RequestOptions options = null)

Parameters

id string

The identifier for the guild emote.

options RequestOptions

The options to be used when sending the request.

Returns

Task<GuildEmote>

A task that represents the asynchronous get operation. The task result contains the emote found with the specified id; null if none is found.

GetEmotesAsync(RequestOptions)

Gets a collection of emotes from this guild.

public Task<IReadOnlyCollection<GuildEmote>> GetEmotesAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<GuildEmote>>

A task that represents the asynchronous get operation. The task result contains a read-only collection of emotes found within the guild.

GetInvitesAsync(RequestOptions)

Gets a collection of all invites in this guild.

public Task<IReadOnlyCollection<IInvite>> GetInvitesAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<IInvite>>

A task that represents the asynchronous get operation. The task result contains a read-only collection of invite, each representing information for an invite found within this guild.

GetRole(uint)

Gets a role in this guild.

public SocketRole GetRole(uint id)

Parameters

id uint

The identifier for the role.

Returns

SocketRole

A role that is associated with the specified id; null if none is found.

GetTextChannel(ulong)

Gets a text channel in this guild.

public SocketTextChannel GetTextChannel(ulong id)

Parameters

id ulong

The identifier for the text channel.

Returns

SocketTextChannel

A text channel associated with the specified id; null if none is found.

GetUser(ulong)

Gets a user from this guild.

public SocketGuildUser GetUser(ulong id)

Parameters

id ulong

The identifier of the user.

Returns

SocketGuildUser

A guild user associated with the specified id; null if none is found.

Remarks

This method retrieves a user found within this guild.

note

This may return null in the WebSocket implementation due to incomplete user collection in large guilds.

GetUsersAsync(RequestOptions)

Gets a collection of all users in this guild.

public IAsyncEnumerable<IReadOnlyCollection<IGuildUser>> GetUsersAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

IAsyncEnumerable<IReadOnlyCollection<IGuildUser>>

A task that represents the asynchronous get operation. The task result contains a collection of guild users found within this guild.

Remarks

This method retrieves all users found within this guild through REST.

Users returned by this method are not cached.

GetVoiceChannel(ulong)

Gets a voice channel in this guild.

public SocketVoiceChannel GetVoiceChannel(ulong id)

Parameters

id ulong

The identifier for the voice channel.

Returns

SocketVoiceChannel

A voice channel associated with the specified id; null if none is found.

LeaveAsync(RequestOptions)

Leaves this guild.

public Task LeaveAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous leave operation.

Remarks

This method will make the currently logged-in user leave the guild.

note

If the user is the owner of this guild, use DeleteAsync(RequestOptions) instead.

ModifyEmoteNameAsync(GuildEmote, string, RequestOptions)

Modifies an existing GuildEmote in this guild.

public Task ModifyEmoteNameAsync(GuildEmote emote, string name, RequestOptions options = null)

Parameters

emote GuildEmote

The emote to be modified.

name string

The new name of the emote.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous modification operation. The task result contains the modified emote.

Exceptions

ArgumentNullException

name is null.

MoveUsersAsync(IEnumerable<IGuildUser>, IVoiceChannel, RequestOptions)

Moves the user to the voice channel.

public Task MoveUsersAsync(IEnumerable<IGuildUser> users, IVoiceChannel targetChannel, RequestOptions options = null)

Parameters

users IEnumerable<IGuildUser>

The users to move.

targetChannel IVoiceChannel

the channel where the user gets moved to.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous operation for moving a user.

PurgeUserCache()

Purges this guild's user cache.

public void PurgeUserCache()

PurgeUserCache(Func<SocketGuildUser, bool>)

Purges this guild's user cache.

public void PurgeUserCache(Func<SocketGuildUser, bool> predicate)

Parameters

predicate Func<SocketGuildUser, bool>

The predicate used to select which users to clear.

RemoveBanAsync(IUser, RequestOptions)

Unbans the user if they are currently banned.

public Task RemoveBanAsync(IUser user, RequestOptions options = null)

Parameters

user IUser

The user to be unbanned.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous removal operation for the ban.

RemoveBanAsync(ulong, RequestOptions)

Unbans the user if they are currently banned.

public Task RemoveBanAsync(ulong userId, RequestOptions options = null)

Parameters

userId ulong

The identifier of the user to be unbanned.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous removal operation for the ban.

SearchUsersAsync(Action<SearchGuildMemberProperties>, int, RequestOptions)

Gets a collection of users in this guild that the name or nickname contains the provided string at func.

public IAsyncEnumerable<IReadOnlyCollection<RestGuildUser>> SearchUsersAsync(Action<SearchGuildMemberProperties> func, int limit = 50, RequestOptions options = null)

Parameters

func Action<SearchGuildMemberProperties>

A delegate containing the properties to search users with.

limit int

The maximum number of users to be gotten.

options RequestOptions

The options to be used when sending the request.

Returns

IAsyncEnumerable<IReadOnlyCollection<RestGuildUser>>

A task that represents the asynchronous get operation. The task result contains a collection of guild users that matches the properties with the provided Action<T> at func.

Remarks

The limit can not be higher than MaxUsersPerBatch.

ToString()

Gets the name of the guild.

public override string ToString()

Returns

string

A string that resolves to Name.

UpdateAsync(RequestOptions)

Updates this object's properties with its current state.

public Task UpdateAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents an asynchronous reloading operation.

Remarks

warning

This method will fetch the latest data from REST API, and replace the current object's properties with the new data.