Table of Contents

Method ModifyAsync

Namespace
DSharpPlus.Entities
Assembly
DSharpPlus.dll

ModifyAsync(Optional<string>)

Edits the message.

public Task<DiscordMessage> ModifyAsync(Optional<string> content)

Parameters

content Optional<string>

New content.

Returns

Task<DiscordMessage>

Exceptions

UnauthorizedException

Thrown when the client tried to modify a message not sent by them.

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.

ModifyAsync(Optional<DiscordEmbed>)

Edits the message.

public Task<DiscordMessage> ModifyAsync(Optional<DiscordEmbed> embed = default)

Parameters

embed Optional<DiscordEmbed>

New embed.

Returns

Task<DiscordMessage>

Exceptions

UnauthorizedException

Thrown when the client tried to modify a message not sent by them.

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.

ModifyAsync(Optional<string>, Optional<DiscordEmbed>)

Edits the message.

public Task<DiscordMessage> ModifyAsync(Optional<string> content, Optional<DiscordEmbed> embed = default)

Parameters

content Optional<string>

New content.

embed Optional<DiscordEmbed>

New embed.

Returns

Task<DiscordMessage>

Exceptions

UnauthorizedException

Thrown when the client tried to modify a message not sent by them.

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.

ModifyAsync(Optional<string>, Optional<IEnumerable<DiscordEmbed>>)

Edits the message.

public Task<DiscordMessage> ModifyAsync(Optional<string> content, Optional<IEnumerable<DiscordEmbed>> embeds = default)

Parameters

content Optional<string>

New content.

embeds Optional<IEnumerable<DiscordEmbed>>

New embeds.

Returns

Task<DiscordMessage>

Exceptions

UnauthorizedException

Thrown when the client tried to modify a message not sent by them.

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.

ModifyAsync(DiscordMessageBuilder, bool, IEnumerable<DiscordAttachment>?)

Edits the message.

public Task<DiscordMessage> ModifyAsync(DiscordMessageBuilder builder, bool suppressEmbeds = false, IEnumerable<DiscordAttachment>? attachments = null)

Parameters

builder DiscordMessageBuilder

The builder of the message to edit.

suppressEmbeds bool

Whether to suppress embeds on the message.

attachments IEnumerable<DiscordAttachment>

Attached files to keep.

Returns

Task<DiscordMessage>

Exceptions

UnauthorizedException

Thrown when the client tried to modify a message not sent by them.

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.

ModifyAsync(Action<DiscordMessageBuilder>, bool, IEnumerable<DiscordAttachment>?)

Edits the message.

public Task<DiscordMessage> ModifyAsync(Action<DiscordMessageBuilder> action, bool suppressEmbeds = false, IEnumerable<DiscordAttachment>? attachments = null)

Parameters

action Action<DiscordMessageBuilder>

The builder of the message to edit.

suppressEmbeds bool

Whether to suppress embeds on the message.

attachments IEnumerable<DiscordAttachment>

Attached files to keep.

Returns

Task<DiscordMessage>

Exceptions

UnauthorizedException

Thrown when the client tried to modify a message not sent by them.

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.