Compare commits

...

1 commit

Author SHA1 Message Date
3a4cb20c95 chore: progress commit
Signed-off-by: moonleay <contact@moonleay.net>
2023-10-19 16:42:07 +02:00
5 changed files with 116 additions and 5 deletions

View file

@ -110,6 +110,7 @@ object Bot {
add(::SendPlannerExtension) add(::SendPlannerExtension)
add(::MatchExtension) add(::MatchExtension)
add(::UpdateRolesExtension) add(::UpdateRolesExtension)
add(::RotationExtension)
} }
this.presence { this.presence {

View file

@ -22,7 +22,7 @@ import net.moonleay.lilJudd.data.api.entry.schedule.ModeData
import net.moonleay.lilJudd.util.TimeUtil import net.moonleay.lilJudd.util.TimeUtil
object Splatoon3Api { object Splatoon3Api {
private fun getRegularMode(timestamp: Long): ModeData { fun getRegularMode(timestamp: Long): ModeData {
Splatoon3ApiCache.cachedRegularModeData.map { modeData -> Splatoon3ApiCache.cachedRegularModeData.map { modeData ->
val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC") val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC")
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC") val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
@ -33,7 +33,7 @@ object Splatoon3Api {
throw Exception("No current mode found") throw Exception("No current mode found")
} }
private fun getOpenMode(timestamp: Long): ModeData { fun getOpenMode(timestamp: Long): ModeData {
Splatoon3ApiCache.cachedCompetitiveOpenModeData.map { modeData -> Splatoon3ApiCache.cachedCompetitiveOpenModeData.map { modeData ->
val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC") val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC")
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC") val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
@ -44,7 +44,7 @@ object Splatoon3Api {
throw Exception("No current mode found") throw Exception("No current mode found")
} }
private fun getXMode(timestamp: Long): ModeData { fun getXMode(timestamp: Long): ModeData {
Splatoon3ApiCache.cachedXModeData.map { modeData -> Splatoon3ApiCache.cachedXModeData.map { modeData ->
val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC") val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC")
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC") val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
@ -55,7 +55,7 @@ object Splatoon3Api {
throw Exception("No current mode found") throw Exception("No current mode found")
} }
private fun getSeriesMode(timestamp: Long): ModeData { fun getSeriesMode(timestamp: Long): ModeData {
Splatoon3ApiCache.cachedCompetitiveSeriesModeData.map { modeData -> Splatoon3ApiCache.cachedCompetitiveSeriesModeData.map { modeData ->
val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC") val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC")
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC") val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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<SplatoonOnlineMode> {
this.name = "mode"
this.description = "The mode you want to check the rotation for"
this.typeName = "en_US"
}
}
}

View file

@ -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 <https://www.gnu.org/licenses/>.
*/
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"),
}

View file

@ -16,7 +16,7 @@
* along with this program. If not, see <https://www.gnu.org/licenses/>. * along with this program. If not, see <https://www.gnu.org/licenses/>.
*/ */
package net.moonleay.botendo.build package net.moonleay.lilJudd.build
internal object BuildConstants { internal object BuildConstants {
const val version = "${version}" const val version = "${version}"