feat: reworked Rotation Status
Signed-off-by: moonleay <contact@moonleay.net>
This commit is contained in:
parent
5ad7fe0ae6
commit
60c30af3e9
2 changed files with 32 additions and 35 deletions
|
@ -66,52 +66,50 @@ object Splatoon3Api {
|
|||
throw Exception("No current mode found")
|
||||
}
|
||||
|
||||
fun getRotationTime(timestamp: Long): String {
|
||||
val modeData = getRegularMode(timestamp)
|
||||
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
||||
val diffStamp = TimeUtil.getTimeDifferenceFormatted(System.currentTimeMillis(), endTime)
|
||||
return "$diffStamp left in rotation"
|
||||
}
|
||||
|
||||
fun getRegularMapsFormatted(timestamp: Long): String {
|
||||
val modeData = getRegularMode(timestamp)
|
||||
val map1 = modeData.map1!!.name.split(" ")[0]
|
||||
val map2 = modeData.map2!!.name.split(" ")[0]
|
||||
return "R: $map1 & $map2"
|
||||
}
|
||||
|
||||
fun getOpenModeFormatted(timestamp: Long): String {
|
||||
val modeData = getOpenMode(timestamp)
|
||||
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
||||
val diffStamp = TimeUtil.getTimeDifferenceFormatted(System.currentTimeMillis(), endTime)
|
||||
return "O: ${modeData.ruleSetName} $diffStamp left"
|
||||
return "R: $map1, $map2"
|
||||
}
|
||||
|
||||
fun getOpenMapFormatted(timestamp: Long): String {
|
||||
val modeData = getOpenMode(timestamp)
|
||||
val map1 = modeData.map1!!.name.split(" ")[0]
|
||||
val map2 = modeData.map2!!.name.split(" ")[0]
|
||||
return "O: $map1 & $map2"
|
||||
}
|
||||
|
||||
fun getSeriesModeFormatted(timestamp: Long): String {
|
||||
val modeData = getSeriesMode(timestamp)
|
||||
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
||||
val diffStamp = TimeUtil.getTimeDifferenceFormatted(System.currentTimeMillis(), endTime)
|
||||
return "S: ${modeData.ruleSetName} $diffStamp left"
|
||||
return "O: ${modeData.ruleSetName}: $map1, $map2"
|
||||
.replace("Rainmaker", "RMK")
|
||||
.replace("Tower Control", "TC")
|
||||
.replace("Splat Zones", "SZ")
|
||||
.replace("Clam Blitz", "CB")
|
||||
}
|
||||
|
||||
fun getSeriesMapsFormatted(timestamp: Long): String {
|
||||
val modeData = getSeriesMode(timestamp)
|
||||
val map1 = modeData.map1!!.name.split(" ")[0]
|
||||
val map2 = modeData.map2!!.name.split(" ")[0]
|
||||
return "S: $map1 & $map2"
|
||||
}
|
||||
|
||||
fun getXModeFormatted(timestamp: Long): String {
|
||||
val modeData = getXMode(timestamp)
|
||||
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
||||
val diffStamp = TimeUtil.getTimeDifferenceFormatted(System.currentTimeMillis(), endTime)
|
||||
return "X: ${modeData.ruleSetName} $diffStamp left"
|
||||
return "S: ${modeData.ruleSetName}: $map1, $map2"
|
||||
.replace("Rainmaker", "RMK")
|
||||
.replace("Tower Control", "TC")
|
||||
.replace("Splat Zones", "SZ")
|
||||
.replace("Clam Blitz", "CB")
|
||||
}
|
||||
|
||||
fun getXMapFormatted(timestamp: Long): String {
|
||||
val modeData = getXMode(timestamp)
|
||||
val map1 = modeData.map1!!.name.split(" ")[0]
|
||||
val map2 = modeData.map2!!.name.split(" ")[0]
|
||||
return "X: $map1 & $map2"
|
||||
return "X: ${modeData.ruleSetName}: $map1, $map2"
|
||||
.replace("Rainmaker", "RMK")
|
||||
.replace("Tower Control", "TC")
|
||||
.replace("Splat Zones", "SZ")
|
||||
.replace("Clam Blitz", "CB")
|
||||
}
|
||||
}
|
||||
|
|
|
@ -41,27 +41,26 @@ object StatusUpdater : ICronjob {
|
|||
private var statusList = listOf<String>()
|
||||
private var index = 0
|
||||
|
||||
// I h8 this job. I'll recode this someday.
|
||||
override suspend fun jobFunction() {
|
||||
refreshStatusList(System.currentTimeMillis())
|
||||
if (index >= statusList.size) {
|
||||
index = 0
|
||||
refreshStatusList(System.currentTimeMillis())
|
||||
}
|
||||
Bot.bot.kordRef.editPresence {
|
||||
this.status = PresenceStatus.DoNotDisturb
|
||||
this.competing(statusList[index])
|
||||
}
|
||||
++index
|
||||
if (index >= statusList.size) {
|
||||
index = 0
|
||||
}
|
||||
}
|
||||
|
||||
fun refreshStatusList(timestamp: Long) {
|
||||
private fun refreshStatusList(timestamp: Long) {
|
||||
statusList = listOf(
|
||||
Splatoon3Api.getRotationTime(timestamp),
|
||||
Splatoon3Api.getRegularMapsFormatted(timestamp),
|
||||
Splatoon3Api.getSeriesModeFormatted(timestamp),
|
||||
Splatoon3Api.getSeriesMapsFormatted(timestamp),
|
||||
Splatoon3Api.getOpenModeFormatted(timestamp),
|
||||
Splatoon3Api.getOpenMapFormatted(timestamp),
|
||||
Splatoon3Api.getXModeFormatted(timestamp),
|
||||
Splatoon3Api.getXMapFormatted(timestamp),
|
||||
Splatoon3Api.getSeriesMapsFormatted(timestamp),
|
||||
Splatoon3Api.getXMapFormatted(timestamp)
|
||||
)
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue