From 67edbae7be339559a9360edb893682c06fa8ddfd Mon Sep 17 00:00:00 2001 From: Asoji Date: Mon, 9 Sep 2024 07:58:18 -0700 Subject: [PATCH] =?UTF-8?q?=E2=9C=A8=20added=20heartbeat?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/main/kotlin/one/devos/yiski/Yiski.kt | 20 +++++++++++++++++++ .../kotlin/one/devos/yiski/audio/Audio.kt | 8 +++++++- 2 files changed, 27 insertions(+), 1 deletion(-) diff --git a/src/main/kotlin/one/devos/yiski/Yiski.kt b/src/main/kotlin/one/devos/yiski/Yiski.kt index 47272b5..28059d3 100644 --- a/src/main/kotlin/one/devos/yiski/Yiski.kt +++ b/src/main/kotlin/one/devos/yiski/Yiski.kt @@ -5,6 +5,11 @@ import dev.minn.jda.ktx.events.listener import dev.minn.jda.ktx.generics.getChannel import dev.minn.jda.ktx.jdabuilder.default import dev.minn.jda.ktx.jdabuilder.intents +import io.ktor.server.application.* +import io.ktor.server.cio.* +import io.ktor.server.engine.* +import io.ktor.server.response.* +import io.ktor.server.routing.* import kotlinx.coroutines.runBlocking import net.dv8tion.jda.api.JDA import net.dv8tion.jda.api.entities.Activity @@ -140,6 +145,9 @@ object Yiski { } } } + + io.ktor.server.engine.embeddedServer(CIO, port = 8080, host = "0.0.0.0", module = Application::module) + .start(wait = true) } private fun listenAviationEvents() { @@ -151,4 +159,16 @@ object Yiski { logger.error("[Command Execution] A command has failed. ", this.error) } } +} + +fun Application.module() { + configureRouting() +} + +fun Application.configureRouting() { + routing { + get("/heartbeat") { + call.respondText("howdy") + } + } } \ No newline at end of file diff --git a/src/main/kotlin/one/devos/yiski/audio/Audio.kt b/src/main/kotlin/one/devos/yiski/audio/Audio.kt index f327cf9..f3ec47b 100644 --- a/src/main/kotlin/one/devos/yiski/audio/Audio.kt +++ b/src/main/kotlin/one/devos/yiski/audio/Audio.kt @@ -7,6 +7,7 @@ import com.sedmelluq.discord.lavaplayer.source.AudioSourceManagers import com.sedmelluq.discord.lavaplayer.tools.FriendlyException import com.sedmelluq.discord.lavaplayer.track.AudioPlaylist import com.sedmelluq.discord.lavaplayer.track.AudioTrack +import net.dv8tion.jda.api.audio.SpeakingMode import net.dv8tion.jda.api.audio.hooks.ConnectionListener import net.dv8tion.jda.api.audio.hooks.ConnectionStatus import net.dv8tion.jda.api.entities.Guild @@ -17,6 +18,7 @@ import net.dv8tion.jda.api.managers.AudioManager import one.devos.yiski.Yiski import one.devos.yiski.audio.lavaplayer.ByteAudioSourceManager import one.devos.yiski.tiktok.Voices +import java.util.* object Audio { /** @@ -72,7 +74,11 @@ object Audio { } } - override fun onUserSpeaking(user: User, speaking: Boolean) { +// override fun onUserSpeaking(user: User, speaking: Boolean) { +// +// } + + override fun onUserSpeakingModeUpdate(user: User, modes: EnumSet) { } }