Method SendMessageAsync
- Namespace
- DisCatSharp.Entities
- Assembly
- DisCatSharp.dll
SendMessageAsync(string, CancellationToken)
Sends a message to this channel.
public Task<DiscordMessage> SendMessageAsync(string content, CancellationToken cancellationToken = default)
Parameters
contentstringContent of the message to send.
cancellationTokenCancellationTokenA token to cancel the request.
Returns
- Task<DiscordMessage>
The sent message.
Exceptions
- UnauthorizedException
Thrown when the client does not have the SendMessages permission if TTS is true and SendTtsMessages if TTS is true.
- NotFoundException
Thrown when the channel does not exist.
- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.
SendMessageAsync(DiscordEmbed, CancellationToken)
Sends a message to this channel.
public Task<DiscordMessage> SendMessageAsync(DiscordEmbed embed, CancellationToken cancellationToken = default)
Parameters
embedDiscordEmbedEmbed to attach to the message.
cancellationTokenCancellationTokenA token to cancel the request.
Returns
- Task<DiscordMessage>
The sent message.
Exceptions
- UnauthorizedException
Thrown when the client does not have the SendMessages permission and SendTtsMessages if TTS is true.
- NotFoundException
Thrown when the channel does not exist.
- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.
SendMessageAsync(string, DiscordEmbed, CancellationToken)
Sends a message to this channel.
public Task<DiscordMessage> SendMessageAsync(string content, DiscordEmbed embed, CancellationToken cancellationToken = default)
Parameters
contentstringContent of the message to send.
embedDiscordEmbedEmbed to attach to the message.
cancellationTokenCancellationTokenA token to cancel the request.
Returns
- Task<DiscordMessage>
The sent message.
Exceptions
- UnauthorizedException
Thrown when the client does not have the SendMessages permission if TTS is true and SendTtsMessages if TTS is true.
- NotFoundException
Thrown when the channel does not exist.
- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.
SendMessageAsync(DiscordMessageBuilder, CancellationToken)
Sends a message to this channel.
public Task<DiscordMessage> SendMessageAsync(DiscordMessageBuilder builder, CancellationToken cancellationToken = default)
Parameters
builderDiscordMessageBuilderThe builder with all the items to send.
cancellationTokenCancellationTokenA token to cancel the request.
Returns
- Task<DiscordMessage>
The sent message.
Exceptions
- UnauthorizedException
Thrown when the client does not have the SendMessages permission TTS is true and SendTtsMessages if TTS is true.
- NotFoundException
Thrown when the channel does not exist.
- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.
SendMessageAsync(Action<DiscordMessageBuilder>, CancellationToken)
Sends a message to this channel.
public Task<DiscordMessage> SendMessageAsync(Action<DiscordMessageBuilder> action, CancellationToken cancellationToken = default)
Parameters
actionAction<DiscordMessageBuilder>The builder with all the items to send.
cancellationTokenCancellationTokenA token to cancel the request.
Returns
- Task<DiscordMessage>
The sent message.
Exceptions
- UnauthorizedException
Thrown when the client does not have the SendMessages permission TTS is true and SendTtsMessages if TTS is true.
- NotFoundException
Thrown when the channel does not exist.
- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.