Table of Contents

Class RestGuild

Namespace
Discord.Rest
Assembly
Discord.Net.Rest.dll

Represents a REST-based guild/server.

public class RestGuild : RestEntity<ulong>, IGuild, IDeletable, ISnowflakeEntity, IEntity<ulong>, IUpdateable
Inheritance
RestGuild
Implements
Inherited Members
Extension Methods

Properties

AFKChannelId

Gets the ID of the AFK voice channel for this guild.

public ulong? AFKChannelId { get; }

Property Value

ulong?

A ulong representing the snowflake identifier of the AFK voice channel; 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.

ApproximateMemberCount

Gets the approximate number of members in this guild.

public int? ApproximateMemberCount { get; }

Property Value

int?

The approximate number of members in this guild.

Remarks

Only available when getting a guild via REST when with_counts is true.

ApproximatePresenceCount

Gets the approximate number of non-offline members in this guild.

public int? ApproximatePresenceCount { get; }

Property Value

int?

The approximate number of non-offline members in this guild.

Remarks

Only available when getting a guild via REST when with_counts is true.

BannerId

Gets the identifier for this guilds banner image.

public string BannerId { get; }

Property Value

string

An identifier for the banner image; null if none is set.

BannerUrl

Gets the URL of this guild's banner image.

public string BannerUrl { get; }

Property Value

string

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

CreatedAt

Gets when the snowflake was created.

public DateTimeOffset CreatedAt { get; }

Property Value

DateTimeOffset

A DateTimeOffset representing when the entity was first created.

DefaultMessageNotifications

Gets the default message notifications for users who haven't explicitly set their notification settings.

public DefaultMessageNotifications DefaultMessageNotifications { get; }

Property Value

DefaultMessageNotifications

Description

Gets the description for the guild.

public string Description { get; }

Property Value

string

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

DiscoverySplashId

Gets the ID of this guild's discovery splash image.

public string DiscoverySplashId { get; }

Property Value

string

An identifier for the discovery splash image; null if none is set.

DiscoverySplashUrl

Gets the URL of this guild's discovery splash image.

public string DiscoverySplashUrl { get; }

Property Value

string

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

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.

EveryoneRole

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

public RestRole EveryoneRole { get; }

Property Value

RestRole

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.

IconId

Gets the ID of this guild's icon.

public string IconId { get; }

Property Value

string

An identifier for the splash image; null if none is set.

IconUrl

Gets the URL of this guild's icon.

public string IconUrl { get; }

Property Value

string

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

IncidentsData

Gets the incidents data for this guild.

public GuildIncidentsData IncidentsData { get; }

Property Value

GuildIncidentsData

InventorySettings

Get the inventory settings on the guild. null if not available in the guild.

public GuildInventorySettings? InventorySettings { get; }

Property Value

GuildInventorySettings?

IsBoostProgressBarEnabled

Gets whether the guild has the boost progress bar enabled.

public bool IsBoostProgressBarEnabled { get; }

Property Value

bool

true if the boost progress bar is enabled; otherwise false.

IsWidgetEnabled

Gets a value that indicates whether this guild has the widget enabled.

public bool IsWidgetEnabled { get; }

Property Value

bool

true if this guild has a widget enabled; otherwise false.

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 Discord in this guild.

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

ulong

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.

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.

OwnerId

Gets the ID of the user that owns this guild.

public ulong OwnerId { get; }

Property Value

ulong

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

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.

PublicUpdatesChannelId

Gets the ID of the channel where admins and moderators of Community guilds receive notices from Discord.

public ulong? PublicUpdatesChannelId { get; }

Property Value

ulong?

A ulong representing the snowflake identifier of the 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<RestRole> Roles { get; }

Property Value

IReadOnlyCollection<RestRole>

RulesChannelId

Gets the ID of the channel with the rules.

public ulong? RulesChannelId { get; }

Property Value

ulong?

A ulong representing the snowflake identifier of the channel that contains the rules; null if none is set.

SafetyAlertsChannelId

Gets the ID of the channel assigned to the safety alerts channel of this guild.

public ulong? SafetyAlertsChannelId { get; }

