diff --git a/CHANGELOG.md b/CHANGELOG.md index 20c8afec5c1..0eab6e3dcd4 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -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 diff --git a/rest/src/main/kotlin/com/gitlab/kordlib/rest/builder/message/MessageCreateBuilder.kt b/rest/src/main/kotlin/com/gitlab/kordlib/rest/builder/message/MessageCreateBuilder.kt index b7074c37892..226ead7aa9e 100644 --- a/rest/src/main/kotlin/com/gitlab/kordlib/rest/builder/message/MessageCreateBuilder.kt +++ b/rest/src/main/kotlin/com/gitlab/kordlib/rest/builder/message/MessageCreateBuilder.kt @@ -33,6 +33,15 @@ class MessageCreateBuilder : RequestBuilder { 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