Compare commits
No commits in common. "8612ef92a72ff31a06d7b0c7a0422e1171db8aed" and "38d61ae8625a8900077c9b600b3e4734dfbf3545" have entirely different histories.
8612ef92a7
...
38d61ae862
47 changed files with 106 additions and 626 deletions
|
@ -33,7 +33,7 @@ val ownerID = 372703841151614976L
|
||||||
group = "net.moonleay.liljudd"
|
group = "net.moonleay.liljudd"
|
||||||
version = System.getenv("CI_COMMIT_TAG")?.let { "$it-${System.getenv("CI_COMMIT_SHORT_SHA")}-prod" }
|
version = System.getenv("CI_COMMIT_TAG")?.let { "$it-${System.getenv("CI_COMMIT_SHORT_SHA")}-prod" }
|
||||||
?: System.getenv("CI_COMMIT_SHORT_SHA")?.let { "$it-dev" }
|
?: System.getenv("CI_COMMIT_SHORT_SHA")?.let { "$it-dev" }
|
||||||
?: "2.7.0"
|
?: "2.6.8"
|
||||||
|
|
||||||
val kordver = "1.7.1-SNAPSHOT"
|
val kordver = "1.7.1-SNAPSHOT"
|
||||||
val coroutinesver = "1.7.3"
|
val coroutinesver = "1.7.3"
|
||||||
|
|
|
@ -113,7 +113,6 @@ object Bot {
|
||||||
add(::SendPlannerExtension)
|
add(::SendPlannerExtension)
|
||||||
add(::MatchExtension)
|
add(::MatchExtension)
|
||||||
add(::UpdateRolesExtension)
|
add(::UpdateRolesExtension)
|
||||||
add(::RotationExtension)
|
|
||||||
}
|
}
|
||||||
|
|
||||||
this.presence {
|
this.presence {
|
||||||
|
|
|
@ -34,7 +34,7 @@ import net.moonleay.lilJudd.util.EmbedUtil
|
||||||
import net.moonleay.lilJudd.util.Logger
|
import net.moonleay.lilJudd.util.Logger
|
||||||
import net.moonleay.lilJudd.util.MessageUtil
|
import net.moonleay.lilJudd.util.MessageUtil
|
||||||
|
|
||||||
class AcceptEditButton : IEditButton {
|
class AcceptEditButton() : IEditButton {
|
||||||
override val id: String = "public.edit.btn.matchmanagement.accept"
|
override val id: String = "public.edit.btn.matchmanagement.accept"
|
||||||
|
|
||||||
override suspend fun onInteraction(
|
override suspend fun onInteraction(
|
||||||
|
@ -60,7 +60,7 @@ class AcceptEditButton : IEditButton {
|
||||||
Logger.out("role is null")
|
Logger.out("role is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val member = interaction.user.asMember(guild.id)
|
val member = interaction.user.asMember(guild.id) ?: return
|
||||||
// do the checks and update
|
// do the checks and update
|
||||||
if (m.embeds[0].fields[0].value.contains(user.id.value.toString())) {
|
if (m.embeds[0].fields[0].value.contains(user.id.value.toString())) {
|
||||||
if (member.roleIds.contains(Snowflake(mpdd.roleID))) {
|
if (member.roleIds.contains(Snowflake(mpdd.roleID))) {
|
||||||
|
|
|
@ -60,7 +60,7 @@ class DeclineEditButton : IEditButton {
|
||||||
Logger.out("role is null")
|
Logger.out("role is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val member = interaction.user.asMember(guild.id)
|
val member = interaction.user.asMember(guild.id) ?: return
|
||||||
if (m.embeds[0].fields[0].value.contains(user.id.value.toString())) {
|
if (m.embeds[0].fields[0].value.contains(user.id.value.toString())) {
|
||||||
if (member.roleIds.contains(Snowflake(mpdd.roleID))) {
|
if (member.roleIds.contains(Snowflake(mpdd.roleID))) {
|
||||||
Logger.out("Removing role from ${member.username}")
|
Logger.out("Removing role from ${member.username}")
|
||||||
|
|
|
@ -25,7 +25,7 @@ import net.moonleay.liljudd.build.BuildConstants
|
||||||
|
|
||||||
object Splatoon3Api {
|
object Splatoon3Api {
|
||||||
|
|
||||||
var schedules: Schedules? = null
|
var schedules: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Schedules? = null
|
||||||
|
|
||||||
fun updateSchedule() {
|
fun updateSchedule() {
|
||||||
val response = NetUtil.GETJsonData("https://splatoon3.ink/data/schedules.json", "lilJudd/${BuildConstants.version}")
|
val response = NetUtil.GETJsonData("https://splatoon3.ink/data/schedules.json", "lilJudd/${BuildConstants.version}")
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* lilJudd
|
* lilJudd
|
||||||
* Copyright (C) 2024 moonleay
|
* Copyright (C) 2023 moonleay
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -20,12 +20,11 @@ package net.moonleay.lilJudd.data.api.splatoon3ink
|
||||||
|
|
||||||
import net.moonleay.lilJudd.data.api.splatoon3ink.schedules.BankaraNode
|
import net.moonleay.lilJudd.data.api.splatoon3ink.schedules.BankaraNode
|
||||||
import net.moonleay.lilJudd.data.api.splatoon3ink.schedules.RegularNode
|
import net.moonleay.lilJudd.data.api.splatoon3ink.schedules.RegularNode
|
||||||
import net.moonleay.lilJudd.data.api.splatoon3ink.schedules.SalmonRunNode
|
|
||||||
import net.moonleay.lilJudd.data.api.splatoon3ink.schedules.XNode
|
import net.moonleay.lilJudd.data.api.splatoon3ink.schedules.XNode
|
||||||
import net.moonleay.lilJudd.util.TimeUtil
|
import net.moonleay.lilJudd.util.TimeUtil
|
||||||
|
|
||||||
object Splatoon3ApiDataGrabber {
|
object Splatoon3ApiDataGrabber {
|
||||||
fun getRegularMode(timestamp: Long): RegularNode {
|
private fun getRegularMode(timestamp: Long): net.moonleay.lilJudd.data.api.splatoon3ink.schedules.RegularNode {
|
||||||
Splatoon3Api.schedules!!.data.regularSchedules.nodes.map { modeData ->
|
Splatoon3Api.schedules!!.data.regularSchedules.nodes.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")
|
||||||
|
@ -36,7 +35,7 @@ object Splatoon3ApiDataGrabber {
|
||||||
throw Exception("No current mode found")
|
throw Exception("No current mode found")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getOpenMode(timestamp: Long): BankaraNode {
|
private fun getOpenMode(timestamp: Long): net.moonleay.lilJudd.data.api.splatoon3ink.schedules.BankaraNode {
|
||||||
Splatoon3Api.schedules!!.data.bankaraSchedules.nodes.map { modeData ->
|
Splatoon3Api.schedules!!.data.bankaraSchedules.nodes.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")
|
||||||
|
@ -50,7 +49,7 @@ object Splatoon3ApiDataGrabber {
|
||||||
throw Exception("No current mode found")
|
throw Exception("No current mode found")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getXMode(timestamp: Long): XNode {
|
private fun getXMode(timestamp: Long): net.moonleay.lilJudd.data.api.splatoon3ink.schedules.XNode {
|
||||||
Splatoon3Api.schedules!!.data.xSchedules.nodes.map { modeData ->
|
Splatoon3Api.schedules!!.data.xSchedules.nodes.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")
|
||||||
|
@ -61,7 +60,7 @@ object Splatoon3ApiDataGrabber {
|
||||||
throw Exception("No current mode found")
|
throw Exception("No current mode found")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getSeriesMode(timestamp: Long): BankaraNode {
|
private fun getSeriesMode(timestamp: Long): net.moonleay.lilJudd.data.api.splatoon3ink.schedules.BankaraNode {
|
||||||
Splatoon3Api.schedules!!.data.bankaraSchedules.nodes.map { modeData ->
|
Splatoon3Api.schedules!!.data.bankaraSchedules.nodes.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")
|
||||||
|
@ -75,16 +74,6 @@ object Splatoon3ApiDataGrabber {
|
||||||
throw Exception("No current mode found")
|
throw Exception("No current mode found")
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getSalmonRun(timestamp: Long): SalmonRunNode {
|
|
||||||
Splatoon3Api.schedules!!.data.coopGroupingSchedule.regularSchedules.nodes.map { modeData ->
|
|
||||||
val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC")
|
|
||||||
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
|
||||||
if (timestamp in startTime..endTime) {
|
|
||||||
return modeData
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw Exception("No current mode found")
|
|
||||||
}
|
|
||||||
fun getRotationTime(timestamp: Long): String {
|
fun getRotationTime(timestamp: Long): String {
|
||||||
val modeData = getRegularMode(timestamp)
|
val modeData = getRegularMode(timestamp)
|
||||||
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
||||||
|
|
|
@ -31,7 +31,7 @@ data class BankaraMatchSetting(
|
||||||
@SerialName("__typename")
|
@SerialName("__typename")
|
||||||
val typename: String,
|
val typename: String,
|
||||||
@SerialName("vsRule")
|
@SerialName("vsRule")
|
||||||
val vsRule: VsRule,
|
val vsRule: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsRule,
|
||||||
@SerialName("vsStages")
|
@SerialName("vsStages")
|
||||||
val vsStages: List<VsStage>
|
val vsStages: List<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsStage>
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,11 +25,11 @@ import kotlinx.serialization.Serializable
|
||||||
@Serializable
|
@Serializable
|
||||||
data class BankaraNode(
|
data class BankaraNode(
|
||||||
@SerialName("bankaraMatchSettings")
|
@SerialName("bankaraMatchSettings")
|
||||||
val bankaraMatchSettings: List<BankaraMatchSetting>?,
|
val bankaraMatchSettings: List<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.BankaraMatchSetting>?,
|
||||||
@SerialName("endTime")
|
@SerialName("endTime")
|
||||||
val endTime: String,
|
val endTime: String,
|
||||||
@SerialName("festMatchSettings")
|
@SerialName("festMatchSettings")
|
||||||
val festMatchSettings: List<FestMatchSettingX>?,
|
val festMatchSettings: List<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.FestMatchSettingX>?,
|
||||||
@SerialName("startTime")
|
@SerialName("startTime")
|
||||||
val startTime: String
|
val startTime: String
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,5 +25,5 @@ import kotlinx.serialization.Serializable
|
||||||
@Serializable
|
@Serializable
|
||||||
data class BankaraSchedules(
|
data class BankaraSchedules(
|
||||||
@SerialName("nodes")
|
@SerialName("nodes")
|
||||||
val nodes: List<BankaraNode>
|
val nodes: List<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.BankaraNode>
|
||||||
)
|
)
|
||||||
|
|
|
@ -23,11 +23,11 @@ import kotlinx.serialization.SerialName
|
||||||
import kotlinx.serialization.Serializable
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
@Serializable
|
@Serializable
|
||||||
data class SalmonRunNode(
|
data class BigRunScheduleNode(
|
||||||
@SerialName("endTime")
|
@SerialName("endTime")
|
||||||
val endTime: String,
|
val endTime: String,
|
||||||
@SerialName("setting")
|
@SerialName("setting")
|
||||||
val setting: Setting,
|
val setting: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Setting,
|
||||||
@SerialName("__splatoon3ink_king_salmonid_guess")
|
@SerialName("__splatoon3ink_king_salmonid_guess")
|
||||||
val splatoon3inkKingSalmonidGuess: String,
|
val splatoon3inkKingSalmonidGuess: String,
|
||||||
@SerialName("startTime")
|
@SerialName("startTime")
|
|
@ -25,5 +25,5 @@ import kotlinx.serialization.Serializable
|
||||||
@Serializable
|
@Serializable
|
||||||
data class BigRunSchedules(
|
data class BigRunSchedules(
|
||||||
@SerialName("nodes")
|
@SerialName("nodes")
|
||||||
val nodes: List<SalmonRunNode>
|
val nodes: List<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.BigRunScheduleNode>
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,9 +27,9 @@ data class CoopGroupingSchedule(
|
||||||
@SerialName("bannerImage")
|
@SerialName("bannerImage")
|
||||||
val bannerImage: String?, // is null
|
val bannerImage: String?, // is null
|
||||||
@SerialName("bigRunSchedules")
|
@SerialName("bigRunSchedules")
|
||||||
val bigRunSchedules: BigRunSchedules,
|
val bigRunSchedules: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.BigRunSchedules,
|
||||||
@SerialName("regularSchedules")
|
@SerialName("regularSchedules")
|
||||||
val regularSchedules: RegularSchedules,
|
val regularSchedules: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.RegularSchedules,
|
||||||
@SerialName("teamContestSchedules")
|
@SerialName("teamContestSchedules")
|
||||||
val teamContestSchedules: TeamContestSchedules?
|
val teamContestSchedules: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.TeamContestSchedules?
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,9 +27,9 @@ data class CoopStage(
|
||||||
@SerialName("id")
|
@SerialName("id")
|
||||||
val id: String,
|
val id: String,
|
||||||
@SerialName("image")
|
@SerialName("image")
|
||||||
val image: Image,
|
val image: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Image,
|
||||||
@SerialName("name")
|
@SerialName("name")
|
||||||
val name: String,
|
val name: String,
|
||||||
@SerialName("thumbnailImage")
|
@SerialName("thumbnailImage")
|
||||||
val thumbnailImage: ThumbnailImage
|
val thumbnailImage: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.ThumbnailImage
|
||||||
)
|
)
|
||||||
|
|
|
@ -35,9 +35,9 @@ data class CurrentFest(
|
||||||
@SerialName("state")
|
@SerialName("state")
|
||||||
val state: String,
|
val state: String,
|
||||||
@SerialName("teams")
|
@SerialName("teams")
|
||||||
val teams: List<Team>,
|
val teams: List<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Team>,
|
||||||
@SerialName("title")
|
@SerialName("title")
|
||||||
val title: String,
|
val title: String,
|
||||||
@SerialName("tricolorStage")
|
@SerialName("tricolorStage")
|
||||||
val tricolorStage: TricolorStage
|
val tricolorStage: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.TricolorStage
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,5 +25,5 @@ import kotlinx.serialization.Serializable
|
||||||
@Serializable
|
@Serializable
|
||||||
data class CurrentPlayer(
|
data class CurrentPlayer(
|
||||||
@SerialName("userIcon")
|
@SerialName("userIcon")
|
||||||
val userIcon: UserIcon
|
val userIcon: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.UserIcon
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,7 +25,7 @@ import kotlinx.serialization.Serializable
|
||||||
@Serializable
|
@Serializable
|
||||||
data class EventNode(
|
data class EventNode(
|
||||||
@SerialName("leagueMatchSetting")
|
@SerialName("leagueMatchSetting")
|
||||||
val leagueMatchSetting: LeagueMatchSetting,
|
val leagueMatchSetting: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.LeagueMatchSetting,
|
||||||
@SerialName("timePeriods")
|
@SerialName("timePeriods")
|
||||||
val timePeriods: List<TimePeriod>
|
val timePeriods: List<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.TimePeriod>
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,5 +25,5 @@ import kotlinx.serialization.Serializable
|
||||||
@Serializable
|
@Serializable
|
||||||
data class EventSchedules(
|
data class EventSchedules(
|
||||||
@SerialName("nodes")
|
@SerialName("nodes")
|
||||||
val nodes: List<EventNode>
|
val nodes: List<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.EventNode>
|
||||||
)
|
)
|
||||||
|
|
|
@ -29,7 +29,7 @@ data class FestMatchSettingX(
|
||||||
@SerialName("__typename")
|
@SerialName("__typename")
|
||||||
val typename: String,
|
val typename: String,
|
||||||
@SerialName("vsRule")
|
@SerialName("vsRule")
|
||||||
val vsRule: VsRule,
|
val vsRule: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsRule,
|
||||||
@SerialName("vsStages")
|
@SerialName("vsStages")
|
||||||
val vsStages: List<VsStage>
|
val vsStages: List<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsStage>
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,7 +27,7 @@ data class FestNode(
|
||||||
@SerialName("endTime")
|
@SerialName("endTime")
|
||||||
val endTime: String,
|
val endTime: String,
|
||||||
@SerialName("festMatchSettings")
|
@SerialName("festMatchSettings")
|
||||||
val festMatchSettings: FestMatchSettingX?,
|
val festMatchSettings: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.FestMatchSettingX?,
|
||||||
@SerialName("startTime")
|
@SerialName("startTime")
|
||||||
val startTime: String
|
val startTime: String
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,5 +25,5 @@ import kotlinx.serialization.Serializable
|
||||||
@Serializable
|
@Serializable
|
||||||
data class FestSchedules(
|
data class FestSchedules(
|
||||||
@SerialName("nodes")
|
@SerialName("nodes")
|
||||||
val nodes: List<FestNode>
|
val nodes: List<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.FestNode>
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,11 +27,11 @@ data class LeagueMatchSetting(
|
||||||
@SerialName("__isVsSetting")
|
@SerialName("__isVsSetting")
|
||||||
val isVsSetting: String,
|
val isVsSetting: String,
|
||||||
@SerialName("leagueMatchEvent")
|
@SerialName("leagueMatchEvent")
|
||||||
val leagueMatchEvent: LeagueMatchEvent,
|
val leagueMatchEvent: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.LeagueMatchEvent,
|
||||||
@SerialName("__typename")
|
@SerialName("__typename")
|
||||||
val typename: String,
|
val typename: String,
|
||||||
@SerialName("vsRule")
|
@SerialName("vsRule")
|
||||||
val vsRule: VsRule,
|
val vsRule: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsRule,
|
||||||
@SerialName("vsStages")
|
@SerialName("vsStages")
|
||||||
val vsStages: List<VsStage>
|
val vsStages: List<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsStage>
|
||||||
)
|
)
|
||||||
|
|
|
@ -29,7 +29,7 @@ data class MapNode(
|
||||||
@SerialName("name")
|
@SerialName("name")
|
||||||
val name: String,
|
val name: String,
|
||||||
@SerialName("originalImage")
|
@SerialName("originalImage")
|
||||||
val originalImage: OriginalImage,
|
val originalImage: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.OriginalImage,
|
||||||
@SerialName("stats")
|
@SerialName("stats")
|
||||||
val stats: String?, // is null
|
val stats: String?, // is null
|
||||||
@SerialName("vsStageId")
|
@SerialName("vsStageId")
|
||||||
|
|
|
@ -29,7 +29,7 @@ data class RegularMatchSetting(
|
||||||
@SerialName("__typename")
|
@SerialName("__typename")
|
||||||
val typename: String,
|
val typename: String,
|
||||||
@SerialName("vsRule")
|
@SerialName("vsRule")
|
||||||
val vsRule: VsRule,
|
val vsRule: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsRule,
|
||||||
@SerialName("vsStages")
|
@SerialName("vsStages")
|
||||||
val vsStages: List<VsStage>
|
val vsStages: List<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsStage>
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,9 +27,9 @@ data class RegularNode(
|
||||||
@SerialName("endTime")
|
@SerialName("endTime")
|
||||||
val endTime: String,
|
val endTime: String,
|
||||||
@SerialName("festMatchSettings")
|
@SerialName("festMatchSettings")
|
||||||
val festMatchSettings: FestMatchSettingXX?,
|
val festMatchSettings: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.FestMatchSettingXX?,
|
||||||
@SerialName("regularMatchSetting")
|
@SerialName("regularMatchSetting")
|
||||||
val regularMatchSetting: RegularMatchSetting,
|
val regularMatchSetting: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.RegularMatchSetting,
|
||||||
@SerialName("startTime")
|
@SerialName("startTime")
|
||||||
val startTime: String
|
val startTime: String
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,5 +25,5 @@ import kotlinx.serialization.Serializable
|
||||||
@Serializable
|
@Serializable
|
||||||
data class RegularSchedules(
|
data class RegularSchedules(
|
||||||
@SerialName("nodes")
|
@SerialName("nodes")
|
||||||
val nodes: List<SalmonRunNode>
|
val nodes: List<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.BigRunScheduleNode>
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,5 +25,5 @@ import kotlinx.serialization.Serializable
|
||||||
@Serializable
|
@Serializable
|
||||||
data class RegularSchedulesX(
|
data class RegularSchedulesX(
|
||||||
@SerialName("nodes")
|
@SerialName("nodes")
|
||||||
val nodes: List<RegularNode>
|
val nodes: List<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.RegularNode>
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,5 +25,5 @@ import kotlinx.serialization.Serializable
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Schedules(
|
data class Schedules(
|
||||||
@SerialName("data")
|
@SerialName("data")
|
||||||
val data: SchedulesData
|
val data: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.SchedulesData
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,21 +25,21 @@ import kotlinx.serialization.Serializable
|
||||||
@Serializable
|
@Serializable
|
||||||
data class SchedulesData(
|
data class SchedulesData(
|
||||||
@SerialName("bankaraSchedules")
|
@SerialName("bankaraSchedules")
|
||||||
val bankaraSchedules: BankaraSchedules,
|
val bankaraSchedules: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.BankaraSchedules,
|
||||||
@SerialName("coopGroupingSchedule")
|
@SerialName("coopGroupingSchedule")
|
||||||
val coopGroupingSchedule: CoopGroupingSchedule,
|
val coopGroupingSchedule: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.CoopGroupingSchedule,
|
||||||
@SerialName("currentFest")
|
@SerialName("currentFest")
|
||||||
val currentFest: CurrentFest?,
|
val currentFest: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.CurrentFest?,
|
||||||
@SerialName("currentPlayer")
|
@SerialName("currentPlayer")
|
||||||
val currentPlayer: CurrentPlayer,
|
val currentPlayer: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.CurrentPlayer,
|
||||||
@SerialName("eventSchedules")
|
@SerialName("eventSchedules")
|
||||||
val eventSchedules: EventSchedules,
|
val eventSchedules: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.EventSchedules,
|
||||||
@SerialName("festSchedules")
|
@SerialName("festSchedules")
|
||||||
val festSchedules: FestSchedules,
|
val festSchedules: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.FestSchedules,
|
||||||
@SerialName("regularSchedules")
|
@SerialName("regularSchedules")
|
||||||
val regularSchedules: RegularSchedulesX,
|
val regularSchedules: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.RegularSchedulesX,
|
||||||
@SerialName("vsStages")
|
@SerialName("vsStages")
|
||||||
val vsStages: VsStages,
|
val vsStages: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsStages,
|
||||||
@SerialName("xSchedules")
|
@SerialName("xSchedules")
|
||||||
val xSchedules: XSchedules
|
val xSchedules: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.XSchedules
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,13 +25,13 @@ import kotlinx.serialization.Serializable
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Setting(
|
data class Setting(
|
||||||
@SerialName("boss")
|
@SerialName("boss")
|
||||||
val boss: Boss,
|
val boss: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Boss,
|
||||||
@SerialName("coopStage")
|
@SerialName("coopStage")
|
||||||
val coopStage: CoopStage,
|
val coopStage: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.CoopStage,
|
||||||
@SerialName("__isCoopSetting")
|
@SerialName("__isCoopSetting")
|
||||||
val isCoopSetting: String,
|
val isCoopSetting: String,
|
||||||
@SerialName("__typename")
|
@SerialName("__typename")
|
||||||
val typename: String,
|
val typename: String,
|
||||||
@SerialName("weapons")
|
@SerialName("weapons")
|
||||||
val weapons: List<Weapon>
|
val weapons: List<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Weapon>
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,7 +25,7 @@ import kotlinx.serialization.Serializable
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Team(
|
data class Team(
|
||||||
@SerialName("color")
|
@SerialName("color")
|
||||||
val color: Color,
|
val color: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Color,
|
||||||
@SerialName("id")
|
@SerialName("id")
|
||||||
val id: String,
|
val id: String,
|
||||||
// @SerialName("myVoteState")
|
// @SerialName("myVoteState")
|
||||||
|
|
|
@ -27,7 +27,7 @@ data class TricolorStage(
|
||||||
@SerialName("id")
|
@SerialName("id")
|
||||||
val id: String,
|
val id: String,
|
||||||
@SerialName("image")
|
@SerialName("image")
|
||||||
val image: Image,
|
val image: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Image,
|
||||||
@SerialName("name")
|
@SerialName("name")
|
||||||
val name: String
|
val name: String
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,7 +27,7 @@ data class VsStage(
|
||||||
@SerialName("id")
|
@SerialName("id")
|
||||||
val id: String,
|
val id: String,
|
||||||
@SerialName("image")
|
@SerialName("image")
|
||||||
val image: Image,
|
val image: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Image,
|
||||||
@SerialName("name")
|
@SerialName("name")
|
||||||
val name: String,
|
val name: String,
|
||||||
@SerialName("vsStageId")
|
@SerialName("vsStageId")
|
||||||
|
|
|
@ -25,5 +25,5 @@ import kotlinx.serialization.Serializable
|
||||||
@Serializable
|
@Serializable
|
||||||
data class VsStages(
|
data class VsStages(
|
||||||
@SerialName("nodes")
|
@SerialName("nodes")
|
||||||
val nodes: List<MapNode>
|
val nodes: List<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.MapNode>
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,7 +25,7 @@ import kotlinx.serialization.Serializable
|
||||||
@Serializable
|
@Serializable
|
||||||
data class Weapon(
|
data class Weapon(
|
||||||
@SerialName("image")
|
@SerialName("image")
|
||||||
val image: Image,
|
val image: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.Image,
|
||||||
@SerialName("name")
|
@SerialName("name")
|
||||||
val name: String,
|
val name: String,
|
||||||
@SerialName("__splatoon3ink_id")
|
@SerialName("__splatoon3ink_id")
|
||||||
|
|
|
@ -29,7 +29,7 @@ data class XMatchSetting(
|
||||||
@SerialName("__typename")
|
@SerialName("__typename")
|
||||||
val typename: String,
|
val typename: String,
|
||||||
@SerialName("vsRule")
|
@SerialName("vsRule")
|
||||||
val vsRule: VsRule,
|
val vsRule: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsRule,
|
||||||
@SerialName("vsStages")
|
@SerialName("vsStages")
|
||||||
val vsStages: List<VsStage>
|
val vsStages: List<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.VsStage>
|
||||||
)
|
)
|
||||||
|
|
|
@ -27,9 +27,9 @@ data class XNode(
|
||||||
@SerialName("endTime")
|
@SerialName("endTime")
|
||||||
val endTime: String,
|
val endTime: String,
|
||||||
@SerialName("festMatchSettings")
|
@SerialName("festMatchSettings")
|
||||||
val festMatchSettings: FestMatchSettingXX?,
|
val festMatchSettings: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.FestMatchSettingXX?,
|
||||||
@SerialName("startTime")
|
@SerialName("startTime")
|
||||||
val startTime: String,
|
val startTime: String,
|
||||||
@SerialName("xMatchSetting")
|
@SerialName("xMatchSetting")
|
||||||
val xMatchSetting: XMatchSetting
|
val xMatchSetting: net.moonleay.lilJudd.data.api.splatoon3ink.schedules.XMatchSetting
|
||||||
)
|
)
|
||||||
|
|
|
@ -25,5 +25,5 @@ import kotlinx.serialization.Serializable
|
||||||
@Serializable
|
@Serializable
|
||||||
data class XSchedules(
|
data class XSchedules(
|
||||||
@SerialName("nodes")
|
@SerialName("nodes")
|
||||||
val nodes: List<XNode>
|
val nodes: List<net.moonleay.lilJudd.data.api.splatoon3ink.schedules.XNode>
|
||||||
)
|
)
|
||||||
|
|
|
@ -51,7 +51,7 @@ object MatchPlanningDataRepository {
|
||||||
|
|
||||||
fun get(id: Int): MatchPlanningDataData? =
|
fun get(id: Int): MatchPlanningDataData? =
|
||||||
transaction {
|
transaction {
|
||||||
MatchPlanningData.selectAll().where { MatchPlanningData.id eq id }.firstOrNull()?.let {
|
MatchPlanningData.select { MatchPlanningData.id eq id }.firstOrNull()?.let {
|
||||||
MatchPlanningDataData(
|
MatchPlanningDataData(
|
||||||
it[MatchPlanningData.id],
|
it[MatchPlanningData.id],
|
||||||
it[MatchPlanningData.serverid],
|
it[MatchPlanningData.serverid],
|
||||||
|
@ -69,7 +69,7 @@ object MatchPlanningDataRepository {
|
||||||
|
|
||||||
fun getFromMessageInChannelInServer(messageID: Long, channelID: Long, serverID: Long): MatchPlanningDataData? =
|
fun getFromMessageInChannelInServer(messageID: Long, channelID: Long, serverID: Long): MatchPlanningDataData? =
|
||||||
transaction {
|
transaction {
|
||||||
MatchPlanningData.selectAll().where {
|
MatchPlanningData.select {
|
||||||
MatchPlanningData.messageid eq (messageID) and (
|
MatchPlanningData.messageid eq (messageID) and (
|
||||||
MatchPlanningData.serverid eq (serverID)) and (
|
MatchPlanningData.serverid eq (serverID)) and (
|
||||||
MatchPlanningData.channelid eq (channelID))
|
MatchPlanningData.channelid eq (channelID))
|
||||||
|
@ -98,15 +98,15 @@ object MatchPlanningDataRepository {
|
||||||
fun write(data: MatchPlanningDataData): Int =
|
fun write(data: MatchPlanningDataData): Int =
|
||||||
transaction {
|
transaction {
|
||||||
MatchPlanningData.insert {
|
MatchPlanningData.insert {
|
||||||
it[serverid] = data.serverID
|
it[MatchPlanningData.serverid] = data.serverID
|
||||||
it[channelid] = data.channelID
|
it[MatchPlanningData.channelid] = data.channelID
|
||||||
it[matchtype] = data.matchType
|
it[MatchPlanningData.matchtype] = data.matchType
|
||||||
it[registererid] = data.registererID
|
it[MatchPlanningData.registererid] = data.registererID
|
||||||
it[roleid] = data.roleID
|
it[MatchPlanningData.roleid] = data.roleID
|
||||||
it[opponentName] = data.opponentName
|
it[MatchPlanningData.opponentName] = data.opponentName
|
||||||
it[messageid] = data.messageID
|
it[MatchPlanningData.messageid] = data.messageID
|
||||||
it[timestamp] = data.timestamp
|
it[MatchPlanningData.timestamp] = data.timestamp
|
||||||
it[jobstr] = data.jobString
|
it[MatchPlanningData.jobstr] = data.jobString
|
||||||
} get MatchPlanningData.id
|
} get MatchPlanningData.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -46,7 +46,9 @@ object PlanningNotifierRolesRepository {
|
||||||
|
|
||||||
fun getForChannel(channelID: Long): PlanningNotifierRolesData? =
|
fun getForChannel(channelID: Long): PlanningNotifierRolesData? =
|
||||||
transaction {
|
transaction {
|
||||||
PlanningNotifierRoles.selectAll().where { PlanningNotifierRoles.channelid eq channelID }.firstOrNull()?.let {
|
PlanningNotifierRoles.select {
|
||||||
|
PlanningNotifierRoles.channelid eq channelID
|
||||||
|
}.firstOrNull()?.let {
|
||||||
PlanningNotifierRolesData(
|
PlanningNotifierRolesData(
|
||||||
it[PlanningNotifierRoles.id],
|
it[PlanningNotifierRoles.id],
|
||||||
it[PlanningNotifierRoles.serverid],
|
it[PlanningNotifierRoles.serverid],
|
||||||
|
@ -59,9 +61,9 @@ object PlanningNotifierRolesRepository {
|
||||||
|
|
||||||
fun getForChannelInServer(channelID: Long, serverID: Long): PlanningNotifierRolesData? =
|
fun getForChannelInServer(channelID: Long, serverID: Long): PlanningNotifierRolesData? =
|
||||||
transaction {
|
transaction {
|
||||||
PlanningNotifierRoles.selectAll()
|
PlanningNotifierRoles.select {
|
||||||
.where { PlanningNotifierRoles.channelid eq channelID and (PlanningNotifierRoles.serverid eq serverID) }
|
PlanningNotifierRoles.channelid eq channelID and (PlanningNotifierRoles.serverid eq serverID)
|
||||||
.firstOrNull()?.let {
|
}.firstOrNull()?.let {
|
||||||
PlanningNotifierRolesData(
|
PlanningNotifierRolesData(
|
||||||
it[PlanningNotifierRoles.id],
|
it[PlanningNotifierRoles.id],
|
||||||
it[PlanningNotifierRoles.serverid],
|
it[PlanningNotifierRoles.serverid],
|
||||||
|
@ -74,23 +76,22 @@ object PlanningNotifierRolesRepository {
|
||||||
|
|
||||||
fun existsInChannel(channelID: Long): Boolean =
|
fun existsInChannel(channelID: Long): Boolean =
|
||||||
transaction {
|
transaction {
|
||||||
PlanningNotifierRoles.selectAll().where { PlanningNotifierRoles.channelid eq channelID }.count() > 0
|
PlanningNotifierRoles.select { PlanningNotifierRoles.channelid eq channelID }.count() > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
fun existsInChannelFromSever(channelID: Long, serverID: Long): Boolean =
|
fun existsInChannelFromSever(channelID: Long, serverID: Long): Boolean =
|
||||||
transaction {
|
transaction {
|
||||||
PlanningNotifierRoles.selectAll()
|
PlanningNotifierRoles.select { PlanningNotifierRoles.channelid eq channelID and (PlanningNotifierRoles.serverid eq serverID) }
|
||||||
.where { PlanningNotifierRoles.channelid eq channelID and (PlanningNotifierRoles.serverid eq serverID) }
|
|
||||||
.count() > 0
|
.count() > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
fun write(data: PlanningNotifierRolesData) {
|
fun write(data: PlanningNotifierRolesData) {
|
||||||
transaction {
|
transaction {
|
||||||
PlanningNotifierRoles.insert {
|
PlanningNotifierRoles.insert {
|
||||||
it[serverid] = data.serverID
|
it[PlanningNotifierRoles.serverid] = data.serverID
|
||||||
it[channelid] = data.channelID
|
it[PlanningNotifierRoles.channelid] = data.channelID
|
||||||
it[hastimeroleid] = data.hasTimeRoleID
|
it[PlanningNotifierRoles.hastimeroleid] = data.hasTimeRoleID
|
||||||
it[wantstobenotifiedid] = data.wantsToBeNotifiedID
|
it[PlanningNotifierRoles.wantstobenotifiedid] = data.wantsToBeNotifiedID
|
||||||
} get PlanningNotifierRoles.id
|
} get PlanningNotifierRoles.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -43,8 +43,7 @@ object TimePlanningChannelsRepository {
|
||||||
|
|
||||||
fun exists(channelID: Long, serverID: Long): Boolean =
|
fun exists(channelID: Long, serverID: Long): Boolean =
|
||||||
transaction {
|
transaction {
|
||||||
TimePlanningChannels.selectAll()
|
TimePlanningChannels.select { TimePlanningChannels.channelid eq channelID and (TimePlanningChannels.serverid eq serverID) }
|
||||||
.where { TimePlanningChannels.channelid eq channelID and (TimePlanningChannels.serverid eq serverID) }
|
|
||||||
.firstOrNull() != null
|
.firstOrNull() != null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -56,15 +55,15 @@ object TimePlanningChannelsRepository {
|
||||||
|
|
||||||
fun deleteFromChannelInServer(channelID: Long, serverID: Long) {
|
fun deleteFromChannelInServer(channelID: Long, serverID: Long) {
|
||||||
transaction {
|
transaction {
|
||||||
TimePlanningChannels.deleteWhere { channelid eq channelID and (serverid eq serverID) }
|
TimePlanningChannels.deleteWhere { TimePlanningChannels.channelid eq channelID and (TimePlanningChannels.serverid eq serverID) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun write(data: TimePlanningChannelsData): Int =
|
fun write(data: TimePlanningChannelsData): Int =
|
||||||
transaction {
|
transaction {
|
||||||
TimePlanningChannels.insert {
|
TimePlanningChannels.insert {
|
||||||
it[serverid] = data.serverID
|
it[TimePlanningChannels.serverid] = data.serverID
|
||||||
it[channelid] = data.channelID
|
it[TimePlanningChannels.channelid] = data.channelID
|
||||||
} get TimePlanningChannels.id
|
} get TimePlanningChannels.id
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,8 +20,9 @@ package net.moonleay.lilJudd.data.database.repository
|
||||||
|
|
||||||
import net.moonleay.lilJudd.data.database.entry.TimePlanningMessagesData
|
import net.moonleay.lilJudd.data.database.entry.TimePlanningMessagesData
|
||||||
import net.moonleay.lilJudd.data.database.tables.TimePlanningMessages
|
import net.moonleay.lilJudd.data.database.tables.TimePlanningMessages
|
||||||
import org.jetbrains.exposed.sql.*
|
import org.jetbrains.exposed.sql.and
|
||||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
import org.jetbrains.exposed.sql.insert
|
||||||
|
import org.jetbrains.exposed.sql.select
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
|
|
||||||
object TimePlanningMessagesRepository {
|
object TimePlanningMessagesRepository {
|
||||||
|
@ -39,7 +40,9 @@ object TimePlanningMessagesRepository {
|
||||||
fun getWeek(stamp: Long): List<TimePlanningMessagesData> {
|
fun getWeek(stamp: Long): List<TimePlanningMessagesData> {
|
||||||
val dataList = mutableListOf<TimePlanningMessagesData>()
|
val dataList = mutableListOf<TimePlanningMessagesData>()
|
||||||
transaction {
|
transaction {
|
||||||
for (pnr in TimePlanningMessages.selectAll().where { TimePlanningMessages.weekstamp eq (stamp) }) {
|
for (pnr in TimePlanningMessages.select {
|
||||||
|
TimePlanningMessages.weekstamp eq (stamp)
|
||||||
|
}) {
|
||||||
dataList.add(
|
dataList.add(
|
||||||
TimePlanningMessagesData(
|
TimePlanningMessagesData(
|
||||||
pnr[TimePlanningMessages.id],
|
pnr[TimePlanningMessages.id],
|
||||||
|
@ -56,8 +59,9 @@ object TimePlanningMessagesRepository {
|
||||||
|
|
||||||
fun getWeekInChannel(stamp: Long, channelID: Long): TimePlanningMessagesData? =
|
fun getWeekInChannel(stamp: Long, channelID: Long): TimePlanningMessagesData? =
|
||||||
transaction {
|
transaction {
|
||||||
TimePlanningMessages.selectAll()
|
TimePlanningMessages.select {
|
||||||
.where { TimePlanningMessages.weekstamp eq (stamp) and (TimePlanningMessages.channelid eq channelID) }.firstOrNull()?.let {
|
TimePlanningMessages.weekstamp eq (stamp) and (TimePlanningMessages.channelid eq channelID)
|
||||||
|
}.firstOrNull()?.let {
|
||||||
TimePlanningMessagesData(
|
TimePlanningMessagesData(
|
||||||
it[TimePlanningMessages.id],
|
it[TimePlanningMessages.id],
|
||||||
it[TimePlanningMessages.serverid],
|
it[TimePlanningMessages.serverid],
|
||||||
|
|
|
@ -1,464 +0,0 @@
|
||||||
/*
|
|
||||||
* lilJudd
|
|
||||||
* Copyright (C) 2024 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 dev.kord.common.Color
|
|
||||||
import dev.kord.rest.builder.message.embed
|
|
||||||
import kotlinx.datetime.Clock
|
|
||||||
import net.moonleay.lilJudd.data.api.splatoon3ink.Splatoon3ApiDataGrabber
|
|
||||||
import net.moonleay.lilJudd.extensions.component.SplatoonOnlineMode
|
|
||||||
import net.moonleay.lilJudd.util.TimeUtil
|
|
||||||
|
|
||||||
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 -> {
|
|
||||||
val regSched = Splatoon3ApiDataGrabber.getRegularMode(System.currentTimeMillis())
|
|
||||||
val regMaps = regSched.regularMatchSetting.vsStages
|
|
||||||
val regMap1 = regMaps[0]
|
|
||||||
val regMap2 = regMaps[1]
|
|
||||||
|
|
||||||
val serSched = Splatoon3ApiDataGrabber.getSeriesMode(System.currentTimeMillis())
|
|
||||||
val serMaps = serSched.bankaraMatchSettings!!.first().vsStages
|
|
||||||
val serMap1 = serMaps[0]
|
|
||||||
val serMap2 = serMaps[1]
|
|
||||||
|
|
||||||
val opnSched = Splatoon3ApiDataGrabber.getSeriesMode(System.currentTimeMillis())
|
|
||||||
val opnMaps = opnSched.bankaraMatchSettings!!.last().vsStages
|
|
||||||
val opnMap1 = opnMaps[0]
|
|
||||||
val opnMap2 = opnMaps[1]
|
|
||||||
|
|
||||||
val xSched = Splatoon3ApiDataGrabber.getXMode(System.currentTimeMillis())
|
|
||||||
val xMaps = xSched.xMatchSetting.vsStages
|
|
||||||
val xMap1 = xMaps[0]
|
|
||||||
val xMap2 = xMaps[1]
|
|
||||||
|
|
||||||
val salSched = Splatoon3ApiDataGrabber.getSalmonRun(System.currentTimeMillis())
|
|
||||||
val salMap = salSched.setting.coopStage.name
|
|
||||||
val salBoss = salSched.setting.boss.name
|
|
||||||
val salWeapons = salSched.setting.weapons
|
|
||||||
|
|
||||||
this.respond {
|
|
||||||
this.embed {
|
|
||||||
this.author {
|
|
||||||
this.name = "Current rotation for"
|
|
||||||
}
|
|
||||||
this.title = "All Modes"
|
|
||||||
this.description = "[[Open on website](https://splatoon3.ink/)]"
|
|
||||||
this.color = Color(0x1437FF)
|
|
||||||
|
|
||||||
this.thumbnail {
|
|
||||||
this.url = "https://static.moonleay.net/img/lilJudd/deepcut.png"
|
|
||||||
}
|
|
||||||
|
|
||||||
this.field {
|
|
||||||
this.name = "Regular (${
|
|
||||||
TimeUtil.getTimeFromJSONTime(
|
|
||||||
regSched.startTime,
|
|
||||||
"UTC"
|
|
||||||
)
|
|
||||||
} - ${TimeUtil.getTimeFromJSONTime(regSched.endTime, "UTC")})"
|
|
||||||
this.value =
|
|
||||||
"${regSched.regularMatchSetting.vsRule.name} on ${regMap1.name} & ${regMap2.name}"
|
|
||||||
this.inline = false
|
|
||||||
}
|
|
||||||
|
|
||||||
this.field {
|
|
||||||
this.name = "Series (${
|
|
||||||
TimeUtil.getTimeFromJSONTime(
|
|
||||||
serSched.startTime,
|
|
||||||
"UTC"
|
|
||||||
)
|
|
||||||
} - ${TimeUtil.getTimeFromJSONTime(serSched.endTime, "UTC")})"
|
|
||||||
this.value =
|
|
||||||
"${serSched.bankaraMatchSettings.first().vsRule.name} on ${serMap1.name} & ${serMap2.name}"
|
|
||||||
this.inline = false
|
|
||||||
}
|
|
||||||
|
|
||||||
this.field {
|
|
||||||
this.name = "Open (${
|
|
||||||
TimeUtil.getTimeFromJSONTime(
|
|
||||||
opnSched.startTime,
|
|
||||||
"UTC"
|
|
||||||
)
|
|
||||||
} - ${TimeUtil.getTimeFromJSONTime(opnSched.endTime, "UTC")})"
|
|
||||||
this.value =
|
|
||||||
"${opnSched.bankaraMatchSettings.last().vsRule.name} on ${opnMap1.name} & ${opnMap2.name}"
|
|
||||||
this.inline = false
|
|
||||||
}
|
|
||||||
|
|
||||||
this.field {
|
|
||||||
this.name = "X (${
|
|
||||||
TimeUtil.getTimeFromJSONTime(
|
|
||||||
xSched.startTime,
|
|
||||||
"UTC"
|
|
||||||
)
|
|
||||||
} - ${TimeUtil.getTimeFromJSONTime(xSched.endTime, "UTC")})"
|
|
||||||
this.value = "${xSched.xMatchSetting.vsRule.name} on ${xMap1.name} & ${xMap2.name}"
|
|
||||||
this.inline = false
|
|
||||||
}
|
|
||||||
|
|
||||||
this.field {
|
|
||||||
this.name = "Salmon Run (${
|
|
||||||
TimeUtil.getTimeFromJSONTimeLong(
|
|
||||||
salSched.startTime,
|
|
||||||
"UTC"
|
|
||||||
)
|
|
||||||
} - ${TimeUtil.getTimeFromJSONTimeLong(salSched.endTime, "UTC")})"
|
|
||||||
this.value =
|
|
||||||
"${salBoss} on ${salMap} with ${salWeapons[0].name}, ${salWeapons[1].name}, ${salWeapons[2].name} & ${salWeapons[3].name}"
|
|
||||||
this.inline = false
|
|
||||||
}
|
|
||||||
|
|
||||||
this.timestamp = Clock.System.now()
|
|
||||||
this.footer {
|
|
||||||
this.text = "Data provided by splatoon3.ink"
|
|
||||||
this.icon = "https://fedi.splatoon3.ink/favicon.png"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SplatoonOnlineMode.REGULAR -> {
|
|
||||||
val regSched = Splatoon3ApiDataGrabber.getRegularMode(System.currentTimeMillis())
|
|
||||||
val regMaps = regSched.regularMatchSetting.vsStages
|
|
||||||
val regMap1 = regMaps[0]
|
|
||||||
val regMap2 = regMaps[1]
|
|
||||||
|
|
||||||
val regSched2 =
|
|
||||||
Splatoon3ApiDataGrabber.getRegularMode(System.currentTimeMillis() + 1000 * 60 * 60 * 2)
|
|
||||||
val regMaps2 = regSched2.regularMatchSetting.vsStages
|
|
||||||
val regMap12 = regMaps2[0]
|
|
||||||
val regMap22 = regMaps2[1]
|
|
||||||
|
|
||||||
this.respond {
|
|
||||||
this.embed {
|
|
||||||
this.author {
|
|
||||||
this.name = "Current rotation for"
|
|
||||||
}
|
|
||||||
this.title = "Regular Mode"
|
|
||||||
this.description = "[[Open on website](https://splatoon3.ink/)]"
|
|
||||||
this.color = Color(0x18c81b)
|
|
||||||
|
|
||||||
this.thumbnail {
|
|
||||||
this.url = "https://static.moonleay.net/img/lilJudd/regular.png"
|
|
||||||
}
|
|
||||||
|
|
||||||
this.field {
|
|
||||||
this.name = "Current (${
|
|
||||||
TimeUtil.getTimeFromJSONTime(
|
|
||||||
regSched.startTime,
|
|
||||||
"UTC"
|
|
||||||
)
|
|
||||||
} - ${TimeUtil.getTimeFromJSONTime(regSched.endTime, "UTC")})"
|
|
||||||
this.value =
|
|
||||||
"${regSched.regularMatchSetting.vsRule.name} on ${regMap1.name} & ${regMap2.name}"
|
|
||||||
this.inline = false
|
|
||||||
}
|
|
||||||
|
|
||||||
this.field {
|
|
||||||
this.name = "${
|
|
||||||
TimeUtil.getTimeFromJSONTime(
|
|
||||||
regSched2.startTime,
|
|
||||||
"UTC"
|
|
||||||
)
|
|
||||||
} - ${TimeUtil.getTimeFromJSONTime(regSched2.endTime, "UTC")}"
|
|
||||||
this.value =
|
|
||||||
"${regSched2.regularMatchSetting.vsRule.name} on ${regMap12.name} & ${regMap22.name}"
|
|
||||||
this.inline = false
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
this.timestamp = Clock.System.now()
|
|
||||||
this.footer {
|
|
||||||
this.text = "Data provided by splatoon3.ink"
|
|
||||||
this.icon = "https://fedi.splatoon3.ink/favicon.png"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SplatoonOnlineMode.SERIES -> {
|
|
||||||
val serSched = Splatoon3ApiDataGrabber.getSeriesMode(System.currentTimeMillis())
|
|
||||||
val serMaps = serSched.bankaraMatchSettings!!.first().vsStages
|
|
||||||
val serMap1 = serMaps[0]
|
|
||||||
val serMap2 = serMaps[1]
|
|
||||||
|
|
||||||
val serSched2 =
|
|
||||||
Splatoon3ApiDataGrabber.getSeriesMode(System.currentTimeMillis() + 1000 * 60 * 60 * 2)
|
|
||||||
val serMaps2 = serSched2.bankaraMatchSettings!!.first().vsStages
|
|
||||||
val serMap12 = serMaps2[0]
|
|
||||||
val serMap22 = serMaps2[1]
|
|
||||||
|
|
||||||
this.respond {
|
|
||||||
this.embed {
|
|
||||||
this.author {
|
|
||||||
this.name = "Current rotation for"
|
|
||||||
}
|
|
||||||
this.title = "Ranked Series Mode"
|
|
||||||
this.description = "[[Open on website](https://splatoon3.ink/)]"
|
|
||||||
this.color = Color(0xE14412)
|
|
||||||
|
|
||||||
this.thumbnail {
|
|
||||||
this.url = "https://static.moonleay.net/img/lilJudd/bankara.png"
|
|
||||||
}
|
|
||||||
|
|
||||||
this.field {
|
|
||||||
this.name = "Current (${
|
|
||||||
TimeUtil.getTimeFromJSONTime(
|
|
||||||
serSched.startTime,
|
|
||||||
"UTC"
|
|
||||||
)
|
|
||||||
} - ${TimeUtil.getTimeFromJSONTime(serSched.endTime, "UTC")})"
|
|
||||||
this.value =
|
|
||||||
"${serSched.bankaraMatchSettings.first().vsRule.name} on ${serMap1.name} & ${serMap2.name}"
|
|
||||||
this.inline = false
|
|
||||||
}
|
|
||||||
|
|
||||||
this.field {
|
|
||||||
this.name = "${
|
|
||||||
TimeUtil.getTimeFromJSONTime(
|
|
||||||
serSched2.startTime,
|
|
||||||
"UTC"
|
|
||||||
)
|
|
||||||
} - ${TimeUtil.getTimeFromJSONTime(serSched2.endTime, "UTC")}"
|
|
||||||
this.value =
|
|
||||||
"${serSched2.bankaraMatchSettings.first().vsRule.name} on ${serMap12.name} & ${serMap22.name}"
|
|
||||||
this.inline = false
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
this.timestamp = Clock.System.now()
|
|
||||||
this.footer {
|
|
||||||
this.text = "Data provided by splatoon3.ink"
|
|
||||||
this.icon = "https://fedi.splatoon3.ink/favicon.png"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SplatoonOnlineMode.OPEN -> {
|
|
||||||
val opnSched = Splatoon3ApiDataGrabber.getSeriesMode(System.currentTimeMillis())
|
|
||||||
val opnMaps = opnSched.bankaraMatchSettings!!.last().vsStages
|
|
||||||
val opnMap1 = opnMaps[0]
|
|
||||||
val opnMap2 = opnMaps[1]
|
|
||||||
|
|
||||||
val opnSched2 =
|
|
||||||
Splatoon3ApiDataGrabber.getSeriesMode(System.currentTimeMillis() + 1000 * 60 * 60 * 2)
|
|
||||||
val opnMaps2 = opnSched2.bankaraMatchSettings!!.last().vsStages
|
|
||||||
val opnMap12 = opnMaps2[0]
|
|
||||||
val opnMap22 = opnMaps2[1]
|
|
||||||
|
|
||||||
this.respond {
|
|
||||||
this.embed {
|
|
||||||
this.author {
|
|
||||||
this.name = "Current rotation for"
|
|
||||||
}
|
|
||||||
this.title = "Ranked Open Mode"
|
|
||||||
this.description = "[[Open on website](https://splatoon3.ink/)]"
|
|
||||||
this.color = Color(0xE14412)
|
|
||||||
|
|
||||||
this.thumbnail {
|
|
||||||
this.url = "https://static.moonleay.net/img/lilJudd/bankara.png"
|
|
||||||
}
|
|
||||||
|
|
||||||
this.field {
|
|
||||||
this.name = "Current (${
|
|
||||||
TimeUtil.getTimeFromJSONTime(
|
|
||||||
opnSched.startTime,
|
|
||||||
"UTC"
|
|
||||||
)
|
|
||||||
} - ${TimeUtil.getTimeFromJSONTime(opnSched.endTime, "UTC")})"
|
|
||||||
this.value =
|
|
||||||
"${opnSched.bankaraMatchSettings.last().vsRule.name} on ${opnMap1.name} & ${opnMap2.name}"
|
|
||||||
this.inline = false
|
|
||||||
}
|
|
||||||
|
|
||||||
this.field {
|
|
||||||
this.name = "${
|
|
||||||
TimeUtil.getTimeFromJSONTime(
|
|
||||||
opnSched2.startTime,
|
|
||||||
"UTC"
|
|
||||||
)
|
|
||||||
} - ${TimeUtil.getTimeFromJSONTime(opnSched2.endTime, "UTC")}"
|
|
||||||
this.value =
|
|
||||||
"${opnSched2.bankaraMatchSettings.last().vsRule.name} on ${opnMap12.name} & ${opnMap22.name}"
|
|
||||||
this.inline = false
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
this.timestamp = Clock.System.now()
|
|
||||||
this.footer {
|
|
||||||
this.text = "Data provided by splatoon3.ink"
|
|
||||||
this.icon = "https://fedi.splatoon3.ink/favicon.png"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SplatoonOnlineMode.X -> {
|
|
||||||
val xSched = Splatoon3ApiDataGrabber.getXMode(System.currentTimeMillis())
|
|
||||||
val xMaps = xSched.xMatchSetting.vsStages
|
|
||||||
val xMap1 = xMaps[0]
|
|
||||||
val xMap2 = xMaps[1]
|
|
||||||
|
|
||||||
val xSched2 = Splatoon3ApiDataGrabber.getXMode(System.currentTimeMillis() + 1000 * 60 * 60 * 2)
|
|
||||||
val xMaps2 = xSched2.xMatchSetting.vsStages
|
|
||||||
val xMap12 = xMaps2[0]
|
|
||||||
val xMap22 = xMaps2[1]
|
|
||||||
|
|
||||||
this.respond {
|
|
||||||
this.embed {
|
|
||||||
this.author {
|
|
||||||
this.name = "Current rotation for"
|
|
||||||
}
|
|
||||||
this.title = "X Mode"
|
|
||||||
this.description = "[[Open on website](https://splatoon3.ink/)]"
|
|
||||||
this.color = Color(0x0ECB93)
|
|
||||||
|
|
||||||
this.thumbnail {
|
|
||||||
this.url = "https://static.moonleay.net/img/lilJudd/x.png"
|
|
||||||
}
|
|
||||||
|
|
||||||
this.field {
|
|
||||||
this.name = "Current (${
|
|
||||||
TimeUtil.getTimeFromJSONTime(
|
|
||||||
xSched.startTime,
|
|
||||||
"UTC"
|
|
||||||
)
|
|
||||||
} - ${TimeUtil.getTimeFromJSONTime(xSched.endTime, "UTC")})"
|
|
||||||
this.value = "${xSched.xMatchSetting.vsRule.name} on ${xMap1.name} & ${xMap2.name}"
|
|
||||||
this.inline = false
|
|
||||||
}
|
|
||||||
|
|
||||||
this.field {
|
|
||||||
this.name = "${
|
|
||||||
TimeUtil.getTimeFromJSONTime(
|
|
||||||
xSched2.startTime,
|
|
||||||
"UTC"
|
|
||||||
)
|
|
||||||
} - ${TimeUtil.getTimeFromJSONTime(xSched2.endTime, "UTC")}"
|
|
||||||
this.value =
|
|
||||||
"${xSched2.xMatchSetting.vsRule.name} on ${xMap12.name} & ${xMap22.name}"
|
|
||||||
this.inline = false
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
this.timestamp = Clock.System.now()
|
|
||||||
this.footer {
|
|
||||||
this.text = "Data provided by splatoon3.ink"
|
|
||||||
this.icon = "https://fedi.splatoon3.ink/favicon.png"
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
SplatoonOnlineMode.SALMON_RUN -> {
|
|
||||||
val salSched = Splatoon3ApiDataGrabber.getSalmonRun(System.currentTimeMillis())
|
|
||||||
val salMap = salSched.setting.coopStage.name
|
|
||||||
val salBoss = salSched.setting.boss.name
|
|
||||||
val salWeapons = salSched.setting.weapons
|
|
||||||
|
|
||||||
val salSched2 =
|
|
||||||
Splatoon3ApiDataGrabber.getSalmonRun(System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 2)
|
|
||||||
val salMap2 = salSched2.setting.coopStage.name
|
|
||||||
val salBoss2 = salSched2.setting.boss.name
|
|
||||||
val salWeapons2 = salSched2.setting.weapons
|
|
||||||
|
|
||||||
this.respond {
|
|
||||||
this.embed {
|
|
||||||
this.author {
|
|
||||||
this.name = "Current rotation for"
|
|
||||||
}
|
|
||||||
this.title = "Salmon Run"
|
|
||||||
this.description = "[[Open on website](https://splatoon3.ink/salmonrun)]"
|
|
||||||
this.color = Color(0xEA4F03)
|
|
||||||
|
|
||||||
this.thumbnail {
|
|
||||||
this.url = "https://static.moonleay.net/img/lilJudd/grizz.png"
|
|
||||||
}
|
|
||||||
|
|
||||||
this.field {
|
|
||||||
this.name = "Current (${
|
|
||||||
TimeUtil.getTimeFromJSONTimeLong(
|
|
||||||
salSched.startTime,
|
|
||||||
"UTC"
|
|
||||||
)
|
|
||||||
} - ${TimeUtil.getTimeFromJSONTimeLong(salSched.endTime, "UTC")})"
|
|
||||||
this.value =
|
|
||||||
"${salBoss} on ${salMap} with ${salWeapons[0].name}, ${salWeapons[1].name}, ${salWeapons[2].name} & ${salWeapons[3].name}"
|
|
||||||
this.inline = false
|
|
||||||
}
|
|
||||||
|
|
||||||
this.field {
|
|
||||||
this.name = "${
|
|
||||||
TimeUtil.getTimeFromJSONTimeLong(
|
|
||||||
salSched2.startTime,
|
|
||||||
"UTC"
|
|
||||||
)
|
|
||||||
} - ${TimeUtil.getTimeFromJSONTimeLong(salSched2.endTime, "UTC")}"
|
|
||||||
this.value =
|
|
||||||
"${salBoss2} on ${salMap2} with ${salWeapons2[0].name}, ${salWeapons2[1].name}, ${salWeapons2[2].name} & ${salWeapons2[3].name}"
|
|
||||||
this.inline = false
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
this.timestamp = Clock.System.now()
|
|
||||||
this.footer {
|
|
||||||
this.text = "Data provided by splatoon3.ink"
|
|
||||||
this.icon = "https://fedi.splatoon3.ink/favicon.png"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
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"
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
|
@ -41,7 +41,7 @@ class SendPlannerExtension : Extension() {
|
||||||
get() = false
|
get() = false
|
||||||
|
|
||||||
override suspend fun setup() {
|
override suspend fun setup() {
|
||||||
publicSlashCommand {
|
publicSlashCommand() {
|
||||||
name = "sendplanner"
|
name = "sendplanner"
|
||||||
description = "Send the planner for the current week"
|
description = "Send the planner for the current week"
|
||||||
this.action {
|
this.action {
|
||||||
|
|
|
@ -34,7 +34,7 @@ class UpdateRolesExtension : Extension() {
|
||||||
get() = false
|
get() = false
|
||||||
|
|
||||||
override suspend fun setup() {
|
override suspend fun setup() {
|
||||||
publicSlashCommand {
|
publicSlashCommand() {
|
||||||
name = "updateroles"
|
name = "updateroles"
|
||||||
description = "Update the roles of the members in the current server"
|
description = "Update the roles of the members in the current server"
|
||||||
this.action {
|
this.action {
|
||||||
|
|
|
@ -1,30 +0,0 @@
|
||||||
/*
|
|
||||||
* lilJudd
|
|
||||||
* Copyright (C) 2024 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"),
|
|
||||||
}
|
|
|
@ -30,7 +30,7 @@ object StatusUpdater : ICronjob {
|
||||||
override val jobName: String
|
override val jobName: String
|
||||||
get() = "StatusUpdater"
|
get() = "StatusUpdater"
|
||||||
override val jobIncoming: String
|
override val jobIncoming: String
|
||||||
get() = "/30 * * * * * 0o *" //Every 30 seconds
|
get() = "/10 * * * * * 0o *" //Every 5 seconds
|
||||||
override val jobType: CronjobType
|
override val jobType: CronjobType
|
||||||
get() = CronjobType.INFINITE
|
get() = CronjobType.INFINITE
|
||||||
override val continueJob: Boolean
|
override val continueJob: Boolean
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* lilJudd
|
* lilJudd
|
||||||
* Copyright (C) 2024 moonleay
|
* Copyright (C) 2023 moonleay
|
||||||
*
|
*
|
||||||
* This program is free software: you can redistribute it and/or modify
|
* 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
|
* it under the terms of the GNU General Public License as published by
|
||||||
|
@ -177,24 +177,6 @@ object TimeUtil {
|
||||||
return ZonedDateTime.of(localDateTime, zoneId).toEpochSecond() * 1000
|
return ZonedDateTime.of(localDateTime, zoneId).toEpochSecond() * 1000
|
||||||
}
|
}
|
||||||
|
|
||||||
fun getTimeFromJSONTime(inp: String, zone: String): String {
|
|
||||||
// 2023-10-05T08:00:00Z
|
|
||||||
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'")
|
|
||||||
val localDateTime = LocalDateTime.parse(inp, formatter)
|
|
||||||
val zoneId = ZoneId.of(zone) // TODO: Add the possibility to set your timezone
|
|
||||||
val returnFormat = DateTimeFormatter.ofPattern("HH:mm")
|
|
||||||
return ZonedDateTime.of(localDateTime, zoneId).format(returnFormat)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getTimeFromJSONTimeLong(inp: String, zone: String): String {
|
|
||||||
// 2023-10-05T08:00:00Z
|
|
||||||
val formatter = DateTimeFormatter.ofPattern("yyyy-MM-dd'T'HH:mm:ss'Z'")
|
|
||||||
val localDateTime = LocalDateTime.parse(inp, formatter)
|
|
||||||
val zoneId = ZoneId.of(zone) // TODO: Add the possibility to set your timezone
|
|
||||||
val returnFormat = DateTimeFormatter.ofPattern("dd'/'MM',' HH:mm")
|
|
||||||
return ZonedDateTime.of(localDateTime, zoneId).format(returnFormat)
|
|
||||||
}
|
|
||||||
|
|
||||||
fun getTimeDifferenceFormatted(start: Long, end: Long): String {
|
fun getTimeDifferenceFormatted(start: Long, end: Long): String {
|
||||||
val diff = end - start
|
val diff = end - start
|
||||||
return getTimeFormatedShortend(diff, false)
|
return getTimeFormatedShortend(diff, false)
|
||||||
|
|
Loading…
Reference in a new issue