How to send Embed #939
-
Hi, I have this EmbedBuilder:
How do I send this now to a specific channel? Or am I doing it completely wrong? The documentation is not helping here. With Discord4j I am doing it like this:
But I can't seem to get it to work on Kord. |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 6 replies
-
With kord, you don't have to create builder instances yourself (i.e. calling the Here you would call 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,
// ...
) {
this.color = color
this.description = description
author {
// ...
}
thumbnail {
// ...
}
}
// ...
channel.createEmbed {
buildNormalEmbed(...)
} |
Beta Was this translation helpful? Give feedback.
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 aEmbedBuilder
passed as its receiver. So the final code would look something like this:If you want to extract the logic of filling the embed out of the lambda, you can make use of extension functions: