feat: make embed helper functions use EmbedColor instead of color

Signed-off-by: moonleay <contact@moonleay.net>
This commit is contained in:
moonleay 2023-09-14 12:34:27 +02:00
parent dcdb5c6e56
commit 8d14597a38

View file

@ -22,7 +22,6 @@ import com.kotlindiscord.kord.extensions.commands.Arguments
import com.kotlindiscord.kord.extensions.commands.application.slash.PublicSlashCommandContext import com.kotlindiscord.kord.extensions.commands.application.slash.PublicSlashCommandContext
import com.kotlindiscord.kord.extensions.components.forms.ModalForm import com.kotlindiscord.kord.extensions.components.forms.ModalForm
import com.kotlindiscord.kord.extensions.types.respond import com.kotlindiscord.kord.extensions.types.respond
import dev.kord.common.Color
import dev.kord.core.entity.Embed import dev.kord.core.entity.Embed
import dev.kord.rest.builder.message.EmbedBuilder import dev.kord.rest.builder.message.EmbedBuilder
import java.time.LocalDateTime import java.time.LocalDateTime
@ -34,7 +33,7 @@ object MessageUtil {
///Send an embedded message as a reply ///Send an embedded message as a reply
suspend fun sendEmbedForPublicSlashCommand( suspend fun sendEmbedForPublicSlashCommand(
ctx: PublicSlashCommandContext<Arguments, ModalForm>, ctx: PublicSlashCommandContext<Arguments, ModalForm>,
color: Color, color: EmbedColor,
title: String, title: String,
description: String description: String
) { ) {
@ -53,7 +52,7 @@ object MessageUtil {
///Send an embedded message with an image as a reply ///Send an embedded message with an image as a reply
suspend fun sendEmbedForPublicSlashCommandWithImage( suspend fun sendEmbedForPublicSlashCommandWithImage(
ctx: PublicSlashCommandContext<Arguments, ModalForm>, ctx: PublicSlashCommandContext<Arguments, ModalForm>,
color: Color, color: EmbedColor,
title: String, title: String,
description: String, description: String,
thumbnailUrl: String thumbnailUrl: String
@ -103,7 +102,7 @@ object MessageUtil {
} }
fun getEmbedWithTableWithFooter( fun getEmbedWithTableWithFooter(
color: Color, color: EmbedColor,
title: String, title: String,
description: String, description: String,
values: Map<String, List<String>>?, values: Map<String, List<String>>?,
@ -117,7 +116,7 @@ object MessageUtil {
///Get an embedded msg with image, title and description ///Get an embedded msg with image, title and description
fun getEmbedWithTable( fun getEmbedWithTable(
color: Color, color: EmbedColor,
title: String, title: String,
description: String, description: String,
values: Map<String, List<String>>? values: Map<String, List<String>>?
@ -140,20 +139,20 @@ object MessageUtil {
///Get an embedded msg with title and description ///Get an embedded msg with title and description
fun getEmbedSmall( fun getEmbedSmall(
color: Color, color: EmbedColor,
title: String, title: String,
description: String description: String
): EmbedBuilder { ): EmbedBuilder {
val ebb = EmbedBuilder() val ebb = EmbedBuilder()
ebb.title = title ebb.title = title
ebb.description = description ebb.description = description
ebb.color = color ebb.color = color.color
return ebb return ebb
} }
///Get an embedded msg with title, description and a src ///Get an embedded msg with title, description and a src
fun getEmbed( fun getEmbed(
color: Color, color: EmbedColor,
title: String, title: String,
description: String, description: String,
source: String source: String
@ -167,7 +166,7 @@ object MessageUtil {
///Get an embedded msg with image, title, description and a src ///Get an embedded msg with image, title, description and a src
fun getEmbedWithImage( fun getEmbedWithImage(
color: Color, color: EmbedColor,
title: String, title: String,
description: String, description: String,
source: String, source: String,