Interface ITextChannel
Represents a generic channel in a guild that can send and receive messages.
Inherited Members
Namespace: Discord
Assembly: Discord.Net.Core.dll
Syntax
public interface ITextChannel : IMessageChannel, IMentionable, INestedChannel, IGuildChannel, IChannel, ISnowflakeEntity, IEntity<ulong>, IDeletable
Properties
| Improve this Doc View SourceDefaultArchiveDuration
Gets the default auto-archive duration for client-created threads in this channel.
Declaration
ThreadArchiveDuration DefaultArchiveDuration { get; }
Property Value
Type | Description |
---|---|
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.
IsNsfw
Gets a value that indicates whether the channel is NSFW.
Declaration
bool IsNsfw { get; }
Property Value
Type | Description |
---|---|
Boolean |
|
SlowModeInterval
Gets the current slow-mode delay for this channel.
Declaration
int SlowModeInterval { get; }
Property Value
Type | Description |
---|---|
Int32 | An |
Topic
Gets the current topic for this text channel.
Declaration
string Topic { get; }
Property Value
Type | Description |
---|---|
String | A string representing the topic set in the channel; |
Methods
| Improve this Doc View SourceCreateThreadAsync(String, ThreadType, ThreadArchiveDuration, IMessage, Nullable<Boolean>, Nullable<Int32>, RequestOptions)
Creates a thread within this ITextChannel.
Declaration
Task<IThreadChannel> CreateThreadAsync(string name, ThreadType type = default(ThreadType), ThreadArchiveDuration autoArchiveDuration = default(ThreadArchiveDuration), IMessage message = null, bool? invitable = null, int? slowmode = null, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the thread. |
ThreadType | type | The type of the thread.
Note: This parameter is not used if the |
ThreadArchiveDuration | autoArchiveDuration | 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. |
IMessage | message | The message which to start the thread from. |
Nullable<Boolean> | invitable | Whether non-moderators can add other non-moderators to a thread; only available when creating a private thread |
Nullable<Int32> | slowmode | The amount of seconds a user has to wait before sending another message (0-21600) |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
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.
CreateWebhookAsync(String, Stream, RequestOptions)
Creates a webhook in this text channel.
Declaration
Task<IWebhook> CreateWebhookAsync(string name, Stream avatar = null, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
String | name | The name of the webhook. |
Stream | avatar | The avatar of the webhook. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
Task<IWebhook> | A task that represents the asynchronous creation operation. The task result contains the newly created webhook. |
DeleteMessagesAsync(IEnumerable<IMessage>, RequestOptions)
Bulk-deletes multiple messages.
Declaration
Task DeleteMessagesAsync(IEnumerable<IMessage> messages, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<IMessage> | messages | The messages to be bulk-deleted. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
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!
Examples
The following example gets 250 messages from the channel and deletes them.
var messages = await textChannel.GetMessagesAsync(250).FlattenAsync();
await textChannel.DeleteMessagesAsync(messages);
|
Improve this Doc
View Source
DeleteMessagesAsync(IEnumerable<UInt64>, RequestOptions)
Bulk-deletes multiple messages.
Declaration
Task DeleteMessagesAsync(IEnumerable<ulong> messageIds, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
IEnumerable<UInt64> | messageIds | The snowflake identifier of the messages to be bulk-deleted. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
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.
Declaration
Task<IReadOnlyCollection<IThreadChannel>> GetActiveThreadsAsync(RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
Task<IReadOnlyCollection<IThreadChannel>> | A task that represents an asynchronous get operation for retrieving the threads. The task result contains a collection of active threads. |
GetWebhookAsync(UInt64, RequestOptions)
Gets a webhook available in this text channel.
Declaration
Task<IWebhook> GetWebhookAsync(ulong id, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
UInt64 | id | The identifier of the webhook. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
Task<IWebhook> | A task that represents the asynchronous get operation. The task result contains a webhook associated
with the identifier; |
GetWebhooksAsync(RequestOptions)
Gets the webhooks available in this text channel.
Declaration
Task<IReadOnlyCollection<IWebhook>> GetWebhooksAsync(RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
Task<IReadOnlyCollection<IWebhook>> | A task that represents the asynchronous get operation. The task result contains a read-only collection of webhooks that is available in this channel. |
ModifyAsync(Action<TextChannelProperties>, RequestOptions)
Modifies this text channel.
Declaration
Task ModifyAsync(Action<TextChannelProperties> func, RequestOptions options = null)
Parameters
Type | Name | Description |
---|---|---|
Action<TextChannelProperties> | func | The delegate containing the properties to modify the channel with. |
RequestOptions | options | The options to be used when sending the request. |
Returns
Type | Description |
---|---|
Task | A task that represents the asynchronous modification operation. |