Show / Hide Table of Contents

# Class SocketTextChannel

Represents a WebSocket-based channel in a guild that can send and receive messages.

##### Inheritance

System.Object
SocketEntity<System.UInt64>
SocketChannel
SocketGuildChannel
SocketTextChannel
SocketNewsChannel

##### Implements

ITextChannel
IMentionable
INestedChannel
IGuildChannel
IDeletable
ISocketMessageChannel
IMessageChannel
IChannel
ISnowflakeEntity
IEntity<System.UInt64>

##### Inherited Members

SocketGuildChannel.Guild
SocketGuildChannel.Name
SocketGuildChannel.Position
SocketGuildChannel.PermissionOverwrites
SocketGuildChannel.ModifyAsync(Action<GuildChannelProperties>, RequestOptions)
SocketGuildChannel.DeleteAsync(RequestOptions)
SocketGuildChannel.GetPermissionOverwrite(IUser)
SocketGuildChannel.GetPermissionOverwrite(IRole)
SocketGuildChannel.AddPermissionOverwriteAsync(IUser, OverwritePermissions, RequestOptions)
SocketGuildChannel.AddPermissionOverwriteAsync(IRole, OverwritePermissions, RequestOptions)
SocketGuildChannel.RemovePermissionOverwriteAsync(IUser, RequestOptions)
SocketGuildChannel.RemovePermissionOverwriteAsync(IRole, RequestOptions)
SocketGuildChannel.ToString()
SocketGuildChannel.IGuildChannel.Guild
SocketGuildChannel.IGuildChannel.GuildId
SocketGuildChannel.IGuildChannel.GetPermissionOverwrite(IRole)
SocketGuildChannel.IGuildChannel.GetPermissionOverwrite(IUser)
SocketGuildChannel.IGuildChannel.AddPermissionOverwriteAsync(IRole, OverwritePermissions, RequestOptions)
SocketGuildChannel.IGuildChannel.AddPermissionOverwriteAsync(IUser, OverwritePermissions, RequestOptions)
SocketGuildChannel.IGuildChannel.RemovePermissionOverwriteAsync(IRole, RequestOptions)
SocketGuildChannel.IGuildChannel.RemovePermissionOverwriteAsync(IUser, RequestOptions)
SocketGuildChannel.IChannel.GetUserAsync(UInt64, CacheMode, RequestOptions)
SocketChannel.CreatedAt
SocketChannel.IChannel.Name
SocketEntity<UInt64>.Id
System.Object.Equals(System.Object)
System.Object.Equals(System.Object, System.Object)
System.Object.ReferenceEquals(System.Object, System.Object)
System.Object.GetHashCode()
System.Object.GetType()
System.Object.MemberwiseClone()

###### Namespace: Discord.WebSocket

###### Assembly: Discord.Net.WebSocket.dll

##### Syntax

    public class SocketTextChannel : SocketGuildChannel, ITextChannel, IMentionable, INestedChannel, IGuildChannel, IDeletable, ISocketMessageChannel, IMessageChannel, IChannel, ISnowflakeEntity, IEntity<ulong>

### Properties

| Improve this Doc View Source

#### CachedMessages

##### Declaration

    public IReadOnlyCollection<SocketMessage> CachedMessages { get; }

##### Property Value

Type | Description
--- | ---
System.Collections.Generic.IReadOnlyCollection<SocketMessage> |

| Improve this Doc View Source

#### Category

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

##### Declaration

    public ICategoryChannel Category { get; }

##### Property Value

Type | Description
--- | ---
ICategoryChannel | An ICategoryChannel representing the parent of this channel; `null` if none is set.

| Improve this Doc View Source

#### CategoryId

##### Declaration

    public ulong? CategoryId { get; }

##### Property Value

Type | Description
--- | ---
System.Nullable<System.UInt64> |

| Improve this Doc View Source

#### IsNsfw

##### Declaration

    public bool IsNsfw { get; }

##### Property Value

Type | Description
--- | ---
System.Boolean |

| Improve this Doc View Source

#### Mention

##### Declaration

    public string Mention { get; }

##### Property Value

Type | Description
--- | ---
System.String |

| Improve this Doc View Source

#### SlowModeInterval

##### Declaration

    public virtual int SlowModeInterval { get; }

##### Property Value

Type | Description
--- | ---
System.Int32 |

| Improve this Doc View Source

#### Topic

##### Declaration

    public string Topic { get; }

