Skip to content

Commit

Permalink
Re-add allowedMentions DSL
Browse files Browse the repository at this point in the history
  • Loading branch information
BartArys committed Jul 8, 2020
1 parent 2b48992 commit 7ac384b
Show file tree
Hide file tree
Showing 2 changed files with 11 additions and 1 deletion.
3 changes: 2 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,8 @@

## Additions

* Added `BanAddEvent#getBan` to get the full ban object.
* Added `BanAddEvent#getBan` to get the full ban object.
* Re-added `MessageCreateBuilder#allowedMentions` after removal in 0.5.0.

# 0.5.6

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,15 @@ class MessageCreateBuilder : RequestBuilder<MultipartMessageCreateRequest> {
addFile(path.fileName.toString(), Files.newInputStream(path))
}

/**
* Configures the mentions that should trigger a ping. Not calling this function will result in the default behavior
* (ping everything), calling this function but not configuring it before the request is build will result in all
* pings being ignored.
*/
inline fun allowedMentions(block: AllowedMentionsBuilder.() -> Unit = {}) {
allowedMentions = (allowedMentions ?: AllowedMentionsBuilder()).apply(block)
}

override fun toRequest(): MultipartMessageCreateRequest = MultipartMessageCreateRequest(
MessageCreateRequest(content, nonce, tts, embed?.toRequest(), allowedMentions?.build()),
files
Expand Down

0 comments on commit 7ac384b

Please sign in to comment.