Table of Contents

Class TextGuildChannel

Namespace
NetCord
Assembly
NetCord.dll

Represents a text channel within a guild.

public class TextGuildChannel : TextChannel, IEquatable<Entity>, IJsonModel<JsonChannel>, IInteractionChannel, IGuildChannel, INamedChannel, IEntity, ISpanFormattable, IFormattable
Inheritance
TextGuildChannel
Implements
Derived
Inherited Members

Constructors

TextGuildChannel(JsonChannel, ulong, RestClient)

Represents a text channel within a guild.

public TextGuildChannel(JsonChannel jsonModel, ulong guildId, RestClient client)

Parameters

jsonModel JsonChannel
guildId ulong
client RestClient

Properties

DefaultAutoArchiveDuration

The default duration for which threads within the channel must be inactive, before auto-archiving occurs.

public ThreadArchiveDuration? DefaultAutoArchiveDuration { get; }

Property Value

ThreadArchiveDuration?

DefaultThreadSlowmode

The default slowmode duration for threads within the channel.

public int DefaultThreadSlowmode { get; }

Property Value

int

GuildId

The ID corresponding to the channel's parent guild.

public ulong GuildId { get; }

Property Value

ulong

Name

The name of the channel object, between 1 and 100 characters.

public string Name { get; }

Property Value

string

Nsfw

Whether the channel is age-restricted.

public bool Nsfw { get; }

Property Value

bool

ParentId

The ID of the channel's parent channel.

public ulong? ParentId { get; }

Property Value

ulong?

Remarks

If the channel is a thread, the ID corresponds to the thread's parent channel.

PermissionOverwrites

A list of explicit permission overwrites for specified members and roles.

public IReadOnlyDictionary<ulong, PermissionOverwrite> PermissionOverwrites { get; }

Property Value

IReadOnlyDictionary<ulong, PermissionOverwrite>

Position

The channel's position within the guild channel list.

public int? Position { get; }

Property Value

int?

Remarks

If two or more channels share a position, they are instead sorted by their ID.

Slowmode

The number of seconds a user has to wait before sending another message, between 0 and 21600 (6 hours).

public int Slowmode { get; }

Property Value

int

Remarks

Bots, and users with the BypassSlowmode permission are unaffected.

Topic

The channel topic, between 0 and 1024 characters. Can be null.

public string? Topic { get; }

Property Value

string

Methods

CreateGuildThreadAsync(GuildThreadProperties, RestRequestProperties?, CancellationToken)

Creates a standalone thread in a text channel.

