diff --git a/backend/src/main/kotlin/net/perfectdreams/galleryofdreams/backend/config/GalleryOfDreamsConfig.kt b/backend/src/main/kotlin/net/perfectdreams/galleryofdreams/backend/config/GalleryOfDreamsConfig.kt index 1550a1c..04efe9f 100644 --- a/backend/src/main/kotlin/net/perfectdreams/galleryofdreams/backend/config/GalleryOfDreamsConfig.kt +++ b/backend/src/main/kotlin/net/perfectdreams/galleryofdreams/backend/config/GalleryOfDreamsConfig.kt @@ -9,8 +9,14 @@ data class GalleryOfDreamsConfig( ) { @Serializable data class DiscordConfig( - val token: String - ) + val token: String, + val channels: DiscordChannelsConfig + ) { + @Serializable + data class DiscordChannelsConfig( + val galleryLogId: Long + ) + } @Serializable data class EtherealGambiConfig( diff --git a/backend/src/main/kotlin/net/perfectdreams/galleryofdreams/backend/interactions/vanilla/GalleryOfDreamsCommand.kt b/backend/src/main/kotlin/net/perfectdreams/galleryofdreams/backend/interactions/vanilla/GalleryOfDreamsCommand.kt index a1f3f50..c62c039 100644 --- a/backend/src/main/kotlin/net/perfectdreams/galleryofdreams/backend/interactions/vanilla/GalleryOfDreamsCommand.kt +++ b/backend/src/main/kotlin/net/perfectdreams/galleryofdreams/backend/interactions/vanilla/GalleryOfDreamsCommand.kt @@ -5,6 +5,7 @@ import club.minnced.discord.webhook.send.WebhookMessageBuilder import dev.minn.jda.ktx.coroutines.await import dev.minn.jda.ktx.generics.getChannel import dev.minn.jda.ktx.messages.InlineMessage +import dev.minn.jda.ktx.messages.MessageCreate import dev.minn.jda.ktx.messages.MessageEdit import io.ktor.client.request.* import io.ktor.client.statement.* @@ -255,7 +256,6 @@ class GalleryOfDreamsCommand(val loritta: GalleryOfDreamsBackend) : SlashCommand fanArtArtist } - if (fanArtArtist == null) { it.reply(true) { styled( @@ -321,19 +321,17 @@ class GalleryOfDreamsCommand(val loritta: GalleryOfDreamsBackend) : SlashCommand } GlobalScope.launch { - if (matchedFanArtArtist != null) { - loritta.webhookClient?.send( - WebhookMessageBuilder() - .setContent("<:gabriela_brush:727259143903248486> **Fan Art adicionada!** (<@${artistId}>) $newFanArtUrl") - .build() - ) - } else { - loritta.webhookClient?.send( - WebhookMessageBuilder() - .setContent("<:gabriela_brush:727259143903248486> **Artista e Fan Art adicionadas!** (<@${artistId}>) $newFanArtUrl") - .build() - ) - } + val galleryLogChannel = user.jda.getTextChannelById(loritta.config.discord.channels.galleryLogId) + + galleryLogChannel?.sendMessage( + MessageCreate { + if (matchedFanArtArtist != null) { + content = "<:gabriela_brush:727259143903248486> **Fan Art adicionada!** (<@${artistId}>) $newFanArtUrl" + } else { + content = "<:gabriela_brush:727259143903248486> **Artista e Fan Art adicionadas!** (<@${artistId}>) $newFanArtUrl" + } + } + )?.await() } } UploadFileResponse.FileAlreadyExists -> {