Property Value

ulong?

A ulong representing the snowflake identifier of the safety alerts channel; null if none is set.

SplashId

Gets the ID of this guild's splash image.

public string SplashId { get; }

Property Value

string

An identifier for the splash image; null if none is set.

SplashUrl

Gets the URL of this guild's splash image.

public string SplashUrl { get; }

Property Value

string

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

Stickers

public IReadOnlyCollection<CustomSticker> Stickers { get; }

Property Value

IReadOnlyCollection<CustomSticker>

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.

SystemChannelId

Gets the ID of the channel where randomized welcome messages are sent.

public ulong? SystemChannelId { get; }

Property Value

ulong?

A ulong representing the snowflake identifier of the system channel where randomized welcome messages are sent; null if none is set.

VanityURLCode

Gets the code for this guild's vanity invite URL.

public string VanityURLCode { get; }

Property Value

string

A string containing the vanity invite code for this guild; null if none is set.

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.

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

WidgetChannelId

Gets the ID of the channel assigned to the widget of this guild.

public ulong? WidgetChannelId { get; }

Property Value

ulong?

A ulong representing the snowflake identifier of the channel assigned to the widget found within the widget settings of this guild; 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 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 snowflake ID 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.

AddGuildUserAsync(ulong, string, Action<AddGuildUserProperties>, RequestOptions)

public Task<RestGuildUser> AddGuildUserAsync(ulong id, string accessToken, Action<AddGuildUserProperties> func = null, RequestOptions options = null)

Parameters

id ulong
accessToken string
func Action<AddGuildUserProperties>
options RequestOptions

Returns

Task<RestGuildUser>

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 IUser

The user to ban.

pruneSeconds uint

The number of seconds to remover messages from this user for, between 0 and 604800

options RequestOptions

The 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 ulong

The ID of the user to ban.

pruneSeconds uint

The number of seconds to remover messages from this user for, between 0 and 604800

options RequestOptions

The 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 RequestOptions

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

BulkOverwriteApplicationCommandsAsync(ApplicationCommandProperties[], RequestOptions)

Overwrites the application commands within this guild.

public Task<IReadOnlyCollection<RestGuildCommand>> BulkOverwriteApplicationCommandsAsync(ApplicationCommandProperties[] properties, RequestOptions options = null)

Parameters

properties ApplicationCommandProperties[]

A collection of properties to use when creating the commands.

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<RestGuildCommand>>

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<RestGuildCommand> CreateApplicationCommandAsync(ApplicationCommandProperties properties, RequestOptions options = null)

Parameters

properties ApplicationCommandProperties

The properties to use when creating the command.

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestGuildCommand>

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<RestAutoModRule> CreateAutoModRuleAsync(Action<AutoModRuleProperties> props, RequestOptions options = null)

Parameters

props Action<AutoModRuleProperties>
options RequestOptions

Returns

Task<RestAutoModRule>

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

CreateCategoryChannelAsync(string, Action<GuildChannelProperties>, RequestOptions)

Creates a category channel with the provided name.

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

Parameters

name string

The name of the new channel.

func Action<GuildChannelProperties>

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>

The 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 string

The name of the guild emote.

image Image

The image of the new emote.

roles Optional<IEnumerable<IRole>>

The roles to limit the emote usage to.

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.

CreateEventAsync(string, DateTimeOffset, GuildScheduledEventType, GuildScheduledEventPrivacyLevel, string, DateTimeOffset?, ulong?, string, Image?, RequestOptions)

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)

Parameters

name string

The name of the event.

startTime DateTimeOffset

The start time of the event.

type GuildScheduledEventType

The type of the event.

privacyLevel GuildScheduledEventPrivacyLevel

The privacy level of the event.

description string

The 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 string

The location of the event; links are supported

coverImage Image?

The optional banner image for the event.

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestGuildEvent>

A task that represents the asynchronous create operation.

CreateForumChannelAsync(string, Action<ForumChannelProperties>, RequestOptions)

Creates a new forum channel with the provided name.

public Task<RestForumChannel> CreateForumChannelAsync(string name, Action<ForumChannelProperties> func = null, RequestOptions options = null)

