Table of Contents

Interface INestedChannel

Namespace
Discord
Assembly
Discord.Net.Core.dll

Represents a type of guild channel that can be nested within a category.

public interface INestedChannel : IGuildChannel, IChannel, ISnowflakeEntity, IEntity<ulong>, IDeletable
Inherited Members
Extension Methods

Properties

CategoryId

Gets the parent (category) ID of this channel in the guild's channel list.

ulong? CategoryId { get; }

Property Value

ulong?

A ulong representing the snowflake identifier of the parent of this channel; null if none is set.

Methods

CreateInviteAsync(int?, int?, bool, bool, RequestOptions)

Creates a new invite to this channel.

Task<IInviteMetadata> CreateInviteAsync(int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null)

Parameters

maxAge int?

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

maxUses int?

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

isTemporary bool

If true, the user accepting this invite will be kicked from the guild after closing their client.

isUnique bool

If true, don't try to reuse a similar invite (useful for creating many unique one time use invites).

options RequestOptions

The options to be used when sending the request.

Returns

Task<IInviteMetadata>

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

Examples

The following example creates a new invite to this channel; the invite lasts for 12 hours and can only be used 3 times throughout its lifespan.

await guildChannel.CreateInviteAsync(maxAge: 43200, maxUses: 3);

CreateInviteToApplicationAsync(DefaultApplications, int?, int?, bool, bool, RequestOptions)

Creates a new invite to this channel.

Task<IInviteMetadata> CreateInviteToApplicationAsync(DefaultApplications application, int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null)

Parameters

application DefaultApplications

The application to open for this invite.

maxAge int?

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

maxUses int?

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

isTemporary bool

If true, the user accepting this invite will be kicked from the guild after closing their client.

isUnique bool

If true, don't try to reuse a similar invite (useful for creating many unique one time use invites).

options RequestOptions

The options to be used when sending the request.

Returns

Task<IInviteMetadata>

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

CreateInviteToApplicationAsync(ulong, int?, int?, bool, bool, RequestOptions)

Creates a new invite to this channel.

Task<IInviteMetadata> CreateInviteToApplicationAsync(ulong applicationId, int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null)

Parameters

applicationId ulong

The id of the embedded application to open for this invite.

maxAge int?

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

maxUses int?

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

isTemporary bool

If true, the user accepting this invite will be kicked from the guild after closing their client.

isUnique bool

If true, don't try to reuse a similar invite (useful for creating many unique one time use invites).

options RequestOptions

The options to be used when sending the request.

Returns

Task<IInviteMetadata>

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

CreateInviteToStreamAsync(IUser, int?, int?, bool, bool, RequestOptions)

Creates a new invite to this channel.

Task<IInviteMetadata> CreateInviteToStreamAsync(IUser user, int? maxAge = 86400, int? maxUses = null, bool isTemporary = false, bool isUnique = false, RequestOptions options = null)

Parameters

user IUser

The id of the user whose stream to display for this invite.

maxAge int?

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

maxUses int?

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

isTemporary bool

If true, the user accepting this invite will be kicked from the guild after closing their client.

isUnique bool

If true, don't try to reuse a similar invite (useful for creating many unique one time use invites).

options RequestOptions

The options to be used when sending the request.

Returns

Task<IInviteMetadata>

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

Examples

The following example creates a new invite to this channel; the invite lasts for 12 hours and can only be used 3 times throughout its lifespan.

await guildChannel.CreateInviteAsync(maxAge: 43200, maxUses: 3);

GetCategoryAsync(CacheMode, RequestOptions)

Gets the parent (category) channel of this channel.

Task<ICategoryChannel> GetCategoryAsync(CacheMode mode = CacheMode.AllowDownload, RequestOptions options = null)

Parameters

mode CacheMode

The CacheMode that determines whether the object should be fetched from cache.

options RequestOptions

The options to be used when sending the request.

Returns

Task<ICategoryChannel>

A task that represents the asynchronous get operation. The task result contains the category channel representing the parent of this channel; null if none is set.

GetInvitesAsync(RequestOptions)

Gets a collection of all invites to this channel.

Task<IReadOnlyCollection<IInviteMetadata>> GetInvitesAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<IInviteMetadata>>

A task that represents the asynchronous get operation. The task result contains a read-only collection of invite metadata that are created for this channel.

Examples

The following example gets all of the invites that have been created in this channel and selects the most used invite.

  var invites = await channel.GetInvitesAsync();
                             if (invites.Count == 0) return;
                             var invite = invites.OrderByDescending(x => x.Uses).FirstOrDefault();

SyncPermissionsAsync(RequestOptions)

Syncs the permissions of this nested channel with its parent's.

Task SyncPermissionsAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous operation for syncing channel permissions with its parent's.