Method SendMessageAsync
- Namespace
- DSharpPlus
- Assembly
- DSharpPlus.dll
SendMessageAsync(DiscordChannel, string)
Sends a message
public Task<DiscordMessage> SendMessageAsync(DiscordChannel channel, string content)
Parameters
channel
DiscordChannelChannel to send to.
content
stringMessage content to send.
Returns
- Task<DiscordMessage>
The Discord Message that was sent.
Exceptions
- UnauthorizedException
Thrown when the client does not have the SendMessages permission.
- 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(DiscordChannel, DiscordEmbed)
Sends a message
public Task<DiscordMessage> SendMessageAsync(DiscordChannel channel, DiscordEmbed embed)
Parameters
channel
DiscordChannelChannel to send to.
embed
DiscordEmbedEmbed to attach to the message.
Returns
- Task<DiscordMessage>
The Discord Message that was sent.
Exceptions
- UnauthorizedException
Thrown when the client does not have the SendMessages permission.
- 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(DiscordChannel, string, DiscordEmbed)
Sends a message
public Task<DiscordMessage> SendMessageAsync(DiscordChannel channel, string content, DiscordEmbed embed)
Parameters
channel
DiscordChannelChannel to send to.
content
stringMessage content to send.
embed
DiscordEmbedEmbed to attach to the message.
Returns
- Task<DiscordMessage>
The Discord Message that was sent.
Exceptions
- UnauthorizedException
Thrown when the client does not have the SendMessages permission.
- 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(DiscordChannel, DiscordMessageBuilder)
Sends a message
public Task<DiscordMessage> SendMessageAsync(DiscordChannel channel, DiscordMessageBuilder builder)
Parameters
channel
DiscordChannelChannel to send to.
builder
DiscordMessageBuilderThe Discord Message builder.
Returns
- Task<DiscordMessage>
The Discord Message that was sent.
Exceptions
- UnauthorizedException
Thrown when the client does not have the SendMessages permission if TTS is false 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(DiscordChannel, Action<DiscordMessageBuilder>)
Sends a message
public Task<DiscordMessage> SendMessageAsync(DiscordChannel channel, Action<DiscordMessageBuilder> action)
Parameters
channel
DiscordChannelChannel to send to.
action
Action<DiscordMessageBuilder>The Discord Message builder.
Returns
- Task<DiscordMessage>
The Discord Message that was sent.
Exceptions
- UnauthorizedException
Thrown when the client does not have the SendMessages permission if TTS is false 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.