Parameters

name string

The name of the new channel.

func Action<ForumChannelProperties>

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<RestForumChannel>

The 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 string

The new name for the media channel.

func Action<ForumChannelProperties>

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<RestMediaChannel>

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

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 string

The new name for the announcement channel.

func Action<TextChannelProperties>

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<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 string

The new name for the role.

permissions GuildPermissions?

The guild permission that the role should possess.

color Color?

The color of the role.

isHoisted bool

Whether the role is separated from others on the sidebar.

isMentionable bool

Whether the role can be mentioned.

options RequestOptions

The options to be used when sending the request.

icon Image?

The icon for the role.

emoji Emoji

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

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 string

The new name for the stage channel.

func Action<VoiceChannelProperties>

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<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<CustomSticker> CreateStickerAsync(string name, Image image, IEnumerable<string> tags, string description = null, RequestOptions options = null)

Parameters

name string

The name of the sticker.

image Image

The image of the new emote.

tags IEnumerable<string>

The tags of the sticker.

description string

The description of the sticker.

options RequestOptions

The options to be used when sending the request.

Returns

Task<CustomSticker>

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<CustomSticker> CreateStickerAsync(string name, Stream stream, string filename, IEnumerable<string> tags, string description = null, RequestOptions options = null)

Parameters

name string

The name of the sticker.

stream Stream

The stream containing the file data.

filename string

The name of the file with the extension, ex: image.png.

tags IEnumerable<string>

The tags of the sticker.

description string

The description of the sticker.

options RequestOptions

The options to be used when sending the request.

Returns

Task<CustomSticker>

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<CustomSticker> CreateStickerAsync(string name, string path, IEnumerable<string> tags, string description = null, RequestOptions options = null)

Parameters

name string

The name of the sticker.

path string

The path of the file to upload.

tags IEnumerable<string>

The tags of the sticker.

description string

The description of the sticker.

options RequestOptions

The options to be used when sending the request.

Returns

Task<CustomSticker>

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 string

The new name for the text channel.

func Action<TextChannelProperties>

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.

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 voice channel with the provided name.

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

Parameters

name string

The name of the new channel.

func Action<VoiceChannelProperties>

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>

The created voice channel.

Exceptions

ArgumentNullException

name is null.

DeleteAsync(RequestOptions)

Deletes this object and all its children.

public Task DeleteAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

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.

DeleteIntegrationAsync(ulong, RequestOptions)

public Task DeleteIntegrationAsync(ulong id, RequestOptions options = null)

Parameters

id ulong
options RequestOptions

Returns

Task

DeleteSlashCommandsAsync(RequestOptions)

Deletes all slash commands in the current guild.

public Task DeleteSlashCommandsAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous delete operation.

DeleteStickerAsync(CustomSticker, RequestOptions)

Deletes a sticker within this guild.

public Task DeleteStickerAsync(CustomSticker sticker, RequestOptions options = null)

Parameters

sticker CustomSticker

The sticker to delete.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous removal operation.

GetAFKChannelAsync(RequestOptions)

Gets the AFK voice channel in this guild.

public Task<RestVoiceChannel> GetAFKChannelAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestVoiceChannel>

A task that represents the asynchronous get operation. The task result contains the voice channel that the AFK users will be moved to after they have idled for too long; null if none is set.

GetApplicationCommandAsync(ulong, RequestOptions)

Gets an application command within this guild with the specified id.

public Task<RestGuildCommand> GetApplicationCommandAsync(ulong id, RequestOptions options = null)

Parameters

id ulong

The id of the application command to get.

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestGuildCommand>

A ValueTask that represents the asynchronous get operation. The task result contains a IApplicationCommand if found, otherwise null.

GetApplicationCommandsAsync(bool, string, RequestOptions)

Gets this guilds slash commands

public Task<IReadOnlyCollection<RestGuildCommand>> GetApplicationCommandsAsync(bool withLocalizations = false, string locale = null, RequestOptions options = null)

Parameters

withLocalizations bool

Whether to include full localization dictionaries in the returned objects, instead of the name localized and description localized fields.

locale string

