Class SocketGuild
Represents a WebSocket-based guild object.
public class SocketGuild : SocketEntity<ulong>, IGuild, IDeletable, ISnowflakeEntity, IEntity<ulong>, IDisposable
- Inheritance
-
SocketGuild
- Implements
- Inherited Members
- Extension Methods
Properties
AFKChannel
Gets the AFK voice channel in this guild.
public SocketVoiceChannel AFKChannel { get; }
Property Value
- SocketVoiceChannel
A SocketVoiceChannel that the AFK users will be moved to after they have idled for too long; null if none is set.
AFKTimeout
Gets the amount of time (in seconds) a user must be inactive in a voice channel for until they are automatically moved to the AFK voice channel.
public int AFKTimeout { get; }
Property Value
- int
An int representing the amount of time in seconds for a user to be marked as inactive and moved into the AFK voice channel.
ApplicationId
Gets the application ID of the guild creator if it is bot-created.
public ulong? ApplicationId { get; }
Property Value
- ulong?
A ulong representing the snowflake identifier of the application ID that created this guild, or null if it was not bot-created.
AudioClient
Gets the IAudioClient associated with this guild.
public IAudioClient AudioClient { get; }
Property Value
AutoModRules
Gets the auto moderation rules defined in this guild.
public IReadOnlyCollection<SocketAutoModRule> AutoModRules { get; }
Property Value
Remarks
This property may not always return all auto moderation rules if they haven't been cached.
BannerId
Gets the identifier for this guilds banner image.
public string BannerId { get; }
Property Value
BannerUrl
Gets the URL of this guild's banner image.
public string BannerUrl { get; }
Property Value
CachedAuditLogs
Gets all cached audit log entries from this guild.
public IReadOnlyCollection<SocketAuditLogEntry> CachedAuditLogs { get; }
Property Value
CategoryChannels
Gets a collection of all category channels in this guild.
public IReadOnlyCollection<SocketCategoryChannel> CategoryChannels { get; }
Property Value
- IReadOnlyCollection<SocketCategoryChannel>
A read-only collection of category 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.
CreatedAt
Gets when the snowflake was created.
public DateTimeOffset CreatedAt { get; }
Property Value
- DateTimeOffset
A DateTimeOffset representing when the entity was first created.
CurrentUser
Gets the current logged-in user.
public SocketGuildUser CurrentUser { get; }
Property Value
DefaultChannel
Gets the default channel in this guild.
public SocketTextChannel DefaultChannel { get; }
Property Value
- SocketTextChannel
A SocketTextChannel representing the first viewable channel that the user has access to.
Remarks
This property retrieves the first viewable text channel for this guild.
warning
This channel does not guarantee the user can send message to it, as it only looks for the first viewable text channel.
DefaultMessageNotifications
Gets the default message notifications for users who haven't explicitly set their notification settings.
public DefaultMessageNotifications DefaultMessageNotifications { get; }
Property Value
Description
Gets the description for the guild.
public string Description { get; }
Property Value
DiscoverySplashId
Gets the ID of this guild's discovery splash image.
public string DiscoverySplashId { get; }
Property Value
DiscoverySplashUrl
Gets the URL of this guild's discovery splash image.
public string DiscoverySplashUrl { get; }
Property Value
DownloadedMemberCount
Gets the number of members downloaded to the local guild cache.
public int DownloadedMemberCount { get; }
Property Value
DownloaderPromise
public Task DownloaderPromise { get; }
Property Value
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.
Events
Gets a collection of all events within this guild.
public IReadOnlyCollection<SocketGuildEvent> Events { get; }
Property Value
- IReadOnlyCollection<SocketGuildEvent>
A read-only collection of guild events found within this guild.
Remarks
This field is based off of caching alone, since there is no events returned on the guild model.
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.
ExplicitContentFilter
Gets the level of content filtering applied to user's content in a Guild.
public ExplicitContentFilterLevel ExplicitContentFilter { get; }
Property Value
- ExplicitContentFilterLevel
The level of explicit content filtering.
Features
Gets the features for this guild.
public GuildFeatures Features { get; }
Property Value
- GuildFeatures
A flags enum containing all the features for the guild.
ForumChannels
Gets a collection of all forum channels in this guild.
public IReadOnlyCollection<SocketForumChannel> ForumChannels { get; }
Property Value
- IReadOnlyCollection<SocketForumChannel>
A read-only collection of forum channels found within this guild.
HasAllMembers
Indicates whether the client has all the members downloaded to the local guild cache.
public bool HasAllMembers { get; }
Property Value
IconId
Gets the ID of this guild's icon.
public string IconId { get; }
Property Value
IconUrl
Gets the URL of this guild's icon.
public string IconUrl { get; }
Property Value
IncidentsData
Gets the incidents data for this guild.
public GuildIncidentsData IncidentsData { get; }
Property Value
InventorySettings
Get the inventory settings on the guild. null if not available in the guild.
public GuildInventorySettings? InventorySettings { get; }
Property Value
IsBoostProgressBarEnabled
Gets whether the guild has the boost progress bar enabled.
public bool IsBoostProgressBarEnabled { get; }
Property Value
IsConnected
Indicates whether the client is connected to this guild.
public bool IsConnected { get; }
Property Value
IsSynced
Indicates whether the guild cache is synced to this guild.
public bool IsSynced { get; }
Property Value
IsWidgetEnabled
Gets a value that indicates whether this guild has the widget enabled.
public bool IsWidgetEnabled { get; }
Property Value
MaxBitrate
Gets the max bitrate for voice channels in this guild.
public int MaxBitrate { get; }
Property Value
MaxMembers
Gets the maximum number of members for the guild.
public int? MaxMembers { get; }
Property Value
- int?
The maximum number of members for the guild.
MaxPresences
Gets the maximum number of presences for the guild.
public int? MaxPresences { get; }
Property Value
- int?
The maximum number of presences for the guild.
MaxStageVideoChannelUsers
Gets the maximum amount of users in a stage video channel.
public int? MaxStageVideoChannelUsers { get; }
Property Value
- int?
The maximum amount of users in a stage video channel.
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
MaxVideoChannelUsers
Gets the maximum amount of users in a video channel.
public int? MaxVideoChannelUsers { get; }
Property Value
- int?
The maximum amount of users in a video channel.
MediaChannels
Gets a collection of all media channels in this guild.
public IReadOnlyCollection<SocketMediaChannel> MediaChannels { get; }
Property Value
- IReadOnlyCollection<SocketMediaChannel>
A read-only collection of forum channels found within this guild.
MemberCount
Gets the number of members.
public int MemberCount { get; }
Property Value
Remarks
This property retrieves the number of members returned by Discord.
tip
Due to how this property is returned by Discord 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.
MfaLevel
Gets the level of Multi-Factor Authentication requirements a user must fulfill before being allowed to perform administrative actions in this guild.
public MfaLevel MfaLevel { get; }
Property Value
- MfaLevel
The level of MFA requirement.
Name
Gets the name of this guild.
public string Name { get; }
Property Value
- string
A string containing the name of this guild.
NsfwLevel
Gets the NSFW level of this guild.
public NsfwLevel NsfwLevel { get; }
Property Value
- NsfwLevel
The NSFW level of this guild.
Owner
Gets the user that owns this guild.
public SocketGuildUser Owner { get; }
Property Value
OwnerId
Gets the ID of the user that owns this guild.
public ulong OwnerId { get; }
Property Value
PreferredCulture
Gets the preferred culture of this guild.
public CultureInfo PreferredCulture { get; }
Property Value
- CultureInfo
The preferred culture information of this guild.
PreferredLocale
Gets the preferred locale of this guild in IETF BCP 47 language tag format.
public string PreferredLocale { get; }
Property Value
- string
The preferred locale of the guild in IETF BCP 47 language tag format.
PremiumSubscriptionCount
Gets the number of premium subscribers of this guild.
public int PremiumSubscriptionCount { get; }
Property Value
- int
The number of premium subscribers of this guild.
Remarks
This is the number of users who have boosted this guild.
PremiumTier
Gets the tier of guild boosting in this guild.
public PremiumTier PremiumTier { get; }
Property Value
- PremiumTier
The tier of guild boosting in this guild.
PublicUpdatesChannel
Gets the channel where admins and moderators of Community guilds receive notices from Discord.
public SocketTextChannel PublicUpdatesChannel { get; }
Property Value
- SocketTextChannel
A text channel where admins and moderators of Community guilds receive notices from Discord; null if none is set.
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.
RulesChannel
Gets the channel with the guild rules.
public SocketTextChannel RulesChannel { get; }
Property Value
- SocketTextChannel
A text channel with the guild rules; null if none is set.
SafetyAlertsChannel
Gets the safety alerts channel in this guild.
public SocketGuildChannel SafetyAlertsChannel { get; }
Property Value
- SocketGuildChannel
The channel set for receiving safety alerts channel; null if none is set.
SplashId
Gets the ID of this guild's splash image.
public string SplashId { get; }
Property Value
SplashUrl
Gets the URL of this guild's splash image.
public string SplashUrl { get; }
Property Value
StageChannels
Gets a collection of all stage channels in this guild.
public IReadOnlyCollection<SocketStageChannel> StageChannels { get; }
Property Value
- IReadOnlyCollection<SocketStageChannel>
A read-only collection of stage channels found within this guild.
Stickers
Gets a collection of all custom stickers for this guild.
public IReadOnlyCollection<SocketCustomSticker> Stickers { get; }
Property Value
SyncPromise
public Task SyncPromise { get; }
Property Value
SystemChannel
Gets the system channel where randomized welcome messages are sent in this guild.
public SocketTextChannel SystemChannel { get; }
Property Value
- SocketTextChannel
A text channel where randomized welcome messages will be sent to; null if none is set.
SystemChannelFlags
Gets the flags for the types of system channel messages that are disabled.
public SystemChannelMessageDeny SystemChannelFlags { get; }
Property Value
- SystemChannelMessageDeny
The flags for the types of system channel messages that are disabled.
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.
ThreadChannels
Gets a collection of all thread channels in this guild.
public IReadOnlyCollection<SocketThreadChannel> ThreadChannels { get; }
Property Value
- IReadOnlyCollection<SocketThreadChannel>
A read-only collection of thread channels found within this guild.
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() to manually download the users.
VanityURLCode
Gets the code for this guild's vanity invite URL.
public string VanityURLCode { get; }
Property Value
VerificationLevel
Gets the level of requirements a user must fulfill before being allowed to post messages in this guild.
public VerificationLevel VerificationLevel { get; }
Property Value
- VerificationLevel
The level of requirements.
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.
VoiceRegionId
Gets the ID of the region hosting this guild's voice channels.
public string VoiceRegionId { get; }
Property Value
- string
A string containing the identifier for the voice region that this guild uses (e.g.
eu-central
).
WidgetChannel
Gets the widget channel (i.e. the channel set in the guild's widget settings) in this guild.
public SocketGuildChannel WidgetChannel { get; }
Property Value
- SocketGuildChannel
A channel set within the server's widget settings; null if none is set.
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
IUserThe user to ban.
pruneDays
intThe number of days to remove messages from this user for, and this number must be between [0, 7].
reason
stringThe reason of the ban to be written in the audit log.
options
RequestOptionsThe 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
ulongThe snowflake ID of the user to ban.
pruneDays
intThe number of days to remove messages from this user for, and this number must be between [0, 7].
reason
stringThe reason of the ban to be written in the audit log.
options
RequestOptionsThe 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.
AddGuildUserAsync(ulong, string, Action<AddGuildUserProperties>, RequestOptions)
public Task<RestGuildUser> AddGuildUserAsync(ulong id, string accessToken, Action<AddGuildUserProperties> func = null, RequestOptions options = null)
Parameters
id
ulongaccessToken
stringfunc
Action<AddGuildUserProperties>options
RequestOptions
Returns
BanUserAsync(IUser, uint, RequestOptions)
Bans the user from this guild and optionally prunes their recent messages.
public Task BanUserAsync(IUser user, uint pruneSeconds = 0, RequestOptions options = null)
Parameters
user
IUserThe user to ban.
pruneSeconds
uintThe number of seconds to remover messages from this user for, between 0 and 604800
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous add operation for the ban.
BanUserAsync(ulong, uint, RequestOptions)
Bans the user from this guild and optionally prunes their recent messages.
public Task BanUserAsync(ulong userId, uint pruneSeconds = 0, RequestOptions options = null)
Parameters
userId
ulongThe ID of the user to ban.
pruneSeconds
uintThe number of seconds to remover messages from this user for, between 0 and 604800
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous add operation for the ban.
BulkBanAsync(IEnumerable<ulong>, int?, RequestOptions)
Executes a bulk ban on the specified users.
public Task<BulkBanResult> BulkBanAsync(IEnumerable<ulong> userIds, int? deleteMessageSeconds = null, RequestOptions options = null)
Parameters
userIds
IEnumerable<ulong>A collection of user ids to ban.
deleteMessageSeconds
int?The number of seconds to delete messages for. Max 604800.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<BulkBanResult>
A task that represents the asynchronous creation operation. The task result contains a BulkBanResult.
BulkOverwriteApplicationCommandAsync(ApplicationCommandProperties[], RequestOptions)
Overwrites the application commands within this guild.
public Task<IReadOnlyCollection<SocketApplicationCommand>> BulkOverwriteApplicationCommandAsync(ApplicationCommandProperties[] properties, RequestOptions options = null)
Parameters
properties
ApplicationCommandProperties[]A collection of properties to use when creating the commands.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<IReadOnlyCollection<SocketApplicationCommand>>
A task that represents the asynchronous creation operation. The task result contains a collection of commands that was created.
CreateApplicationCommandAsync(ApplicationCommandProperties, RequestOptions)
Creates an application command within this guild.
public Task<SocketApplicationCommand> CreateApplicationCommandAsync(ApplicationCommandProperties properties, RequestOptions options = null)
Parameters
properties
ApplicationCommandPropertiesThe properties to use when creating the command.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<SocketApplicationCommand>
A task that represents the asynchronous creation operation. The task result contains the command that was created.
CreateAutoModRuleAsync(Action<AutoModRuleProperties>, RequestOptions)
Creates a new auto moderation rule.
public Task<SocketAutoModRule> CreateAutoModRuleAsync(Action<AutoModRuleProperties> props, RequestOptions options = null)
Parameters
props
Action<AutoModRuleProperties>options
RequestOptions
Returns
- Task<SocketAutoModRule>
A task that represents the asynchronous creation operation. The task result contains the created IAutoModRule.
CreateCategoryChannelAsync(string, Action<GuildChannelProperties>, RequestOptions)
Creates a new channel category in this guild.
public Task<RestCategoryChannel> CreateCategoryChannelAsync(string name, Action<GuildChannelProperties> func = null, RequestOptions options = null)
Parameters
name
stringThe new name for the category.
func
Action<GuildChannelProperties>The delegate containing the properties to be applied to the channel upon its creation.
options
RequestOptionsThe 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, Optional<IEnumerable<IRole>>, RequestOptions)
Creates a new GuildEmote in this guild.
public Task<GuildEmote> CreateEmoteAsync(string name, Image image, Optional<IEnumerable<IRole>> roles = default, RequestOptions options = null)
Parameters
name
stringThe name of the guild emote.
image
ImageThe image of the new emote.
roles
Optional<IEnumerable<IRole>>The roles to limit the emote usage to.
options
RequestOptionsThe 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.
CreateEventAsync(string, DateTimeOffset, GuildScheduledEventType, GuildScheduledEventPrivacyLevel, string, DateTimeOffset?, ulong?, string, Image?, RequestOptions, GuildScheduledEventRecurrenceRuleProperties)
Creates an event within this guild.
public Task<RestGuildEvent> CreateEventAsync(string name, DateTimeOffset startTime, GuildScheduledEventType type, GuildScheduledEventPrivacyLevel privacyLevel = GuildScheduledEventPrivacyLevel.Private, string description = null, DateTimeOffset? endTime = null, ulong? channelId = null, string location = null, Image? coverImage = null, RequestOptions options = null, GuildScheduledEventRecurrenceRuleProperties recurrenceRule = null)
Parameters
name
stringThe name of the event.
startTime
DateTimeOffsetThe start time of the event.
type
GuildScheduledEventTypeThe type of the event.
privacyLevel
GuildScheduledEventPrivacyLevelThe privacy level of the event.
description
stringThe description of the event.
endTime
DateTimeOffset?The end time of the event.
channelId
ulong?The channel id of the event.
The event must have a type of Stage or Voice in order to use this property. location
stringThe location of the event; links are supported
coverImage
Image?The optional banner image for the event.
options
RequestOptionsThe options to be used when sending the request.
recurrenceRule
GuildScheduledEventRecurrenceRulePropertiesThe definition for how often this event should recur.
Returns
- Task<RestGuildEvent>
A task that represents the asynchronous create operation.
CreateForumChannelAsync(string, Action<ForumChannelProperties>, RequestOptions)
Creates a new forum channel in this guild.
public Task<RestForumChannel> CreateForumChannelAsync(string name, Action<ForumChannelProperties> func = null, RequestOptions options = null)
Parameters
name
stringThe new name for the forum.
func
Action<ForumChannelProperties>The delegate containing the properties to be applied to the channel upon its creation.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<RestForumChannel>
A task that represents the asynchronous creation operation. The task result contains the newly created forum channel.
Exceptions
- ArgumentNullException
name
is null.
CreateMediaChannelAsync(string, Action<ForumChannelProperties>, RequestOptions)
Creates a new media channel in this guild.
public Task<RestMediaChannel> CreateMediaChannelAsync(string name, Action<ForumChannelProperties> func = null, RequestOptions options = null)
Parameters
name
stringThe new name for the media channel.
func
Action<ForumChannelProperties>The delegate containing the properties to be applied to the channel upon its creation.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<RestMediaChannel>
A task that represents the asynchronous creation operation. The task result contains the newly created media channel.
Exceptions
- ArgumentNullException
name
is null.
CreateNewsChannelAsync(string, Action<TextChannelProperties>, RequestOptions)
Creates a new announcement channel in this guild.
public Task<RestNewsChannel> CreateNewsChannelAsync(string name, Action<TextChannelProperties> func = null, RequestOptions options = null)
Parameters
name
stringThe new name for the announcement channel.
func
Action<TextChannelProperties>The delegate containing the properties to be applied to the channel upon its creation.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<RestNewsChannel>
A task that represents the asynchronous creation operation. The task result contains the newly created announcement channel.
Remarks
Announcement channels are only available in Community guilds.
CreateRoleAsync(string, GuildPermissions?, Color?, bool, bool, RequestOptions, Image?, Emoji)
Creates a new role with the provided name.
public Task<RestRole> CreateRoleAsync(string name, GuildPermissions? permissions = null, Color? color = null, bool isHoisted = false, bool isMentionable = false, RequestOptions options = null, Image? icon = null, Emoji emoji = null)
Parameters
name
stringThe new name for the role.
permissions
GuildPermissions?The guild permission that the role should possess.
color
Color?The color of the role.
isHoisted
boolWhether the role is separated from others on the sidebar.
isMentionable
boolWhether the role can be mentioned.
options
RequestOptionsThe options to be used when sending the request.
icon
Image?The icon for the role.
emoji
EmojiThe unicode emoji to be used as an icon for the role.
Returns
- Task<RestRole>
A task that represents the asynchronous creation operation. The task result contains the newly created role.
Exceptions
- ArgumentNullException
name
is null.
CreateStageChannelAsync(string, Action<VoiceChannelProperties>, RequestOptions)
Creates a new stage channel in this guild.
public Task<RestStageChannel> CreateStageChannelAsync(string name, Action<VoiceChannelProperties> func = null, RequestOptions options = null)
Parameters
name
stringThe new name for the stage channel.
func
Action<VoiceChannelProperties>The delegate containing the properties to be applied to the channel upon its creation.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<RestStageChannel>
A task that represents the asynchronous creation operation. The task result contains the newly created stage channel.
CreateStickerAsync(string, Image, IEnumerable<string>, string, RequestOptions)
Creates a new sticker in this guild.
public Task<SocketCustomSticker> CreateStickerAsync(string name, Image image, IEnumerable<string> tags, string description = null, RequestOptions options = null)
Parameters
name
stringThe name of the sticker.
image
ImageThe image of the new emote.
tags
IEnumerable<string>The tags of the sticker.
description
stringThe description of the sticker.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<SocketCustomSticker>
A task that represents the asynchronous creation operation. The task result contains the created sticker.
CreateStickerAsync(string, Stream, string, IEnumerable<string>, string, RequestOptions)
Creates a new sticker in this guild
public Task<SocketCustomSticker> CreateStickerAsync(string name, Stream stream, string filename, IEnumerable<string> tags, string description = null, RequestOptions options = null)
Parameters
name
stringThe name of the sticker.
stream
StreamThe stream containing the file data.
filename
stringThe name of the file with the extension, ex: image.png.
tags
IEnumerable<string>The tags of the sticker.
description
stringThe description of the sticker.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<SocketCustomSticker>
A task that represents the asynchronous creation operation. The task result contains the created sticker.
CreateStickerAsync(string, string, IEnumerable<string>, string, RequestOptions)
Creates a new sticker in this guild
public Task<SocketCustomSticker> CreateStickerAsync(string name, string path, IEnumerable<string> tags, string description = null, RequestOptions options = null)
Parameters
name
stringThe name of the sticker.
path
stringThe path of the file to upload.
tags
IEnumerable<string>The tags of the sticker.
description
stringThe description of the sticker.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<SocketCustomSticker>
A task that represents the asynchronous creation operation. The task result contains the created sticker.
CreateTextChannelAsync(string, Action<TextChannelProperties>, RequestOptions)
Creates a new text channel in this guild.
public Task<RestTextChannel> CreateTextChannelAsync(string name, Action<TextChannelProperties> func = null, RequestOptions options = null)
Parameters
name
stringThe new name for the text channel.
func
Action<TextChannelProperties>The delegate containing the properties to be applied to the channel upon its creation.
options
RequestOptionsThe 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.
Examples
The following example creates a new text channel under an existing category named Wumpus
with a set topic.
var categories = await guild.GetCategoriesAsync();
var targetCategory = categories.FirstOrDefault(x => x.Name == "wumpus");
if (targetCategory == null) return;
await Context.Guild.CreateTextChannelAsync(name, x =>
{
x.CategoryId = targetCategory.Id;
x.Topic = $"This channel was created at {DateTimeOffset.UtcNow} by {user}.";
});
CreateVoiceChannelAsync(string, Action<VoiceChannelProperties>, RequestOptions)
Creates a new voice channel in this guild.
public Task<RestVoiceChannel> CreateVoiceChannelAsync(string name, Action<VoiceChannelProperties> func = null, RequestOptions options = null)
Parameters
name
stringThe new name for the voice channel.
func
Action<VoiceChannelProperties>The delegate containing the properties to be applied to the channel upon its creation.
options
RequestOptionsThe 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.
DeleteApplicationCommandsAsync(RequestOptions)
Deletes all application commands in the current guild.
public Task DeleteApplicationCommandsAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous delete operation.
DeleteAsync(RequestOptions)
Deletes this object and all its children.
public Task DeleteAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe options to be used when sending the request.
Returns
DeleteEmoteAsync(GuildEmote, RequestOptions)
Deletes an existing GuildEmote from this guild.
public Task DeleteEmoteAsync(GuildEmote emote, RequestOptions options = null)
Parameters
emote
GuildEmoteThe emote to delete.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous removal operation.
DeleteIntegrationAsync(ulong, RequestOptions)
public Task DeleteIntegrationAsync(ulong id, RequestOptions options = null)
Parameters
id
ulongoptions
RequestOptions
Returns
DeleteStickerAsync(SocketCustomSticker, RequestOptions)
Deletes a sticker within this guild.
public Task DeleteStickerAsync(SocketCustomSticker sticker, RequestOptions options = null)
Parameters
sticker
SocketCustomStickerThe sticker to delete.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous removal operation.
DownloadUsersAsync()
Downloads all users for this guild if the current list is incomplete.
public Task DownloadUsersAsync()
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.
GetApplicationCommandAsync(ulong, CacheMode, RequestOptions)
Gets an application command within this guild with the specified id.
public ValueTask<SocketApplicationCommand> GetApplicationCommandAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null)
Parameters
id
ulongThe id of the application command to get.
mode
CacheModeThe CacheMode that determines whether the object should be fetched from cache.
options
RequestOptionsThe options to be used when sending the request.
Returns
- ValueTask<SocketApplicationCommand>
A ValueTask that represents the asynchronous get operation. The task result contains a IApplicationCommand if found, otherwise null.
GetApplicationCommandsAsync(bool, string, RequestOptions)
Gets a collection of slash commands created by the current user in this guild.
public Task<IReadOnlyCollection<SocketApplicationCommand>> GetApplicationCommandsAsync(bool withLocalizations = false, string locale = null, RequestOptions options = null)
Parameters
withLocalizations
boolWhether to include full localization dictionaries in the returned objects, instead of the name localized and description localized fields.
locale
stringThe target locale of the localized name and description fields. Sets
X-Discord-Locale
header, which takes precedence overAccept-Language
.options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<IReadOnlyCollection<SocketApplicationCommand>>
A task that represents the asynchronous get operation. The task result contains a read-only collection of slash commands created by the current user.
GetAuditLogsAsync(int, RequestOptions, ulong?, ulong?, ActionType?, ulong?)
Gets the specified number of audit log entries for this guild.
public IAsyncEnumerable<IReadOnlyCollection<RestAuditLogEntry>> GetAuditLogsAsync(int limit, RequestOptions options = null, ulong? beforeId = null, ulong? userId = null, ActionType? actionType = null, ulong? afterId = null)
Parameters
limit
intThe number of audit log entries to fetch.
options
RequestOptionsThe options to be used when sending the request.
beforeId
ulong?The audit log entry ID to filter entries before.
userId
ulong?The user ID to filter entries for.
actionType
ActionType?The type of actions to filter.
afterId
ulong?The audit log entry ID to filter entries after.
Returns
- IAsyncEnumerable<IReadOnlyCollection<RestAuditLogEntry>>
A task that represents the asynchronous get operation. The task result contains a read-only collection of the requested audit log entries.
GetAutoModRule(ulong)
Gets a single rule configured in a guild from cache. Returns null if the rule was not found.
public SocketAutoModRule GetAutoModRule(ulong id)
Parameters
id
ulong
Returns
GetAutoModRuleAsync(ulong, RequestOptions)
Gets a single rule configured in a guild. Returns null if the rule was not found.
public Task<SocketAutoModRule> GetAutoModRuleAsync(ulong ruleId, RequestOptions options = null)
Parameters
ruleId
ulongoptions
RequestOptions
Returns
- Task<SocketAutoModRule>
A task that represents the asynchronous creation operation. The task result contains a IAutoModRule.
GetAutoModRulesAsync(RequestOptions)
Get a list of all rules currently configured for the guild.
public Task<SocketAutoModRule[]> GetAutoModRulesAsync(RequestOptions options = null)
Parameters
options
RequestOptions
Returns
- Task<SocketAutoModRule[]>
A task that represents the asynchronous creation operation. The task result contains a collection of IAutoModRule.
GetBanAsync(IUser, RequestOptions)
Gets a ban object for a banned user.
public Task<RestBan> GetBanAsync(IUser user, RequestOptions options = null)
Parameters
user
IUserThe banned user.
options
RequestOptionsThe 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
ulongThe snowflake identifier for the banned user.
options
RequestOptionsThe 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(IUser, Direction, int, RequestOptions)
Gets limit
amount of bans from the guild starting at the provided fromUser
ordered by user ID.
public IAsyncEnumerable<IReadOnlyCollection<RestBan>> GetBansAsync(IUser fromUser, Direction dir, int limit = 1000, RequestOptions options = null)
Parameters
fromUser
IUserThe user to start to get bans from.
dir
DirectionThe direction of the bans to be gotten.
limit
intThe number of bans to get.
options
RequestOptionsThe options to be used when sending the request.
Returns
- IAsyncEnumerable<IReadOnlyCollection<RestBan>>
A paged collection of bans.
Remarks
important
The returned collection is an asynchronous enumerable object; one must call FlattenAsync<T>(IAsyncEnumerable<IEnumerable<T>>) to access the individual messages as a collection.
warning
Do not fetch too many bans at once! This may cause unwanted preemptive rate limit or even actual rate limit, causing your bot to freeze!
GetBansAsync(int, RequestOptions)
Gets limit
amount of bans from the guild ordered by user ID.
public IAsyncEnumerable<IReadOnlyCollection<RestBan>> GetBansAsync(int limit = 1000, RequestOptions options = null)
Parameters
limit
intThe amount of bans to get from the guild.
options
RequestOptionsThe options to be used when sending the request.
Returns
- IAsyncEnumerable<IReadOnlyCollection<RestBan>>
A paged collection of bans.
Remarks
important
The returned collection is an asynchronous enumerable object; one must call FlattenAsync<T>(IAsyncEnumerable<IEnumerable<T>>) to access the individual messages as a collection.
warning
Do not fetch too many bans at once! This may cause unwanted preemptive rate limit or even actual rate limit, causing your bot to freeze!
GetBansAsync(ulong, Direction, int, RequestOptions)
Gets limit
amount of bans from the guild starting at the provided fromUserId
ordered by user ID.
public IAsyncEnumerable<IReadOnlyCollection<RestBan>> GetBansAsync(ulong fromUserId, Direction dir, int limit = 1000, RequestOptions options = null)
Parameters
fromUserId
ulongThe ID of the user to start to get bans from.
dir
DirectionThe direction of the bans to be gotten.
limit
intThe number of bans to get.
options
RequestOptionsThe options to be used when sending the request.
Returns
- IAsyncEnumerable<IReadOnlyCollection<RestBan>>
A paged collection of bans.
Remarks
important
The returned collection is an asynchronous enumerable object; one must call FlattenAsync<T>(IAsyncEnumerable<IEnumerable<T>>) to access the individual messages as a collection.
warning
Do not fetch too many bans at once! This may cause unwanted preemptive rate limit or even actual rate limit, causing your bot to freeze!
GetCachedAuditLog(ulong)
Gets cached audit log entry with the provided id.
public SocketAuditLogEntry GetCachedAuditLog(ulong id)
Parameters
id
ulong
Returns
Remarks
Returns null if no entry with provided id was found in cache.
GetCachedAuditLogs(int, ActionType?, ulong?, Direction)
Gets audit log entries with the specified type from cache.
public IReadOnlyCollection<SocketAuditLogEntry> GetCachedAuditLogs(int limit = 100, ActionType? action = null, ulong? fromEntryId = null, Direction direction = Direction.Before)
Parameters
limit
intaction
ActionType?fromEntryId
ulong?direction
Direction
Returns
GetCategoryChannel(ulong)
Gets a category channel in this guild.
public SocketCategoryChannel GetCategoryChannel(ulong id)
Parameters
id
ulongThe 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
ulongThe snowflake identifier for the channel.
Returns
- SocketGuildChannel
A generic channel associated with the specified
id
; null if none is found.
GetEmoteAsync(ulong, RequestOptions)
Gets a specific emote from this guild.
public Task<GuildEmote> GetEmoteAsync(ulong id, RequestOptions options = null)
Parameters
id
ulongThe snowflake identifier for the guild emote.
options
RequestOptionsThe 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
RequestOptionsThe 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.
GetEvent(ulong)
Gets an event in this guild.
public SocketGuildEvent GetEvent(ulong id)
Parameters
id
ulongThe snowflake identifier for the event.
Returns
- SocketGuildEvent
An event that is associated with the specified
id
; null if none is found.
GetEventAsync(ulong, RequestOptions)
Gets an event within this guild.
public Task<RestGuildEvent> GetEventAsync(ulong id, RequestOptions options = null)
Parameters
id
ulongThe snowflake identifier for the event.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<RestGuildEvent>
A task that represents the asynchronous get operation.
GetEventsAsync(RequestOptions)
Gets all active events within this guild.
public Task<IReadOnlyCollection<RestGuildEvent>> GetEventsAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<IReadOnlyCollection<RestGuildEvent>>
A task that represents the asynchronous get operation.
GetForumChannel(ulong)
Gets a forum channel in this guild.
public SocketForumChannel GetForumChannel(ulong id)
Parameters
id
ulongThe snowflake identifier for the forum channel.
Returns
- SocketForumChannel
A forum channel associated with the specified
id
; null if none is found.
GetIntegrationsAsync(RequestOptions)
public Task<IReadOnlyCollection<RestIntegration>> GetIntegrationsAsync(RequestOptions options = null)
Parameters
options
RequestOptions
Returns
GetInvitesAsync(RequestOptions)
Gets a collection of all invites in this guild.
public Task<IReadOnlyCollection<RestInviteMetadata>> GetInvitesAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<IReadOnlyCollection<RestInviteMetadata>>
A task that represents the asynchronous get operation. The task result contains a read-only collection of invite metadata, each representing information for an invite found within this guild.
GetMediaChannel(ulong)
Gets a media channel in this guild.
public SocketMediaChannel GetMediaChannel(ulong id)
Parameters
id
ulongThe snowflake identifier for the stage channel.
Returns
- SocketMediaChannel
A stage channel associated with the specified
id
; null if none is found.
GetOnboardingAsync(RequestOptions)
Gets the onboarding object configured for the guild.
public Task<SocketGuildOnboarding> GetOnboardingAsync(RequestOptions options = null)
Parameters
options
RequestOptions
Returns
- Task<SocketGuildOnboarding>
A task that represents the asynchronous creation operation. The task result contains the created IGuildOnboarding.
GetRole(ulong)
Gets a role in this guild.
public SocketRole GetRole(ulong id)
Parameters
id
ulongThe snowflake identifier for the role.
Returns
- SocketRole
A role that is associated with the specified
id
; null if none is found.
GetRoleAsync(ulong, RequestOptions)
Gets a role in this guild.
public Task<RestRole> GetRoleAsync(ulong id, RequestOptions options = null)
Parameters
id
ulongThe snowflake identifier for the role.
options
RequestOptions
Returns
GetStageChannel(ulong)
Gets a stage channel in this guild.
public SocketStageChannel GetStageChannel(ulong id)
Parameters
id
ulongThe snowflake identifier for the stage channel.
Returns
- SocketStageChannel
A stage channel associated with the specified
id
; null if none is found.
GetSticker(ulong)
Gets a specific sticker within this guild.
public SocketCustomSticker GetSticker(ulong id)
Parameters
id
ulongThe id of the sticker to get.
Returns
- SocketCustomSticker
A sticker, if none is found then null.
GetStickerAsync(ulong, CacheMode, RequestOptions)
Gets a specific sticker within this guild.
public ValueTask<SocketCustomSticker> GetStickerAsync(ulong id, CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null)
Parameters
id
ulongThe id of the sticker to get.
mode
CacheModeThe CacheMode that determines whether the object should be fetched from cache.
options
RequestOptionsThe options to be used when sending the request.
Returns
- ValueTask<SocketCustomSticker>
A task that represents the asynchronous get operation. The task result contains the sticker found with the specified
id
; null if none is found.
GetStickersAsync(CacheMode, RequestOptions)
Gets a collection of all stickers within this guild.
public ValueTask<IReadOnlyCollection<SocketCustomSticker>> GetStickersAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null)
Parameters
mode
CacheModeThe CacheMode that determines whether the object should be fetched from cache.
options
RequestOptionsThe options to be used when sending the request.
Returns
- ValueTask<IReadOnlyCollection<SocketCustomSticker>>
A task that represents the asynchronous get operation. The task result contains a read-only collection of stickers found within the guild.
GetTextChannel(ulong)
Gets a text channel in this guild.
public SocketTextChannel GetTextChannel(ulong id)
Parameters
id
ulongThe snowflake identifier for the text channel.
Returns
- SocketTextChannel
A text channel associated with the specified
id
; null if none is found.
GetThreadChannel(ulong)
Gets a thread in this guild.
public SocketThreadChannel GetThreadChannel(ulong id)
Parameters
id
ulongThe snowflake identifier for the thread.
Returns
- SocketThreadChannel
A thread 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
ulongThe snowflake 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
RequestOptionsThe 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.
GetVanityInviteAsync(RequestOptions)
Gets the vanity invite URL of this guild.
public Task<RestInviteMetadata> GetVanityInviteAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<RestInviteMetadata>
A task that represents the asynchronous get operation. The task result contains the partial metadata of the vanity invite found within this guild; null if none is found.
GetVoiceChannel(ulong)
Gets a voice channel in this guild.
public SocketVoiceChannel GetVoiceChannel(ulong id)
Parameters
id
ulongThe snowflake identifier for the voice channel.
Returns
- SocketVoiceChannel
A voice channel associated with the specified
id
; null if none is found.
GetVoiceRegionsAsync(RequestOptions)
Gets a collection of all the voice regions this guild can access.
public Task<IReadOnlyCollection<RestVoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<IReadOnlyCollection<RestVoiceRegion>>
A task that represents the asynchronous get operation. The task result contains a read-only collection of voice regions the guild can access.
GetWebhookAsync(ulong, RequestOptions)
Gets a webhook found within this guild.
public Task<RestWebhook> GetWebhookAsync(ulong id, RequestOptions options = null)
Parameters
id
ulongThe identifier for the webhook.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<RestWebhook>
A task that represents the asynchronous get operation. The task result contains the webhook with the specified
id
; null if none is found.
GetWebhooksAsync(RequestOptions)
Gets a collection of all webhook from this guild.
public Task<IReadOnlyCollection<RestWebhook>> GetWebhooksAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<IReadOnlyCollection<RestWebhook>>
A task that represents the asynchronous get operation. The task result contains a read-only collection of webhooks found within the guild.
GetWelcomeScreenAsync(RequestOptions)
Gets the welcome screen of the guild. Returns null if the welcome channel is not set.
public Task<WelcomeScreen> GetWelcomeScreenAsync(RequestOptions options = null)
Parameters
options
RequestOptions
Returns
- Task<WelcomeScreen>
A task that represents the asynchronous creation operation. The task result contains a WelcomeScreen.
LeaveAsync(RequestOptions)
Leaves this guild.
public Task LeaveAsync(RequestOptions options = null)
Parameters
options
RequestOptionsThe 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.
ModifyAsync(Action<GuildProperties>, RequestOptions)
Modifies this guild.
public Task ModifyAsync(Action<GuildProperties> func, RequestOptions options = null)
Parameters
func
Action<GuildProperties>The delegate containing the properties to modify the guild with.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous modification operation.
Exceptions
- ArgumentNullException
func
is null.
ModifyEmoteAsync(GuildEmote, Action<EmoteProperties>, RequestOptions)
Modifies an existing GuildEmote in this guild.
public Task<GuildEmote> ModifyEmoteAsync(GuildEmote emote, Action<EmoteProperties> func, RequestOptions options = null)
Parameters
emote
GuildEmoteThe emote to be modified.
func
Action<EmoteProperties>The delegate containing the properties to modify the emote with.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<GuildEmote>
A task that represents the asynchronous modification operation. The task result contains the modified emote.
Exceptions
- ArgumentNullException
func
is null.
ModifyIncidentActionsAsync(Action<GuildIncidentsDataProperties>, RequestOptions)
Modifies the incident actions of the guild.
public Task<GuildIncidentsData> ModifyIncidentActionsAsync(Action<GuildIncidentsDataProperties> props, RequestOptions options = null)
Parameters
props
Action<GuildIncidentsDataProperties>options
RequestOptions
Returns
- Task<GuildIncidentsData>
A task that represents the asynchronous creation operation. The task result contains the modified IncidentsData.
ModifyOnboardingAsync(Action<GuildOnboardingProperties>, RequestOptions)
Modifies the onboarding object configured for the guild.
public Task<SocketGuildOnboarding> ModifyOnboardingAsync(Action<GuildOnboardingProperties> props, RequestOptions options = null)
Parameters
props
Action<GuildOnboardingProperties>options
RequestOptions
Returns
- Task<SocketGuildOnboarding>
A task that represents the asynchronous creation operation. The task result contains the modified IGuildOnboarding.
ModifyWelcomeScreenAsync(bool, WelcomeScreenChannelProperties[], string, RequestOptions)
Modifies the welcome screen of the guild. Returns null if welcome screen is removed.
public Task<WelcomeScreen> ModifyWelcomeScreenAsync(bool enabled, WelcomeScreenChannelProperties[] channels, string description = null, RequestOptions options = null)
Parameters
enabled
boolchannels
WelcomeScreenChannelProperties[]description
stringoptions
RequestOptions
Returns
- Task<WelcomeScreen>
A task that represents the asynchronous creation operation. The task result contains a WelcomeScreen.
ModifyWidgetAsync(Action<GuildWidgetProperties>, RequestOptions)
Modifies this guild's widget.
public Task ModifyWidgetAsync(Action<GuildWidgetProperties> func, RequestOptions options = null)
Parameters
func
Action<GuildWidgetProperties>The delegate containing the properties to modify the guild widget with.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous modification operation.
Exceptions
- ArgumentNullException
func
is null.
MoveAsync(IGuildUser, IVoiceChannel)
Moves the user to the voice channel.
public Task MoveAsync(IGuildUser user, IVoiceChannel targetChannel)
Parameters
user
IGuildUserThe user to move.
targetChannel
IVoiceChannelthe channel where the user gets moved to.
Returns
- Task
A task that represents the asynchronous operation for moving a user.
PruneUsersAsync(int, bool, RequestOptions, IEnumerable<ulong>)
Prunes inactive users.
public Task<int> PruneUsersAsync(int days = 30, bool simulate = false, RequestOptions options = null, IEnumerable<ulong> includeRoleIds = null)
Parameters
days
intThe number of days required for the users to be kicked.
simulate
boolWhether this prune action is a simulation.
options
RequestOptionsThe options to be used when sending the request.
includeRoleIds
IEnumerable<ulong>An array of role IDs to be included in the prune of users who do not have any additional roles.
Returns
- Task<int>
A task that represents the asynchronous prune operation. The task result contains the number of users to be or has been removed from this guild.
Remarks
This method removes all users that have not logged on in the provided number of days
.
If simulate
is true, this method will only return the number of users that
would be removed without kicking the users.
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
IUserThe user to be unbanned.
options
RequestOptionsThe 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
ulongThe snowflake identifier of the user to be unbanned.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous removal operation for the ban.
ReorderChannelsAsync(IEnumerable<ReorderChannelProperties>, RequestOptions)
Bulk-modifies the order of channels in this guild.
public Task ReorderChannelsAsync(IEnumerable<ReorderChannelProperties> args, RequestOptions options = null)
Parameters
args
IEnumerable<ReorderChannelProperties>The properties used to modify the channel positions with.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous reorder operation.
ReorderRolesAsync(IEnumerable<ReorderRoleProperties>, RequestOptions)
Bulk-modifies the order of roles in this guild.
public Task ReorderRolesAsync(IEnumerable<ReorderRoleProperties> args, RequestOptions options = null)
Parameters
args
IEnumerable<ReorderRoleProperties>The properties used to modify the role positions with.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task
A task that represents the asynchronous reorder operation.
SearchUsersAsync(string, int, RequestOptions)
Gets a collection of users in this guild that the name or nickname starts with the
provided string at query
.
public Task<IReadOnlyCollection<RestGuildUser>> SearchUsersAsync(string query, int limit = 1000, RequestOptions options = null)
Parameters
query
stringThe partial name or nickname to search.
limit
intThe maximum number of users to be gotten.
options
RequestOptionsThe options to be used when sending the request.
Returns
- Task<IReadOnlyCollection<RestGuildUser>>
A task that represents the asynchronous get operation. The task result contains a collection of guild users that the name or nickname starts with the provided string at
query
.
Remarks
The limit
can not be higher than MaxUsersPerBatch.
SearchUsersAsyncV2(int, MemberSearchPropertiesV2, RequestOptions)
Gets a collection of users in this guild that match the provided search criteria.
public Task<MemberSearchResult> SearchUsersAsyncV2(int limit = 1000, MemberSearchPropertiesV2 args = null, RequestOptions options = null)
Parameters
limit
intargs
MemberSearchPropertiesV2options
RequestOptions
Returns
ToString()
Gets the name of the guild.
public override string ToString()