public Task<GuildThread> CreateGuildThreadAsync(GuildThreadProperties threadProperties, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

threadProperties GuildThreadProperties

The properties of the thread to create.

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<GuildThread>

CreateGuildThreadAsync(ulong, GuildThreadFromMessageProperties, RestRequestProperties?, CancellationToken)

Creates a thread from an existing message in a text channel.

public Task<GuildThread> CreateGuildThreadAsync(ulong messageId, GuildThreadFromMessageProperties threadFromMessageProperties, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

messageId ulong

The ID of the message to start the thread from.

threadFromMessageProperties GuildThreadFromMessageProperties

The properties of the thread to create.

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<GuildThread>

CreateInviteAsync(InviteProperties?, RestRequestProperties?, CancellationToken)

Creates a new invite for a guild channel.

public Task<RestInvite> CreateInviteAsync(InviteProperties? inviteProperties = null, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

inviteProperties InviteProperties

The properties to configure the new invite. Can be null for defaults.

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<RestInvite>

CreateWebhookAsync(WebhookProperties, RestRequestProperties?, CancellationToken)

Creates a new webhook, and returns an IncomingWebhook object on success.

public Task<IncomingWebhook> CreateWebhookAsync(WebhookProperties webhookProperties, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

webhookProperties WebhookProperties

Properties to customize the webhook's appearance.

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<IncomingWebhook>

Remarks

Fires a WebhooksUpdate event.

DeleteAsync(RestRequestProperties?, CancellationToken)

Deletes a channel.

public Task<TextGuildChannel> DeleteAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<TextGuildChannel>

DeletePermissionAsync(ulong, RestRequestProperties?, CancellationToken)

Deletes a permission overwrite for a user or role in a guild channel.

public Task DeletePermissionAsync(ulong overwriteId, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

overwriteId ulong

The ID of the role or user whose permission overwrite is to be deleted.

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task

GetAsync(RestRequestProperties?, CancellationToken)

Retrieves a channel by its ID.

public Task<TextGuildChannel> GetAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<TextGuildChannel>

GetChannelWebhooksAsync(RestRequestProperties?, CancellationToken)

Returns a list of channel Webhook objects.

public Task<IReadOnlyList<Webhook>> GetChannelWebhooksAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<IReadOnlyList<Webhook>>

GetInvitesAsync(RestRequestProperties?, CancellationToken)

Retrieves a list of active invites for a guild channel.

public Task<IReadOnlyList<RestInvite>> GetInvitesAsync(RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<IReadOnlyList<RestInvite>>

GetJoinedPrivateArchivedGuildThreadsAsync(PaginationProperties<ulong>?, RestRequestProperties?)

Retrieves private archived threads joined by the current user.

public IAsyncEnumerable<GuildThread> GetJoinedPrivateArchivedGuildThreadsAsync(PaginationProperties<ulong>? paginationProperties = null, RestRequestProperties? properties = null)

Parameters

paginationProperties PaginationProperties<ulong>

Pagination options for archived threads, or null to use defaults.

properties RestRequestProperties

Optional properties to customize each request, can be null.

Returns

IAsyncEnumerable<GuildThread>

GetPrivateArchivedGuildThreadsAsync(PaginationProperties<DateTimeOffset>?, RestRequestProperties?)

Retrieves private archived threads in the channel.

public IAsyncEnumerable<GuildThread> GetPrivateArchivedGuildThreadsAsync(PaginationProperties<DateTimeOffset>? paginationProperties = null, RestRequestProperties? properties = null)

Parameters

paginationProperties PaginationProperties<DateTimeOffset>

Pagination options for archived threads, or null to use defaults.

properties RestRequestProperties

Optional properties to customize each request, can be null.

Returns

IAsyncEnumerable<GuildThread>

GetPublicArchivedGuildThreadsAsync(PaginationProperties<DateTimeOffset>?, RestRequestProperties?)

Retrieves public archived threads in the channel.

public IAsyncEnumerable<GuildThread> GetPublicArchivedGuildThreadsAsync(PaginationProperties<DateTimeOffset>? paginationProperties = null, RestRequestProperties? properties = null)

Parameters

paginationProperties PaginationProperties<DateTimeOffset>

Pagination options for archived threads, or null to use defaults.

properties RestRequestProperties

Optional properties to customize each request, can be null.

Returns

IAsyncEnumerable<GuildThread>

ModifyAsync(Action<GuildChannelOptions>, RestRequestProperties?, CancellationToken)

Modifies a guild channel's properties.

public Task<TextGuildChannel> ModifyAsync(Action<GuildChannelOptions> action, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

action Action<GuildChannelOptions>

An action delegate used to configure the updated channel options.

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task<TextGuildChannel>

ModifyPermissionsAsync(PermissionOverwriteProperties, RestRequestProperties?, CancellationToken)

Modifies the permissions of a role or user in a guild channel.

public Task ModifyPermissionsAsync(PermissionOverwriteProperties permissionOverwrite, RestRequestProperties? properties = null, CancellationToken cancellationToken = default)

Parameters

permissionOverwrite PermissionOverwriteProperties

The permission overwrite to apply.

properties RestRequestProperties

Optional properties to customize the request, can be null.

cancellationToken CancellationToken

A token that can be used to cancel the operation before it completes.

Returns

Task