forked from DiscordBots/lilJudd
feat!: updated rest of the code to use new API system
Signed-off-by: moonleay <contact@moonleay.net>
This commit is contained in:
parent
abd17b3256
commit
894e03c9c6
3 changed files with 13 additions and 21 deletions
|
@ -32,9 +32,7 @@ import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import net.moonleay.lilJudd.buttons.component.EditButtonManager
|
import net.moonleay.lilJudd.buttons.component.EditButtonManager
|
||||||
import net.moonleay.lilJudd.data.CredentialManager
|
import net.moonleay.lilJudd.data.CredentialManager
|
||||||
import net.moonleay.lilJudd.data.api.splatoon3ink.Splatoon3ApiCache
|
import net.moonleay.lilJudd.data.api.splatoon3ink.Splatoon3Api
|
||||||
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiDataType
|
|
||||||
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiRequestType
|
|
||||||
import net.moonleay.lilJudd.data.database.DB
|
import net.moonleay.lilJudd.data.database.DB
|
||||||
import net.moonleay.lilJudd.extensions.*
|
import net.moonleay.lilJudd.extensions.*
|
||||||
import net.moonleay.lilJudd.features.AvailabilityManager
|
import net.moonleay.lilJudd.features.AvailabilityManager
|
||||||
|
@ -173,7 +171,7 @@ object Bot {
|
||||||
}
|
}
|
||||||
|
|
||||||
// Update the Splatoon 3 api data and make sure it stays up-to-date
|
// Update the Splatoon 3 api data and make sure it stays up-to-date
|
||||||
Splatoon3ApiCache.updateData(ApiDataType.SCHEDULES, ApiRequestType.AUTOMATIC_CACHE_CREATION_AT_STARTUP)
|
Splatoon3Api.updateSchedule()
|
||||||
JobManager.addJob(Splatoon3ApiScheduleUpdateScheduler)
|
JobManager.addJob(Splatoon3ApiScheduleUpdateScheduler)
|
||||||
/*
|
/*
|
||||||
Other caches will be added when implemented
|
Other caches will be added when implemented
|
||||||
|
@ -183,10 +181,6 @@ object Bot {
|
||||||
// Had to disable bc of an error.
|
// Had to disable bc of an error.
|
||||||
// Will fix when I have time
|
// Will fix when I have time
|
||||||
|
|
||||||
|
|
||||||
//JobManager.addJob(Splatoon3ApiFestivalAndCoopUpdateScheduler)
|
|
||||||
//JobManager.addJob(Splatoon3ApiSplatnetGearUpdateScheduler)
|
|
||||||
|
|
||||||
//Start the bot
|
//Start the bot
|
||||||
bot.start()
|
bot.start()
|
||||||
}
|
}
|
||||||
|
|
|
@ -20,9 +20,7 @@ package net.moonleay.lilJudd.jobs
|
||||||
|
|
||||||
import dev.inmo.krontab.KronScheduler
|
import dev.inmo.krontab.KronScheduler
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import net.moonleay.lilJudd.data.api.splatoon3ink.Splatoon3ApiCache
|
import net.moonleay.lilJudd.data.api.splatoon3ink.Splatoon3Api
|
||||||
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiDataType
|
|
||||||
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiRequestType
|
|
||||||
import net.moonleay.lilJudd.jobs.component.CronjobType
|
import net.moonleay.lilJudd.jobs.component.CronjobType
|
||||||
import net.moonleay.lilJudd.jobs.component.ICronjob
|
import net.moonleay.lilJudd.jobs.component.ICronjob
|
||||||
import net.moonleay.lilJudd.util.Logger
|
import net.moonleay.lilJudd.util.Logger
|
||||||
|
@ -40,8 +38,8 @@ object Splatoon3ApiScheduleUpdateScheduler : ICronjob {
|
||||||
override lateinit var scheduler: KronScheduler
|
override lateinit var scheduler: KronScheduler
|
||||||
|
|
||||||
override suspend fun jobFunction() {
|
override suspend fun jobFunction() {
|
||||||
Logger.out("Running Splatoon3ApiScheduleUpdateScheduler.")
|
Logger.out("Updating Schedules...")
|
||||||
Splatoon3ApiCache.updateData(ApiDataType.SCHEDULES, ApiRequestType.AUTOMATIC_CACHE_UPDATE)
|
Splatoon3Api.updateSchedule()
|
||||||
Logger.out("Splatoon3ApiScheduleUpdateScheduler finished.")
|
Logger.out("Updating finished.")
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -1,6 +1,6 @@
|
||||||
/*
|
/*
|
||||||
* lilJudd
|
* lilJudd
|
||||||
* Copyright (C) 2023 moonleay
|
* Copyright (C) 2024 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
|
||||||
|
@ -22,7 +22,7 @@ import dev.inmo.krontab.KronScheduler
|
||||||
import dev.kord.common.entity.PresenceStatus
|
import dev.kord.common.entity.PresenceStatus
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import net.moonleay.lilJudd.Bot
|
import net.moonleay.lilJudd.Bot
|
||||||
import net.moonleay.lilJudd.data.api.Splatoon3Api
|
import net.moonleay.lilJudd.data.api.splatoon3ink.Splatoon3ApiDataGrabber
|
||||||
import net.moonleay.lilJudd.jobs.component.CronjobType
|
import net.moonleay.lilJudd.jobs.component.CronjobType
|
||||||
import net.moonleay.lilJudd.jobs.component.ICronjob
|
import net.moonleay.lilJudd.jobs.component.ICronjob
|
||||||
|
|
||||||
|
@ -56,11 +56,11 @@ object StatusUpdater : ICronjob {
|
||||||
|
|
||||||
private fun refreshStatusList(timestamp: Long) {
|
private fun refreshStatusList(timestamp: Long) {
|
||||||
statusList = listOf(
|
statusList = listOf(
|
||||||
Splatoon3Api.getRotationTime(timestamp),
|
Splatoon3ApiDataGrabber.getRotationTime(timestamp),
|
||||||
Splatoon3Api.getRegularMapsFormatted(timestamp),
|
Splatoon3ApiDataGrabber.getRegularMapsFormatted(timestamp),
|
||||||
Splatoon3Api.getOpenMapFormatted(timestamp),
|
Splatoon3ApiDataGrabber.getOpenMapFormatted(timestamp),
|
||||||
Splatoon3Api.getSeriesMapsFormatted(timestamp),
|
Splatoon3ApiDataGrabber.getSeriesMapsFormatted(timestamp),
|
||||||
Splatoon3Api.getXMapFormatted(timestamp)
|
Splatoon3ApiDataGrabber.getXMapFormatted(timestamp)
|
||||||
)
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue