Skip to content

Commit

Permalink
Make EditWebhookMessageBuilder.embeds a list of builders
Browse files Browse the repository at this point in the history
  • Loading branch information
DRSchlaubi committed Mar 26, 2021
1 parent 64c299d commit 4b90323
Showing 1 changed file with 4 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@ class EditWebhookMessageBuilder : RequestBuilder<WebhookEditMessageRequest> {
private var _content: Optional<String> = Optional.Missing()
var content: String? by ::_content.delegate()

var embeds: MutableList<EmbedRequest> = mutableListOf()
var embeds: MutableList<EmbedBuilder> = mutableListOf()

private var _allowedMentions: Optional<AllowedMentions> = Optional.Missing()
var allowedMentions: AllowedMentions? by ::_allowedMentions.delegate()
Expand All @@ -26,10 +26,10 @@ class EditWebhookMessageBuilder : RequestBuilder<WebhookEditMessageRequest> {
contract {
callsInPlace(builder, InvocationKind.EXACTLY_ONCE)
}
embeds.add(EmbedBuilder().apply(builder).toRequest())
embeds.add(EmbedBuilder().apply(builder))
}

override fun toRequest(): WebhookEditMessageRequest = WebhookEditMessageRequest(
_content, Optional.missingOnEmpty(embeds), _allowedMentions
_content, Optional.missingOnEmpty(embeds.map(EmbedBuilder::toRequest)), _allowedMentions
)
}
}

0 comments on commit 4b90323

Please sign in to comment.