feat: improved getAClonedEmbed function, added an equivalent using a EmbedBuilder

Signed-off-by: moonleay <contact@moonleay.net>
This commit is contained in:
moonleay 2023-09-11 12:44:34 +02:00
parent 883940c8fd
commit 165e1d342c

View file

@ -71,11 +71,33 @@ object MessageUtil {
}
}
///Get a cloned embedded message, missing only the fields
fun getAClonedEmbedd(e: Embed): EmbedBuilder {
///Get a cloned embedded message
fun getAClonedEmbed(e: Embed): EmbedBuilder {
val ebb = EmbedBuilder()
ebb.color = e.color
ebb.title = e.title
e.fields.forEach {
val fb = EmbedBuilder.Field()
fb.name = it.name
fb.value = it.value
fb.inline = it.inline
ebb.fields.add(fb)
}
ebb.description = e.description
return ebb
}
fun getAClonedEmbed(e: EmbedBuilder): EmbedBuilder {
val ebb = EmbedBuilder()
ebb.color = e.color
ebb.title = e.title
e.fields.forEach {
val fb = EmbedBuilder.Field()
fb.name = it.name
fb.value = it.value
fb.inline = it.inline
ebb.fields.add(fb)
}
ebb.description = e.description
return ebb
}