##### Property Value

Type | Description
--- | ---
System.String |

| Improve this Doc View Source

#### Users

##### Declaration

    public override IReadOnlyCollection<SocketGuildUser> Users { get; }

##### Property Value

Type | Description
--- | ---
System.Collections.Generic.IReadOnlyCollection<SocketGuildUser> |

##### Overrides

SocketGuildChannel.Users

### Methods

| Improve this Doc View Source

#### CreateInviteAsync(Nullable<Int32>, Nullable<Int32>, Boolean, Boolean, RequestOptions)

##### Declaration

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

##### Parameters

Type | Name | Description
--- | --- | ---
System.Nullable<System.Int32> | maxAge |
System.Nullable<System.Int32> | maxUses |
System.Boolean | isTemporary |
System.Boolean | isUnique |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<IInviteMetadata> |

| Improve this Doc View Source

#### CreateWebhookAsync(String, Stream, RequestOptions)

Creates a webhook in this text channel.

##### Declaration

    public Task<RestWebhook> 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<RestWebhook> | A task that represents the asynchronous creation operation. The task result contains the newly created webhook.

| Improve this Doc View Source

#### DeleteMessageAsync(IMessage, RequestOptions)

##### Declaration

    public Task DeleteMessageAsync(IMessage message, RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
IMessage | message |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

| Improve this Doc View Source

#### DeleteMessageAsync(UInt64, RequestOptions)

##### Declaration

    public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | messageId |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

| Improve this Doc View Source

#### DeleteMessagesAsync(IEnumerable<IMessage>, RequestOptions)

##### Declaration

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

##### Parameters

Type | Name | Description
--- | --- | ---
System.Collections.Generic.IEnumerable<IMessage> | messages |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

| Improve this Doc View Source

#### DeleteMessagesAsync(IEnumerable<UInt64>, RequestOptions)

##### Declaration

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

##### Parameters

Type | Name | Description
--- | --- | ---
System.Collections.Generic.IEnumerable<System.UInt64> | messageIds |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

| Improve this Doc View Source

#### EnterTypingState(RequestOptions)

##### Declaration

    public IDisposable EnterTypingState(RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.IDisposable |

| Improve this Doc View Source

#### GetCachedMessage(UInt64)

##### Declaration

    public SocketMessage GetCachedMessage(ulong id)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |

##### Returns

Type | Description
--- | ---
SocketMessage |

| Improve this Doc View Source

#### GetCachedMessages(IMessage, Direction, Int32)

##### Declaration

    public IReadOnlyCollection<SocketMessage> GetCachedMessages(IMessage fromMessage, Direction dir, int limit = 100)

##### Parameters

Type | Name | Description
--- | --- | ---
IMessage | fromMessage |
Direction | dir |
System.Int32 | limit |

##### Returns

Type | Description
--- | ---
System.Collections.Generic.IReadOnlyCollection<SocketMessage> |

| Improve this Doc View Source

#### GetCachedMessages(Int32)

##### Declaration

    public IReadOnlyCollection<SocketMessage> GetCachedMessages(int limit = 100)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32 | limit |

##### Returns

Type | Description
--- | ---
System.Collections.Generic.IReadOnlyCollection<SocketMessage> |

| Improve this Doc View Source

#### GetCachedMessages(UInt64, Direction, Int32)

##### Declaration

    public IReadOnlyCollection<SocketMessage> GetCachedMessages(ulong fromMessageId, Direction dir, int limit = 100)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | fromMessageId |
Direction | dir |
System.Int32 | limit |

##### Returns

Type | Description
--- | ---
System.Collections.Generic.IReadOnlyCollection<SocketMessage> |

| Improve this Doc View Source

#### GetInvitesAsync(RequestOptions)

##### Declaration

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

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<IInviteMetadata>> |

| Improve this Doc View Source

#### GetMessageAsync(UInt64, RequestOptions)

Gets a message from this message channel.

##### Declaration

    public Task<IMessage> GetMessageAsync(ulong id, RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id | The snowflake identifier of the message.
RequestOptions | options | The options to be used when sending the request.

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<IMessage> | A task that represents an asynchronous get operation for retrieving the message. The task result contains the retrieved message; `null` if no message is found with the specified identifier.

##### Remarks

This method follows the same behavior as described in GetMessageAsync(UInt64, CacheMode, RequestOptions). Please visit its documentation for more details on this method.

| Improve this Doc View Source

#### GetMessagesAsync(IMessage, Direction, Int32, RequestOptions)

Gets a collection of messages in this channel.

##### Declaration

    public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(IMessage fromMessage, Direction dir, int limit = 100, RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
IMessage | fromMessage | The starting message to get the messages from.
Direction | dir | The direction of the messages to be gotten from.
System.Int32 | limit | The numbers of message to be gotten from.
RequestOptions | options | The options to be used when sending the request.

##### Returns

Type | Description
--- | ---
System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<IMessage>> | Paged collection of messages.

##### Remarks

This method follows the same behavior as described in GetMessagesAsync(IMessage, Direction, Int32, CacheMode, RequestOptions). Please visit its documentation for more details on this method.

| Improve this Doc View Source

#### GetMessagesAsync(Int32, RequestOptions)

Gets the last N messages from this message channel.

##### Declaration

    public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(int limit = 100, RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.Int32 | limit | The numbers of message to be gotten from.
RequestOptions | options | The options to be used when sending the request.

##### Returns

Type | Description
--- | ---
System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<IMessage>> | Paged collection of messages.

##### Remarks

This method follows the same behavior as described in GetMessagesAsync(Int32, CacheMode, RequestOptions). Please visit its documentation for more details on this method.

| Improve this Doc View Source

#### GetMessagesAsync(UInt64, Direction, Int32, RequestOptions)

Gets a collection of messages in this channel.

##### Declaration

    public IAsyncEnumerable<IReadOnlyCollection<IMessage>> GetMessagesAsync(ulong fromMessageId, Direction dir, int limit = 100, RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | fromMessageId | The ID of the starting message to get the messages from.
Direction | dir | The direction of the messages to be gotten from.
System.Int32 | limit | The numbers of message to be gotten from.
RequestOptions | options | The options to be used when sending the request.

##### Returns

Type | Description
--- | ---
System.Collections.Generic.IAsyncEnumerable<System.Collections.Generic.IReadOnlyCollection<IMessage>> | Paged collection of messages.

##### Remarks

This method follows the same behavior as described in GetMessagesAsync(UInt64, Direction, Int32, CacheMode, RequestOptions). Please visit its documentation for more details on this method.

| Improve this Doc View Source

#### GetPinnedMessagesAsync(RequestOptions)

##### Declaration

    public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<RestMessage>> |

| Improve this Doc View Source

#### GetUser(UInt64)

##### Declaration

    public override SocketGuildUser GetUser(ulong id)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |

##### Returns

Type | Description
--- | ---
SocketGuildUser |

##### Overrides

SocketGuildChannel.GetUser(UInt64)
| Improve this Doc View Source

#### GetWebhookAsync(UInt64, RequestOptions)

Gets a webhook available in this text channel.

##### Declaration

    public Task<RestWebhook> 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<RestWebhook> | A task that represents the asynchronous get operation. The task result contains a webhook associated with the identifier; `null` if the webhook is not found.

| Improve this Doc View Source

#### GetWebhooksAsync(RequestOptions)

Gets the webhooks available in this text channel.

##### Declaration

    public Task<IReadOnlyCollection<RestWebhook>> 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<RestWebhook>> | A task that represents the asynchronous get operation. The task result contains a read-only collection of webhooks that is available in this channel.

| Improve this Doc View Source

#### ModifyAsync(Action<TextChannelProperties>, RequestOptions)

##### Declaration

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

##### Parameters

Type | Name | Description
--- | --- | ---
System.Action<TextChannelProperties> | func |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

| Improve this Doc View Source

#### SendFileAsync(Stream, String, String, Boolean, Embed, RequestOptions, Boolean)

##### Declaration

    public Task<RestUserMessage> SendFileAsync(Stream stream, string filename, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false)

##### Parameters

Type | Name | Description
--- | --- | ---
System.IO.Stream | stream |
System.String | filename |
System.String | text |
System.Boolean | isTTS |
Embed | embed |
RequestOptions | options |
System.Boolean | isSpoiler |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<RestUserMessage> |

##### Exceptions

Type | Condition
--- | ---
System.ArgumentOutOfRangeException | Message content is too long, length must be less or equal to MaxMessageSize.

| Improve this Doc View Source

#### SendFileAsync(String, String, Boolean, Embed, RequestOptions, Boolean)

##### Declaration

    public Task<RestUserMessage> SendFileAsync(string filePath, string text, bool isTTS = false, Embed embed = null, RequestOptions options = null, bool isSpoiler = false)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | filePath |
System.String | text |
System.Boolean | isTTS |
Embed | embed |
RequestOptions | options |
System.Boolean | isSpoiler |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<RestUserMessage> |

| Improve this Doc View Source

#### SendMessageAsync(String, Boolean, Embed, RequestOptions)

##### Declaration

    public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | text |
System.Boolean | isTTS |
Embed | embed |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<RestUserMessage> |

##### Exceptions

Type | Condition
--- | ---
System.ArgumentOutOfRangeException | Message content is too long, length must be less or equal to MaxMessageSize.

| Improve this Doc View Source

#### SyncPermissionsAsync(RequestOptions)

##### Declaration

    public virtual Task SyncPermissionsAsync(RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

| Improve this Doc View Source

#### TriggerTypingAsync(RequestOptions)

##### Declaration

    public Task TriggerTypingAsync(RequestOptions options = null)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task |

### Explicit Interface Implementations

| Improve this Doc View Source

#### IGuildChannel.GetUserAsync(UInt64, CacheMode, RequestOptions)

##### Declaration

    Task<IGuildUser> IGuildChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |
CacheMode | mode |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<IGuildUser> |

| Improve this Doc View Source

#### IMessageChannel.GetMessageAsync(UInt64, CacheMode, RequestOptions)

##### Declaration

    Task<IMessage> IMessageChannel.GetMessageAsync(ulong id, CacheMode mode, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |
CacheMode | mode |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<IMessage> |

| Improve this Doc View Source

#### IMessageChannel.GetPinnedMessagesAsync(RequestOptions)

##### Declaration

    Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<IMessage>> |

| Improve this Doc View Source

#### IMessageChannel.SendFileAsync(Stream, String, String, Boolean, Embed, RequestOptions, Boolean)

##### Declaration

    Task<IUserMessage> IMessageChannel.SendFileAsync(Stream stream, string filename, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler)

##### Parameters

Type | Name | Description
--- | --- | ---
System.IO.Stream | stream |
System.String | filename |
System.String | text |
System.Boolean | isTTS |
Embed | embed |
RequestOptions | options |
System.Boolean | isSpoiler |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<IUserMessage> |

| Improve this Doc View Source

#### IMessageChannel.SendFileAsync(String, String, Boolean, Embed, RequestOptions, Boolean)

##### Declaration

    Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | filePath |
System.String | text |
System.Boolean | isTTS |
Embed | embed |
RequestOptions | options |
System.Boolean | isSpoiler |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<IUserMessage> |

| Improve this Doc View Source

#### IMessageChannel.SendMessageAsync(String, Boolean, Embed, RequestOptions)

##### Declaration

    Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | text |
System.Boolean | isTTS |
Embed | embed |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<IUserMessage> |

| Improve this Doc View Source

#### INestedChannel.GetCategoryAsync(CacheMode, RequestOptions)

##### Declaration

    Task<ICategoryChannel> INestedChannel.GetCategoryAsync(CacheMode mode, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
CacheMode | mode |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<ICategoryChannel> |

| Improve this Doc View Source

#### ITextChannel.CreateWebhookAsync(String, Stream, RequestOptions)

##### Declaration

    Task<IWebhook> ITextChannel.CreateWebhookAsync(string name, Stream avatar, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
System.String | name |
System.IO.Stream | avatar |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<IWebhook> |

| Improve this Doc View Source

#### ITextChannel.GetWebhookAsync(UInt64, RequestOptions)

##### Declaration

    Task<IWebhook> ITextChannel.GetWebhookAsync(ulong id, RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
System.UInt64 | id |
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<IWebhook> |

| Improve this Doc View Source

#### ITextChannel.GetWebhooksAsync(RequestOptions)

##### Declaration

    Task<IReadOnlyCollection<IWebhook>> ITextChannel.GetWebhooksAsync(RequestOptions options)

##### Parameters

Type | Name | Description
--- | --- | ---
RequestOptions | options |

##### Returns

Type | Description
--- | ---
System.Threading.Tasks.Task<System.Collections.Generic.IReadOnlyCollection<IWebhook>> |

### Implements

ITextChannel
IMentionable
INestedChannel
IGuildChannel
IDeletable
ISocketMessageChannel
IMessageChannel
IChannel
ISnowflakeEntity
IEntity<TId>