From 3a4cb20c957032e149d984afa43edaf819919d2a Mon Sep 17 00:00:00 2001 From: moonleay Date: Thu, 19 Oct 2023 16:42:07 +0200 Subject: [PATCH] chore: progress commit Signed-off-by: moonleay --- src/main/kotlin/net/moonleay/lilJudd/Bot.kt | 1 + .../moonleay/lilJudd/data/api/Splatoon3Api.kt | 8 +- .../lilJudd/extensions/RotationExtension.kt | 80 +++++++++++++++++++ .../component/SplatoonOnlineMode.kt | 30 +++++++ .../moonleay/lilJudd/build/BuildConstants.kt | 2 +- 5 files changed, 116 insertions(+), 5 deletions(-) create mode 100644 src/main/kotlin/net/moonleay/lilJudd/extensions/RotationExtension.kt create mode 100644 src/main/kotlin/net/moonleay/lilJudd/extensions/component/SplatoonOnlineMode.kt diff --git a/src/main/kotlin/net/moonleay/lilJudd/Bot.kt b/src/main/kotlin/net/moonleay/lilJudd/Bot.kt index 6a5bf7b..d38c329 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/Bot.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/Bot.kt @@ -110,6 +110,7 @@ object Bot { add(::SendPlannerExtension) add(::MatchExtension) add(::UpdateRolesExtension) + add(::RotationExtension) } this.presence { diff --git a/src/main/kotlin/net/moonleay/lilJudd/data/api/Splatoon3Api.kt b/src/main/kotlin/net/moonleay/lilJudd/data/api/Splatoon3Api.kt index b0192e5..968ce22 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/data/api/Splatoon3Api.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/data/api/Splatoon3Api.kt @@ -22,7 +22,7 @@ import net.moonleay.lilJudd.data.api.entry.schedule.ModeData import net.moonleay.lilJudd.util.TimeUtil object Splatoon3Api { - private fun getRegularMode(timestamp: Long): ModeData { + fun getRegularMode(timestamp: Long): ModeData { Splatoon3ApiCache.cachedRegularModeData.map { modeData -> val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC") val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC") @@ -33,7 +33,7 @@ object Splatoon3Api { throw Exception("No current mode found") } - private fun getOpenMode(timestamp: Long): ModeData { + fun getOpenMode(timestamp: Long): ModeData { Splatoon3ApiCache.cachedCompetitiveOpenModeData.map { modeData -> val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC") val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC") @@ -44,7 +44,7 @@ object Splatoon3Api { throw Exception("No current mode found") } - private fun getXMode(timestamp: Long): ModeData { + fun getXMode(timestamp: Long): ModeData { Splatoon3ApiCache.cachedXModeData.map { modeData -> val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC") val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC") @@ -55,7 +55,7 @@ object Splatoon3Api { throw Exception("No current mode found") } - private fun getSeriesMode(timestamp: Long): ModeData { + fun getSeriesMode(timestamp: Long): ModeData { Splatoon3ApiCache.cachedCompetitiveSeriesModeData.map { modeData -> val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC") val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC") diff --git a/src/main/kotlin/net/moonleay/lilJudd/extensions/RotationExtension.kt b/src/main/kotlin/net/moonleay/lilJudd/extensions/RotationExtension.kt new file mode 100644 index 0000000..4185fd3 --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/extensions/RotationExtension.kt @@ -0,0 +1,80 @@ +/* + * lilJudd + * Copyright (C) 2023 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.extensions + +import com.kotlindiscord.kord.extensions.commands.Arguments +import com.kotlindiscord.kord.extensions.commands.application.slash.converters.impl.enumChoice +import com.kotlindiscord.kord.extensions.extensions.Extension +import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand +import net.moonleay.lilJudd.extensions.component.SplatoonOnlineMode +import net.moonleay.lilJudd.util.Logger + +class RotationExtension : Extension() { + + override val name = "rotation" + override val allowApplicationCommandInDMs: Boolean + get() = false + + + override suspend fun setup() { + publicSlashCommand(::RotationArguments) { + name = "rotation" + description = "Check the current rotations" + this.action { + val mode = this.arguments.mode + when (mode) { + SplatoonOnlineMode.ALL -> { + + } + + SplatoonOnlineMode.REGULAR -> { + + } + + SplatoonOnlineMode.SERIES -> { + + } + + SplatoonOnlineMode.OPEN -> { + + } + + SplatoonOnlineMode.X -> { + + } + + SplatoonOnlineMode.SALMON_RUN -> { + + } + } + + Logger.out("Done") + } + } + } + + inner class RotationArguments : Arguments() { + + val mode by enumChoice { + this.name = "mode" + this.description = "The mode you want to check the rotation for" + this.typeName = "en_US" + } + } +} diff --git a/src/main/kotlin/net/moonleay/lilJudd/extensions/component/SplatoonOnlineMode.kt b/src/main/kotlin/net/moonleay/lilJudd/extensions/component/SplatoonOnlineMode.kt new file mode 100644 index 0000000..866c91a --- /dev/null +++ b/src/main/kotlin/net/moonleay/lilJudd/extensions/component/SplatoonOnlineMode.kt @@ -0,0 +1,30 @@ +/* + * lilJudd + * Copyright (C) 2023 moonleay + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU General Public License as published by + * the Free Software Foundation, either version 3 of the License, or + * (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU General Public License for more details. + * + * You should have received a copy of the GNU General Public License + * along with this program. If not, see . + */ + +package net.moonleay.lilJudd.extensions.component + +import com.kotlindiscord.kord.extensions.commands.application.slash.converters.ChoiceEnum + +enum class SplatoonOnlineMode(override val readableName: String) : ChoiceEnum { + ALL("All Modes"), + REGULAR("Regular Battle"), + SERIES("Ranked Battle (Series)"), + OPEN("Ranked Battle (Open)"), + X("X Battle"), + SALMON_RUN("Salmon Run"), +} diff --git a/src/main/templates/net/moonleay/lilJudd/build/BuildConstants.kt b/src/main/templates/net/moonleay/lilJudd/build/BuildConstants.kt index fdcf269..fa84c6d 100644 --- a/src/main/templates/net/moonleay/lilJudd/build/BuildConstants.kt +++ b/src/main/templates/net/moonleay/lilJudd/build/BuildConstants.kt @@ -16,7 +16,7 @@ * along with this program. If not, see . */ -package net.moonleay.botendo.build +package net.moonleay.lilJudd.build internal object BuildConstants { const val version = "${version}"