Skip to content

How to send Embed #939

Answered by lukellmann
N0m4n904 asked this question in Help
Apr 29, 2024 · 1 comments · 6 replies
Discussion options

You must be logged in to vote

With kord, you don't have to create builder instances yourself (i.e. calling the EmbedBuilder constructor in your case). Instead we have DSL-like functions.

Here you would call channel.createEmbed which takes a lambda which gets a EmbedBuilder passed as its receiver. So the final code would look something like this:

channel.createEmbed {
    color = TODO()
    description = "..."
    author {
        name = "..."
        url = "..."
        // ...
    }
    thumbnail {
        // ...
    }
    // ...
}

If you want to extract the logic of filling the embed out of the lambda, you can make use of extension functions:

fun EmbedBuilder.buildNormalEmbed(
    color: Color,
    description: String,…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@lukellmann
Comment options

@N0m4n904
Comment options

@N0m4n904
Comment options

@lukellmann
Comment options

@N0m4n904
Comment options

Answer selected by N0m4n904
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
2 participants