Table of Contents

Interface ITextChannel

Namespace
Discord
Assembly
Discord.Net.Core.dll

Represents a generic channel in a guild that can send and receive messages.

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

Properties

DefaultArchiveDuration

Gets the default auto-archive duration for client-created threads in this channel.

ThreadArchiveDuration DefaultArchiveDuration { get; }

Property Value

ThreadArchiveDuration

The default auto-archive duration for thread creation in this channel.

Remarks

The value of this property does not affect API thread creation, it will not respect this value.

DefaultSlowModeInterval

Gets the current default slow-mode delay for threads in this channel.

int DefaultSlowModeInterval { get; }

Property Value

int

An int representing the time in seconds required before the user can send another message; 0 if disabled.

IsNsfw

Gets a value that indicates whether the channel is NSFW.

bool IsNsfw { get; }

Property Value

bool

true if the channel has the NSFW flag enabled; otherwise false.

SlowModeInterval

Gets the current slow-mode delay for this channel.

int SlowModeInterval { get; }

Property Value

int

An int representing the time in seconds required before the user can send another message; 0 if disabled.

Topic

Gets the current topic for this text channel.

string Topic { get; }

Property Value

string

A string representing the topic set in the channel; null if none is set.

Methods

CreateThreadAsync(string, ThreadType, ThreadArchiveDuration, IMessage, bool?, int?, RequestOptions)

Creates a thread within this ITextChannel.

Task<IThreadChannel> CreateThreadAsync(string name, ThreadType type = ThreadType.PublicThread, ThreadArchiveDuration autoArchiveDuration = ThreadArchiveDuration.OneDay, IMessage message = null, bool? invitable = null, int? slowmode = null, RequestOptions options = null)

Parameters

name string

The name of the thread.

type ThreadType

The type of the thread.

Note: This parameter is not used if the message parameter is not specified.

autoArchiveDuration ThreadArchiveDuration

The duration on which this thread archives after.

Note: Options OneWeek and ThreeDays are only available for guilds that are boosted. You can check in the Features to see if the guild has the THREE_DAY_THREAD_ARCHIVE and SEVEN_DAY_THREAD_ARCHIVE.

message IMessage

The message which to start the thread from.

invitable bool?

Whether non-moderators can add other non-moderators to a thread; only available when creating a private thread

slowmode int?

The amount of seconds a user has to wait before sending another message (0-21600)

options RequestOptions

The options to be used when sending the request.

Returns

Task<IThreadChannel>

A task that represents the asynchronous create operation. The task result contains a IThreadChannel

Remarks

When message is null the thread type will be based off of the channel its created in. When called on a ITextChannel, it creates a PublicThread. When called on a INewsChannel, it creates a NewsThread. The id of the created thread will be the same as the id of the message, and as such a message can only have a single thread created from it.

DeleteMessagesAsync(IEnumerable<IMessage>, RequestOptions)

Bulk-deletes multiple messages.

Task DeleteMessagesAsync(IEnumerable<IMessage> messages, RequestOptions options = null)

Parameters

messages IEnumerable<IMessage>

The messages to be bulk-deleted.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous bulk-removal operation.

Examples

The following example gets 250 messages from the channel and deletes them.

var messages = await textChannel.GetMessagesAsync(250).FlattenAsync();
await textChannel.DeleteMessagesAsync(messages);

Remarks

This method attempts to remove the messages specified in bulk.

important

Due to the limitation set by Discord, this method can only remove messages that are posted within 14 days!

DeleteMessagesAsync(IEnumerable<ulong>, RequestOptions)

Bulk-deletes multiple messages.

Task DeleteMessagesAsync(IEnumerable<ulong> messageIds, RequestOptions options = null)

Parameters

messageIds IEnumerable<ulong>

The snowflake identifier of the messages to be bulk-deleted.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous bulk-removal operation.

Remarks

This method attempts to remove the messages specified in bulk.

important

Due to the limitation set by Discord, this method can only remove messages that are posted within 14 days!

GetActiveThreadsAsync(RequestOptions)

Gets a collection of active threads within this channel.

Task<IReadOnlyCollection<IThreadChannel>> GetActiveThreadsAsync(RequestOptions options = null)

Parameters

options RequestOptions

The options to be used when sending the request.

Returns

Task<IReadOnlyCollection<IThreadChannel>>

A task that represents an asynchronous get operation for retrieving the threads. The task result contains a collection of active threads.

ModifyAsync(Action<TextChannelProperties>, RequestOptions)

Modifies this text channel.

Task ModifyAsync(Action<TextChannelProperties> func, RequestOptions options = null)

Parameters

func Action<TextChannelProperties>

The delegate containing the properties to modify the channel with.

options RequestOptions

The options to be used when sending the request.

Returns

Task

A task that represents the asynchronous modification operation.

See Also