Table of Contents

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 string

Content 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 DiscordEmbed

Embed 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 string

Content of the message to send.

embed DiscordEmbed

Embed 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 DiscordMessageBuilder

Builder 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.