From e02117fa3631ffa07d7ae4eaee3f24df7a5117f0 Mon Sep 17 00:00:00 2001 From: moonleay Date: Thu, 5 Oct 2023 11:41:46 +0200 Subject: [PATCH] feat: registered new jobs and features Signed-off-by: moonleay --- src/main/kotlin/net/moonleay/lilJudd/Bot.kt | 26 ++++++++++++++++++--- 1 file changed, 23 insertions(+), 3 deletions(-) diff --git a/src/main/kotlin/net/moonleay/lilJudd/Bot.kt b/src/main/kotlin/net/moonleay/lilJudd/Bot.kt index 1201560..dc78d89 100644 --- a/src/main/kotlin/net/moonleay/lilJudd/Bot.kt +++ b/src/main/kotlin/net/moonleay/lilJudd/Bot.kt @@ -33,11 +33,17 @@ import kotlinx.coroutines.launch import net.moonleay.botendo.build.BuildConstants import net.moonleay.lilJudd.buttons.component.EditButtonManager 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.extensions.* import net.moonleay.lilJudd.features.AvailabilityManager import net.moonleay.lilJudd.features.MatchManager 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.Logger import net.moonleay.lilJudd.util.MessageUtil @@ -99,7 +105,7 @@ object Bot { } extensions { - add(::VersionExtension) + add(::InfoExtension) add(::FeatureManageExtension) add(::SendPlannerExtension) add(::MatchExtension) @@ -120,7 +126,6 @@ object Bot { sharding { recommended -> Shards(recommended) } */ - // Same goes for a Database table rewrite } // Register button presses @@ -141,7 +146,6 @@ object Bot { } if (inter.componentId.startsWith("public.message.")) { val response = inter.deferPublicResponse() - val g = this.interaction.getOriginalInteractionResponse().getGuild() response.respond { this.embeds = mutableListOf( MessageUtil.getEmbed( @@ -161,6 +165,22 @@ object Bot { 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 bot.start()