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 SourceIsNsfw
Gets a value that indicates whether the channel is NSFW.
Declaration
bool IsNsfw { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
SlowModeInterval
Gets the current slow-mode delay for this channel.
Declaration
int SlowModeInterval { get; }
Property Value
| Type | Description |
|---|---|
| System.Int32 | An System.Int32 representing the time in seconds required before the user can send another
message; |
Topic
Gets the current topic for this text channel.
Declaration
string Topic { get; }
Property Value
| Type | Description |
|---|---|
| System.String | A string representing the topic set in the channel; |
Methods
| Improve this Doc View SourceCreateWebhookAsync(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 |
|---|---|---|
| System.String | name | The name of the webhook. |
| System.IO.Stream | avatar | The avatar of the webhook. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.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 |
|---|---|---|
| System.Collections.Generic.IEnumerable<IMessage> | messages | The messages to be bulk-deleted. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.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 |
|---|---|---|
| System.Collections.Generic.IEnumerable<System.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 |
|---|---|
| System.Threading.Tasks.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!
GetWebhookAsync(UInt64, RequestOptions)
Gets a webhook available in this text channel.
Declaration
Task<IWebhook> GetWebhookAsync(ulong id, RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt64 | id | The identifier of the webhook. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.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 |
|---|---|
| System.Threading.Tasks.Task<System.Collections.Generic.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 |
|---|---|---|
| System.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 |
|---|---|
| System.Threading.Tasks.Task | A task that represents the asynchronous modification operation. |