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 9c27e13ec6
commit 5431515976
Signed by: moonleay
GPG key ID: 82667543CCD715FB

View file

@ -71,11 +71,33 @@ object MessageUtil {
} }
} }
///Get a cloned embedded message, missing only the fields ///Get a cloned embedded message
fun getAClonedEmbedd(e: Embed): EmbedBuilder { fun getAClonedEmbed(e: Embed): EmbedBuilder {
val ebb = EmbedBuilder() val ebb = EmbedBuilder()
ebb.color = e.color ebb.color = e.color
ebb.title = e.title 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 ebb.description = e.description
return ebb return ebb
} }