Method SendMessageAsync
- Namespace
- DSharpPlus.Entities
- Assembly
- DSharpPlus.dll
SendMessageAsync(string)
Sends a direct message to this member. Creates a direct message channel if one does not exist already.
public Task<DiscordMessage> SendMessageAsync(string content)
Parameters
content
stringContent of the message to send.
Returns
- Task<DiscordMessage>
The sent message.
Exceptions
- UnauthorizedException
Thrown when the member has the bot blocked, the member does not share a guild with the bot and does not have the user app installed, or if the member has Allow DM from server members off.
- NotFoundException
Thrown when the member does not exist.
- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.
SendMessageAsync(DiscordEmbed)
Sends a direct message to this member. Creates a direct message channel if one does not exist already.
public Task<DiscordMessage> SendMessageAsync(DiscordEmbed embed)
Parameters
embed
DiscordEmbedEmbed to attach to the message.
Returns
- Task<DiscordMessage>
The sent message.
Exceptions
- UnauthorizedException
Thrown when the member has the bot blocked, the member does not share a guild with the bot and does not have the user app installed, or if the member has Allow DM from server members off.
- NotFoundException
Thrown when the member does not exist.
- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.
SendMessageAsync(string, DiscordEmbed)
Sends a direct message to this member. Creates a direct message channel if one does not exist already.
public Task<DiscordMessage> SendMessageAsync(string content, DiscordEmbed embed)
Parameters
content
stringContent of the message to send.
embed
DiscordEmbedEmbed to attach to the message.
Returns
- Task<DiscordMessage>
The sent message.
Exceptions
- UnauthorizedException
Thrown when the member has the bot blocked, the member does not share a guild with the bot and does not have the user app installed, or if the member has Allow DM from server members off.
- NotFoundException
Thrown when the member does not exist.
- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.
SendMessageAsync(DiscordMessageBuilder)
Sends a direct message to this member. Creates a direct message channel if one does not exist already.
public Task<DiscordMessage> SendMessageAsync(DiscordMessageBuilder message)
Parameters
message
DiscordMessageBuilderBuilder to with the message.
Returns
- Task<DiscordMessage>
The sent message.
Exceptions
- UnauthorizedException
Thrown when the member has the bot blocked, the member does not share a guild with the bot and does not have the user app installed, or if the member has Allow DM from server members off.
- NotFoundException
Thrown when the member does not exist.
- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.