Class SocketTextChannel
Represents a WebSocket-based channel in a guild that can send and receive messages.
Implements
Inherited Members
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 SourceCachedMessages
Gets all messages in this channel's cache.
Declaration
public IReadOnlyCollection<SocketMessage> CachedMessages { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<SocketMessage> | A read-only collection of WebSocket-based messages. |
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; |
CategoryId
Gets the parent (category) ID of this channel in the guild's channel list.
Declaration
public ulong? CategoryId { get; }
Property Value
| Type | Description |
|---|---|
| System.Nullable<System.UInt64> | A System.UInt64 representing the snowflake identifier of the parent of this channel;
|
IsNsfw
Gets a value that indicates whether the channel is NSFW.
Declaration
public bool IsNsfw { get; }
Property Value
| Type | Description |
|---|---|
| System.Boolean |
|
Mention
Returns a special string used to mention this object.
Declaration
public string Mention { get; }
Property Value
| Type | Description |
|---|---|
| System.String | A string that is recognized by Discord as a mention (e.g. <@168693960628371456>). |
SlowModeInterval
Gets the current slow-mode delay for this channel.
Declaration
public virtual 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
public string Topic { get; }
Property Value
| Type | Description |
|---|---|
| System.String | A string representing the topic set in the channel; |
Users
Gets a collection of users that are able to view the channel.
Declaration
public override IReadOnlyCollection<SocketGuildUser> Users { get; }
Property Value
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<SocketGuildUser> | A read-only collection of users that can access the channel (i.e. the users seen in the user list). |
Overrides
Methods
| Improve this Doc View SourceCreateInviteAsync(Nullable<Int32>, Nullable<Int32>, Boolean, Boolean, RequestOptions)
Creates a new invite to this channel.
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 | The time (in seconds) until the invite expires. Set to |
| System.Nullable<System.Int32> | maxUses | The max amount of times this invite may be used. Set to |
| System.Boolean | isTemporary | If |
| System.Boolean | isUnique | If |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<IInviteMetadata> | A task that represents the asynchronous invite creation operation. The task result contains an invite metadata object containing information for the created invite. |
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. |
DeleteMessageAsync(IMessage, RequestOptions)
Deletes a message based on the provided message in this channel.
Declaration
public Task DeleteMessageAsync(IMessage message, RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| IMessage | message | The message that would be removed. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task that represents the asynchronous removal operation. |
DeleteMessageAsync(UInt64, RequestOptions)
Deletes a message.
Declaration
public Task DeleteMessageAsync(ulong messageId, RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt64 | messageId | The snowflake identifier of the message that would be removed. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task | A task that represents the asynchronous removal operation. |
DeleteMessagesAsync(IEnumerable<IMessage>, RequestOptions)
Bulk-deletes multiple messages.
Declaration
public 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!
DeleteMessagesAsync(IEnumerable<UInt64>, RequestOptions)
Bulk-deletes multiple messages.
Declaration
public 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!
EnterTypingState(RequestOptions)
Continuously broadcasts the "user is typing" message to all users in this channel until the returned object is disposed.
Declaration
public IDisposable EnterTypingState(RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.IDisposable | A disposable object that, upon its disposal, will stop the client from broadcasting its typing state in this channel. |
GetCachedMessage(UInt64)
Gets a cached message from this channel.
Declaration
public SocketMessage GetCachedMessage(ulong id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt64 | id | The snowflake identifier of the message. |
Returns
| Type | Description |
|---|---|
| SocketMessage | A WebSocket-based message object; |
Remarks
warning
This method requires the use of cache, which is not enabled by default; if caching is not enabled,
this method will always return null. Please refer to
MessageCacheSize for more details.
This method retrieves the message from the local WebSocket cache and does not send any additional request to Discord. This message may be a message that has been deleted.
GetCachedMessages(IMessage, Direction, Int32)
Gets the last N cached messages starting from a certain message in this message channel.
Declaration
public IReadOnlyCollection<SocketMessage> GetCachedMessages(IMessage fromMessage, Direction dir, int limit = 100)
Parameters
| Type | Name | Description |
|---|---|---|
| IMessage | fromMessage | The message to start the fetching from. |
| Direction | dir | The direction of which the message should be gotten from. |
| System.Int32 | limit | The number of messages to get. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<SocketMessage> | A read-only collection of WebSocket-based messages. |
Remarks
warning
This method requires the use of cache, which is not enabled by default; if caching is not enabled, this method will always return an empty collection. Please refer to MessageCacheSize for more details.
This method retrieves the message(s) from the local WebSocket cache and does not send any additional request to Discord. This read-only collection may include messages that have been deleted. The maximum number of messages that can be retrieved from this method depends on the MessageCacheSize set.
GetCachedMessages(Int32)
Gets the last N cached messages from this message channel.
Declaration
public IReadOnlyCollection<SocketMessage> GetCachedMessages(int limit = 100)
Parameters
| Type | Name | Description |
|---|---|---|
| System.Int32 | limit | The number of messages to get. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<SocketMessage> | A read-only collection of WebSocket-based messages. |
Remarks
warning
This method requires the use of cache, which is not enabled by default; if caching is not enabled, this method will always return an empty collection. Please refer to MessageCacheSize for more details.
This method retrieves the message(s) from the local WebSocket cache and does not send any additional request to Discord. This read-only collection may include messages that have been deleted. The maximum number of messages that can be retrieved from this method depends on the MessageCacheSize set.
GetCachedMessages(UInt64, Direction, Int32)
Gets the last N cached messages starting from a certain message in this message channel.
Declaration
public IReadOnlyCollection<SocketMessage> GetCachedMessages(ulong fromMessageId, Direction dir, int limit = 100)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt64 | fromMessageId | The message ID to start the fetching from. |
| Direction | dir | The direction of which the message should be gotten from. |
| System.Int32 | limit | The number of messages to get. |
Returns
| Type | Description |
|---|---|
| System.Collections.Generic.IReadOnlyCollection<SocketMessage> | A read-only collection of WebSocket-based messages. |
Remarks
warning
This method requires the use of cache, which is not enabled by default; if caching is not enabled, this method will always return an empty collection. Please refer to MessageCacheSize for more details.
This method retrieves the message(s) from the local WebSocket cache and does not send any additional request to Discord. This read-only collection may include messages that have been deleted. The maximum number of messages that can be retrieved from this method depends on the MessageCacheSize set.
GetInvitesAsync(RequestOptions)
Gets a collection of all invites to this channel.
Declaration
public Task<IReadOnlyCollection<IInviteMetadata>> GetInvitesAsync(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<IInviteMetadata>> | A task that represents the asynchronous get operation. The task result contains a read-only collection of invite metadata that are created for this channel. |
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; |
Remarks
This method follows the same behavior as described in GetMessageAsync(UInt64, CacheMode, RequestOptions). Please visit its documentation for more details on this method.
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.
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.
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.
GetPinnedMessagesAsync(RequestOptions)
Gets a read-only collection of pinned messages in this channel.
Declaration
public Task<IReadOnlyCollection<RestMessage>> GetPinnedMessagesAsync(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<RestMessage>> | A task that represents the asynchronous get operation for retrieving pinned messages in this channel. The task result contains a read-only collection of messages found in the pinned messages. |
Remarks
This method follows the same behavior as described in GetPinnedMessagesAsync(RequestOptions). Please visit its documentation for more details on this method.
GetUser(UInt64)
Declaration
public override SocketGuildUser GetUser(ulong id)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt64 | id |
Returns
| Type | Description |
|---|---|
| SocketGuildUser |
Overrides
| Improve this Doc View SourceGetWebhookAsync(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; |
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. |
ModifyAsync(Action<TextChannelProperties>, RequestOptions)
Modifies this text channel.
Declaration
public 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. |
See Also
| Improve this Doc View SourceSendFileAsync(Stream, String, String, Boolean, Embed, RequestOptions, Boolean)
Sends a file to this message channel with an optional caption.
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 | The System.IO.Stream of the file to be sent. |
| System.String | filename | The name of the attachment. |
| System.String | text | The message to be sent. |
| System.Boolean | isTTS | Whether the message should be read aloud by Discord or not. |
| Embed | embed | |
| RequestOptions | options | The options to be used when sending the request. |
| System.Boolean | isSpoiler | Whether the message attachment should be hidden as a spoiler. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<RestUserMessage> | A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message. |
Remarks
This method follows the same behavior as described in SendFileAsync(Stream, String, String, Boolean, Embed, RequestOptions, Boolean). Please visit its documentation for more details on this method.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentOutOfRangeException | Message content is too long, length must be less or equal to MaxMessageSize. |
SendFileAsync(String, String, Boolean, Embed, RequestOptions, Boolean)
Sends a file to this message channel with an optional caption.
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 | The file path of the file. |
| System.String | text | The message to be sent. |
| System.Boolean | isTTS | Whether the message should be read aloud by Discord or not. |
| Embed | embed | |
| RequestOptions | options | The options to be used when sending the request. |
| System.Boolean | isSpoiler | Whether the message attachment should be hidden as a spoiler. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<RestUserMessage> | A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message. |
Remarks
This method follows the same behavior as described in SendFileAsync(String, String, Boolean, Embed, RequestOptions, Boolean). Please visit its documentation for more details on this method.
SendMessageAsync(String, Boolean, Embed, RequestOptions)
Sends a message to this message channel.
Declaration
public Task<RestUserMessage> SendMessageAsync(string text = null, bool isTTS = false, Embed embed = null, RequestOptions options = null)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The message to be sent. |
| System.Boolean | isTTS | Determines whether the message should be read aloud by Discord or not. |
| Embed | embed | |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<RestUserMessage> | A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message. |
Remarks
This method follows the same behavior as described in SendMessageAsync(String, Boolean, Embed, RequestOptions). Please visit its documentation for more details on this method.
Exceptions
| Type | Condition |
|---|---|
| System.ArgumentOutOfRangeException | Message content is too long, length must be less or equal to MaxMessageSize. |
SyncPermissionsAsync(RequestOptions)
Syncs the permissions of this nested channel with its parent's.
Declaration
public virtual Task SyncPermissionsAsync(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 | A task that represents the asynchronous operation for syncing channel permissions with its parent's. |
TriggerTypingAsync(RequestOptions)
Broadcasts the "user is typing" message to all users in this channel, lasting 10 seconds.
Declaration
public Task TriggerTypingAsync(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 | A task that represents the asynchronous operation that triggers the broadcast. |
Explicit Interface Implementations
| Improve this Doc View SourceIGuildChannel.GetUserAsync(UInt64, CacheMode, RequestOptions)
Gets a user in this channel.
Declaration
Task<IGuildUser> IGuildChannel.GetUserAsync(ulong id, CacheMode mode, RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt64 | id | The snowflake identifier of the user. |
| CacheMode | mode | The CacheMode that determines whether the object should be fetched from cache. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<IGuildUser> | A task representing the asynchronous get operation. The task result contains a guild user object that
represents the user; |
IMessageChannel.GetMessageAsync(UInt64, CacheMode, RequestOptions)
Gets a message from this message channel.
Declaration
Task<IMessage> IMessageChannel.GetMessageAsync(ulong id, CacheMode mode, RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| System.UInt64 | id | The snowflake identifier of the message. |
| CacheMode | mode | The CacheMode that determines whether the object should be fetched from cache. |
| 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; |
IMessageChannel.GetPinnedMessagesAsync(RequestOptions)
Gets a collection of pinned messages in this channel.
Declaration
Task<IReadOnlyCollection<IMessage>> IMessageChannel.GetPinnedMessagesAsync(RequestOptions options)
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<IMessage>> | A task that represents the asynchronous get operation for retrieving pinned messages in this channel. The task result contains a collection of messages found in the pinned messages. |
IMessageChannel.SendFileAsync(Stream, String, String, Boolean, Embed, RequestOptions, Boolean)
Sends a file to this message channel with an optional caption.
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 | The System.IO.Stream of the file to be sent. |
| System.String | filename | The name of the attachment. |
| System.String | text | The message to be sent. |
| System.Boolean | isTTS | Whether the message should be read aloud by Discord or not. |
| Embed | embed | |
| RequestOptions | options | The options to be used when sending the request. |
| System.Boolean | isSpoiler | Whether the message attachment should be hidden as a spoiler. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<IUserMessage> | A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message. |
Remarks
This method sends a file as if you are uploading an attachment directly from your Discord client.
IMessageChannel.SendFileAsync(String, String, Boolean, Embed, RequestOptions, Boolean)
Sends a file to this message channel with an optional caption.
Declaration
Task<IUserMessage> IMessageChannel.SendFileAsync(string filePath, string text, bool isTTS, Embed embed, RequestOptions options, bool isSpoiler)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | filePath | The file path of the file. |
| System.String | text | The message to be sent. |
| System.Boolean | isTTS | Whether the message should be read aloud by Discord or not. |
| Embed | embed | |
| RequestOptions | options | The options to be used when sending the request. |
| System.Boolean | isSpoiler | Whether the message attachment should be hidden as a spoiler. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<IUserMessage> | A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message. |
Remarks
This method sends a file as if you are uploading an attachment directly from your Discord client.
IMessageChannel.SendMessageAsync(String, Boolean, Embed, RequestOptions)
Sends a message to this message channel.
Declaration
Task<IUserMessage> IMessageChannel.SendMessageAsync(string text, bool isTTS, Embed embed, RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| System.String | text | The message to be sent. |
| System.Boolean | isTTS | Determines whether the message should be read aloud by Discord or not. |
| Embed | embed | |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<IUserMessage> | A task that represents an asynchronous send operation for delivering the message. The task result contains the sent message. |
INestedChannel.GetCategoryAsync(CacheMode, RequestOptions)
Gets the parent (category) channel of this channel.
Declaration
Task<ICategoryChannel> INestedChannel.GetCategoryAsync(CacheMode mode, RequestOptions options)
Parameters
| Type | Name | Description |
|---|---|---|
| CacheMode | mode | The CacheMode that determines whether the object should be fetched from cache. |
| RequestOptions | options | The options to be used when sending the request. |
Returns
| Type | Description |
|---|---|
| System.Threading.Tasks.Task<ICategoryChannel> | A task that represents the asynchronous get operation. The task result contains the category channel
representing the parent of this channel; |
ITextChannel.CreateWebhookAsync(String, Stream, RequestOptions)
Creates a webhook in this text channel.
Declaration
Task<IWebhook> ITextChannel.CreateWebhookAsync(string name, Stream avatar, RequestOptions options)
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. |
ITextChannel.GetWebhookAsync(UInt64, RequestOptions)
Gets a webhook available in this text channel.
Declaration
Task<IWebhook> ITextChannel.GetWebhookAsync(ulong id, RequestOptions options)
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; |
ITextChannel.GetWebhooksAsync(RequestOptions)
Gets the webhooks available in this text channel.
Declaration
Task<IReadOnlyCollection<IWebhook>> ITextChannel.GetWebhooksAsync(RequestOptions options)
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. |