feat: registered new jobs and features

Signed-off-by: moonleay <contact@moonleay.net>
This commit is contained in:
moonleay 2023-10-05 11:41:46 +02:00
parent 5b4b3c9828
commit 84f0176ba4

View file

@ -33,11 +33,17 @@ import kotlinx.coroutines.launch
import net.moonleay.botendo.build.BuildConstants import net.moonleay.botendo.build.BuildConstants
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.Splatoon3ApiCache
import net.moonleay.lilJudd.data.api.type.ApiDataType
import net.moonleay.lilJudd.data.api.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
import net.moonleay.lilJudd.features.MatchManager import net.moonleay.lilJudd.features.MatchManager
import net.moonleay.lilJudd.features.TimeManager import net.moonleay.lilJudd.features.TimeManager
import net.moonleay.lilJudd.jobs.Splatoon3ApiScheduleUpdateScheduler
import net.moonleay.lilJudd.jobs.StatusUpdater
import net.moonleay.lilJudd.jobs.component.JobManager
import net.moonleay.lilJudd.util.EmbedColor import net.moonleay.lilJudd.util.EmbedColor
import net.moonleay.lilJudd.util.Logger import net.moonleay.lilJudd.util.Logger
import net.moonleay.lilJudd.util.MessageUtil import net.moonleay.lilJudd.util.MessageUtil
@ -99,7 +105,7 @@ object Bot {
} }
extensions { extensions {
add(::VersionExtension) add(::InfoExtension)
add(::FeatureManageExtension) add(::FeatureManageExtension)
add(::SendPlannerExtension) add(::SendPlannerExtension)
add(::MatchExtension) add(::MatchExtension)
@ -120,7 +126,6 @@ object Bot {
sharding { recommended -> sharding { recommended ->
Shards(recommended) Shards(recommended)
} */ } */
// Same goes for a Database table rewrite
} }
// Register button presses // Register button presses
@ -141,7 +146,6 @@ object Bot {
} }
if (inter.componentId.startsWith("public.message.")) { if (inter.componentId.startsWith("public.message.")) {
val response = inter.deferPublicResponse() val response = inter.deferPublicResponse()
val g = this.interaction.getOriginalInteractionResponse().getGuild()
response.respond { response.respond {
this.embeds = mutableListOf( this.embeds = mutableListOf(
MessageUtil.getEmbed( MessageUtil.getEmbed(
@ -161,6 +165,22 @@ object Bot {
MatchManager.update() // Update Matches MatchManager.update() // Update Matches
} }
// Update the Splatoon 3 api data and make sure it stays up-to-date
Splatoon3ApiCache.updateData(ApiDataType.SCHEDULES, ApiRequestType.AUTOMATIC_CACHE_CREATION_AT_STARTUP)
JobManager.addJob(Splatoon3ApiScheduleUpdateScheduler)
/*
Other caches will be added when implemented
its not used yet in order to reduce load on the api,
which i am using.
*/
//JobManager.addJob(Splatoon3ApiFestivalAndCoopUpdateScheduler)
//JobManager.addJob(Splatoon3ApiSplatnetGearUpdateScheduler)
// Make the bot update the status every 10 seconds
JobManager.addJob(StatusUpdater)
// Update the status messages for the bot
StatusUpdater.refreshStatusList(System.currentTimeMillis())
//Start the bot //Start the bot
bot.start() bot.start()