Method SendMessageAsync
- Namespace
- DisCatSharp.Entities
- Assembly
- DisCatSharp.dll
SendMessageAsync(string)
Sends a direct message to this user. 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 user has the bot blocked, the member shares no guild with the bot, or if the member has Allow DM from server members off.
- NotFoundException
Thrown when the user 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 user. 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 user has the bot blocked, the member shares no guild with the bot, or if the member has Allow DM from server members off.
- NotFoundException
Thrown when the user 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 user. 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 user has the bot blocked, the member shares no guild with the bot, or if the member has Allow DM from server members off.
- NotFoundException
Thrown when the user 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 user. 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 user has the bot blocked, the member shares no guild with the bot, or if the member has Allow DM from server members off.
- NotFoundException
Thrown when the user does not exist.
- BadRequestException
Thrown when an invalid parameter was provided.
- ServerErrorException
Thrown when Discord is unable to process the request.