The target locale of the localized name and description fields. Sets X-Discord-Locale header, which takes precedence over Accept-Language.

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<RestGuildCommand>>

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

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 int

The number of audit log entries to fetch.

options RequestOptions

The options to be used when sending the request.

beforeId ulong?

The audit log entry ID to get 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 get 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.

GetAutoModRuleAsync(ulong, RequestOptions)

Gets a single rule configured in a guild. Returns null if the rule was not found.

public Task<RestAutoModRule> GetAutoModRuleAsync(ulong ruleId, RequestOptions options = null)

Parameters

ruleId ulong
options RequestOptions

Returns

Task<RestAutoModRule>

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<RestAutoModRule[]> GetAutoModRulesAsync(RequestOptions options = null)

Parameters

options RequestOptions

Returns

Task<RestAutoModRule[]>

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 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 snowflake 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(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 IUser

The user to start to get bans from.

dir Direction

The direction of the bans to be gotten.

limit int

The number of bans to get.

options RequestOptions

The 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 int

The amount of bans to get from the guild.

options RequestOptions

The 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 ulong

The ID of the user to start to get bans from.

dir Direction

The direction of the bans to be gotten.

limit int

The number of bans to get.

options RequestOptions

The 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!

GetCategoryChannelsAsync(RequestOptions)

Gets a collection of all category channels in this guild.

public Task<IReadOnlyCollection<RestCategoryChannel>> GetCategoryChannelsAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<RestCategoryChannel>>

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

GetChannelAsync(ulong, RequestOptions)

Gets a channel in this guild.

public Task<RestGuildChannel> GetChannelAsync(ulong id, RequestOptions options = null)

Parameters

id ulong

The snowflake identifier for the channel.

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestGuildChannel>

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

GetChannelsAsync(RequestOptions)

Gets a collection of all channels in this guild.

public Task<IReadOnlyCollection<RestGuildChannel>> GetChannelsAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<RestGuildChannel>>

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

GetCurrentUserAsync(RequestOptions)

Gets the current user for this guild.

public Task<RestGuildUser> GetCurrentUserAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestGuildUser>

A task that represents the asynchronous get operation. The task result contains the currently logged-in user within this guild.

GetDefaultChannelAsync(RequestOptions)

Gets the first viewable text channel in this guild.

public Task<RestTextChannel> GetDefaultChannelAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestTextChannel>

A task that represents the asynchronous get operation. The task result contains the first viewable text channel in this guild; 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 ulong

The snowflake 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.

GetEventAsync(ulong, RequestOptions)

Gets an event within this guild.

public Task<RestGuildEvent> GetEventAsync(ulong id, RequestOptions options = null)

Parameters

id ulong

The snowflake identifier for the event.

options RequestOptions

The 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 RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<RestGuildEvent>>

A task that represents the asynchronous get operation.

GetForumChannelAsync(ulong, RequestOptions)

Gets a forum channel in this guild.

public Task<RestForumChannel> GetForumChannelAsync(ulong id, RequestOptions options = null)

Parameters

id ulong

The snowflake identifier for the forum channel.

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestForumChannel>

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

GetForumChannelsAsync(RequestOptions)

Gets a collection of all forum channels in this guild.

public Task<IReadOnlyCollection<RestForumChannel>> GetForumChannelsAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<RestForumChannel>>

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

GetIntegrationsAsync(RequestOptions)

public Task<IReadOnlyCollection<RestIntegration>> GetIntegrationsAsync(RequestOptions options = null)

Parameters

options RequestOptions

Returns

Task<IReadOnlyCollection<RestIntegration>>

GetInvitesAsync(RequestOptions)

Gets a collection of all invites in this guild.

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

Parameters

options RequestOptions

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

GetMediaChannelAsync(ulong, RequestOptions)

Gets a media channel in this guild.

public Task<RestMediaChannel> GetMediaChannelAsync(ulong id, RequestOptions options = null)

Parameters

id ulong

The snowflake identifier for the text channel.

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestMediaChannel>

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

GetMediaChannelsAsync(RequestOptions)

Gets a collection of all media channels in this guild.

public Task<IReadOnlyCollection<RestMediaChannel>> GetMediaChannelsAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<RestMediaChannel>>

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

GetOnboardingAsync(RequestOptions)

Gets the onboarding object configured for the guild.

public Task<RestGuildOnboarding> GetOnboardingAsync(RequestOptions options = null)

Parameters

options RequestOptions

Returns

Task<RestGuildOnboarding>

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

GetOwnerAsync(RequestOptions)

Gets the owner of this guild.

public Task<RestGuildUser> GetOwnerAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestGuildUser>

A task that represents the asynchronous get operation. The task result contains the owner of this guild.

GetPublicUpdatesChannelAsync(RequestOptions)

Gets the text channel where admins and moderators of Community guilds receive notices from Discord.

public Task<RestTextChannel> GetPublicUpdatesChannelAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestTextChannel>

A task that represents the asynchronous get operation. The task result contains the text channel where admins and moderators of Community guilds receive notices from Discord; null if none is set.

GetRole(ulong)

Gets a role in this guild.

public RestRole GetRole(ulong id)

Parameters

id ulong

The snowflake identifier for the role.

Returns

RestRole

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

GetRulesChannelAsync(RequestOptions)

Gets the text channel where Community guilds can display rules and/or guidelines.

public Task<RestTextChannel> GetRulesChannelAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestTextChannel>

A task that represents the asynchronous get operation. The task result contains the text channel where Community guilds can display rules and/or guidelines; null if none is set.

GetSlashCommandAsync(ulong, RequestOptions)

Gets a slash command in the current guild.

public Task<RestGuildCommand> GetSlashCommandAsync(ulong id, RequestOptions options = null)

Parameters

id ulong

The unique identifier of the slash command.

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestGuildCommand>

A task that represents the asynchronous get operation. The task result contains a slash command created by the current user.

GetSlashCommandsAsync(bool, string, RequestOptions)

Gets a collection of slash commands created by the current user in this guild.

public Task<IReadOnlyCollection<RestGuildCommand>> GetSlashCommandsAsync(bool withLocalizations = false, string locale = null, RequestOptions options = null)

Parameters

withLocalizations bool

Whether to include full localization dictionaries in the returned objects, instead of the name localized and description localized fields.

locale string

The target locale of the localized name and description fields. Sets X-Discord-Locale header, which takes precedence over Accept-Language.

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<RestGuildCommand>>

A task that represents the asynchronous get operation. The task result contains a read-only collection of slash commands created by the current user.

GetStageChannelAsync(ulong, RequestOptions)

Gets a stage channel in this guild

public Task<RestStageChannel> GetStageChannelAsync(ulong id, RequestOptions options = null)

Parameters

id ulong

The snowflake identifier for the stage channel.

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestStageChannel>

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

GetStageChannelsAsync(RequestOptions)

Gets a collection of all stage channels in this guild.

public Task<IReadOnlyCollection<RestStageChannel>> GetStageChannelsAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<RestStageChannel>>

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

GetStickerAsync(ulong, RequestOptions)

Gets a specific sticker within this guild.

public Task<CustomSticker> GetStickerAsync(ulong id, RequestOptions options = null)

Parameters

id ulong

The id of the sticker to get.

options RequestOptions

The options to be used when sending the request.

Returns

Task<CustomSticker>

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(RequestOptions)

Gets a collection of all stickers within this guild.

public Task<IReadOnlyCollection<CustomSticker>> GetStickersAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<CustomSticker>>

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

GetSystemChannelAsync(RequestOptions)

Gets the text channel where guild notices such as welcome messages and boost events are posted.

public Task<RestTextChannel> GetSystemChannelAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestTextChannel>

A task that represents the asynchronous get operation. The task result contains the text channel where guild notices such as welcome messages and boost events are post; null if none is found.

GetTextChannelAsync(ulong, RequestOptions)

Gets a text channel in this guild.

public Task<RestTextChannel> GetTextChannelAsync(ulong id, RequestOptions options = null)

Parameters

id ulong

The snowflake identifier for the text channel.

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestTextChannel>

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

GetTextChannelsAsync(RequestOptions)

Gets a collection of all text channels in this guild.

public Task<IReadOnlyCollection<RestTextChannel>> GetTextChannelsAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<RestTextChannel>>

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

GetThreadChannelAsync(ulong, RequestOptions)

Gets a thread channel in this guild.

public Task<RestThreadChannel> GetThreadChannelAsync(ulong id, RequestOptions options = null)

Parameters

id ulong

The snowflake identifier for the thread channel.

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestThreadChannel>

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

GetThreadChannelsAsync(RequestOptions)

Gets a collection of all thread in this guild.

public Task<IReadOnlyCollection<RestThreadChannel>> GetThreadChannelsAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<RestThreadChannel>>

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

GetUserAsync(ulong, RequestOptions)

Gets a user from this guild.

public Task<RestGuildUser> GetUserAsync(ulong id, RequestOptions options = null)

Parameters

id ulong

The snowflake identifier of the user.

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestGuildUser>

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

Remarks

This method retrieves a user found within this guild.

GetUsersAsync(RequestOptions)

Gets a collection of all users in this guild.

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

Parameters

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 found within this guild.

Remarks

This method retrieves all users found within this guild.

GetVanityInviteAsync(RequestOptions)

Gets the vanity invite URL of this guild.

public Task<RestInviteMetadata> GetVanityInviteAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestInviteMetadata>

A partial metadata of the vanity invite found within this guild.

GetVoiceChannelAsync(ulong, RequestOptions)

Gets a voice channel in this guild.

public Task<RestVoiceChannel> GetVoiceChannelAsync(ulong id, RequestOptions options = null)

Parameters

id ulong

The snowflake identifier for the voice channel.

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestVoiceChannel>

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

GetVoiceChannelsAsync(RequestOptions)

Gets a collection of all voice channels in this guild.

public Task<IReadOnlyCollection<RestVoiceChannel>> GetVoiceChannelsAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<RestVoiceChannel>>

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

GetVoiceRegionsAsync(RequestOptions)

Gets a collection of all the voice regions this guild can access.

public Task<IReadOnlyCollection<RestVoiceRegion>> GetVoiceRegionsAsync(RequestOptions options = null)

Parameters

options RequestOptions

The 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 ulong

The identifier for the webhook.

options RequestOptions

The 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 RequestOptions

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

GetWidgetChannelAsync(RequestOptions)

Gets the widget channel (i.e. the channel set in the guild's widget settings) in this guild.

public Task<RestGuildChannel> GetWidgetChannelAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<RestGuildChannel>

A task that represents the asynchronous get operation. The task result contains the widget channel set within the server's widget settings; null if none is set.

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.

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 RequestOptions

The 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 GuildEmote

The emote to be modified.

func Action<EmoteProperties>

The delegate containing the properties to modify the emote with.

options RequestOptions

The 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<RestGuildOnboarding> ModifyOnboardingAsync(Action<GuildOnboardingProperties> props, RequestOptions options = null)

Parameters

props Action<GuildOnboardingProperties>
options RequestOptions

Returns

Task<RestGuildOnboarding>

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 bool
channels WelcomeScreenChannelProperties[]
description string
options 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 RequestOptions

The 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 IGuildUser

The user to move.

targetChannel IVoiceChannel

the 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 int

The number of days required for the users to be kicked.

simulate bool

Whether this prune action is a simulation.

options RequestOptions

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

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

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 RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous reorder operation.

Exceptions

ArgumentNullException

args is null.

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 RequestOptions

The 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 string

The partial name or nickname to search.

limit int

The maximum number of users to be gotten.

options RequestOptions

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

ToString()

Returns the name of the guild.

public override string ToString()

Returns

string

The name of the guild.

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

UpdateAsync(bool, RequestOptions)

Updates this object's properties with its current state.

public Task UpdateAsync(bool withCounts, RequestOptions options = null)

Parameters

withCounts bool

If true, ApproximateMemberCount and ApproximatePresenceCount will be updated as well.

options RequestOptions

The options to be used when sending the request.

Returns

Task

Remarks

If withCounts is true, ApproximateMemberCount and ApproximatePresenceCount will be updated as well.