Compare commits
No commits in common. "734ac1b74cbdc5451765b4558652361b1462a4ba" and "d8753a8c1fed1264388c99b63a5f0b7586410ac6" have entirely different histories.
734ac1b74c
...
d8753a8c1f
24 changed files with 54 additions and 103 deletions
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* lilJudd
|
||||
* Copyright (C) 2024 moonleay
|
||||
* Copyright (C) 2023 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
|
||||
|
@ -32,9 +32,9 @@ import kotlinx.coroutines.Job
|
|||
import kotlinx.coroutines.launch
|
||||
import net.moonleay.lilJudd.buttons.component.EditButtonManager
|
||||
import net.moonleay.lilJudd.data.CredentialManager
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.Splatoon3ApiCache
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiDataType
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiRequestType
|
||||
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
|
||||
|
@ -74,11 +74,6 @@ object Bot {
|
|||
exitProcess(3)
|
||||
}
|
||||
|
||||
if (CredentialManager.apiDomain == "empty" || CredentialManager.apiToken == "empty") {
|
||||
Logger.out("The config does not contain the whole API credentials.")
|
||||
exitProcess(3)
|
||||
}
|
||||
|
||||
// Connect to the database
|
||||
DB.connect(
|
||||
CredentialManager.dbDomain,
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* lilJudd
|
||||
* Copyright (C) 2024 moonleay
|
||||
* Copyright (C) 2023 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
|
||||
|
@ -29,8 +29,6 @@ object CredentialManager {
|
|||
lateinit var dbName: String
|
||||
lateinit var dbUser: String
|
||||
lateinit var dbPassword: String
|
||||
lateinit var apiDomain: String
|
||||
lateinit var apiToken: String
|
||||
|
||||
///Load the needed credentials, generate a config if there is none
|
||||
fun load() {
|
||||
|
@ -53,8 +51,6 @@ object CredentialManager {
|
|||
dbName = prop.getProperty("dbName")
|
||||
dbUser = prop.getProperty("dbUser")
|
||||
dbPassword = prop.getProperty("dbPassword")
|
||||
apiDomain = prop.getProperty("apiDomain")
|
||||
apiToken = prop.getProperty("apiToken")
|
||||
input.close()
|
||||
} catch (e: IOException) {
|
||||
e.printStackTrace()
|
||||
|
@ -87,8 +83,6 @@ object CredentialManager {
|
|||
prop.setProperty("dbName", "empty")
|
||||
prop.setProperty("dbUser", "empty")
|
||||
prop.setProperty("dbPassword", "empty")
|
||||
prop.setProperty("apiDomain", "empty")
|
||||
prop.setProperty("apiToken", "empty")
|
||||
prop.store(output, null)
|
||||
output.close()
|
||||
|
||||
|
|
|
@ -16,9 +16,9 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.moonleay.lilJudd.data.api.splatoon3ink
|
||||
package net.moonleay.lilJudd.data.api
|
||||
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule.ModeData
|
||||
import net.moonleay.lilJudd.data.api.entry.schedule.ModeData
|
||||
import net.moonleay.lilJudd.util.TimeUtil
|
||||
|
||||
object Splatoon3Api {
|
|
@ -16,21 +16,21 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.moonleay.lilJudd.data.api.splatoon3ink
|
||||
package net.moonleay.lilJudd.data.api
|
||||
|
||||
import io.ktor.http.*
|
||||
import kotlinx.serialization.json.*
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.entry.coop.CoopGearData
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule.*
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatfest.SplatfestColor
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatfest.SplatfestData
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatfest.SplatfestTeamData
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatfest.SplatfestTeamResults
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatnet.BrandData
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatnet.GearAbilityData
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatnet.SplatnetItemData
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiDataType
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiRequestType
|
||||
import net.moonleay.lilJudd.data.api.entry.coop.CoopGearData
|
||||
import net.moonleay.lilJudd.data.api.entry.schedule.*
|
||||
import net.moonleay.lilJudd.data.api.entry.splatfest.SplatfestColor
|
||||
import net.moonleay.lilJudd.data.api.entry.splatfest.SplatfestData
|
||||
import net.moonleay.lilJudd.data.api.entry.splatfest.SplatfestTeamData
|
||||
import net.moonleay.lilJudd.data.api.entry.splatfest.SplatfestTeamResults
|
||||
import net.moonleay.lilJudd.data.api.entry.splatnet.BrandData
|
||||
import net.moonleay.lilJudd.data.api.entry.splatnet.GearAbilityData
|
||||
import net.moonleay.lilJudd.data.api.entry.splatnet.SplatnetItemData
|
||||
import net.moonleay.lilJudd.data.api.type.ApiDataType
|
||||
import net.moonleay.lilJudd.data.api.type.ApiRequestType
|
||||
import net.moonleay.lilJudd.util.Logger
|
||||
import net.moonleay.lilJudd.util.NetUtil
|
||||
import net.moonleay.liljudd.build.BuildConstants
|
||||
|
@ -49,14 +49,13 @@ object Splatoon3ApiCache {
|
|||
internal var cachedChallengesData = mutableListOf<ChallengeModeData>()
|
||||
internal var cachedShiftData = mutableListOf<ShiftData>()
|
||||
internal var cachedBigRunShiftData = mutableListOf<ShiftData>()
|
||||
internal var cachedCoopRewardsData =
|
||||
mutableListOf<CoopGearData>()
|
||||
internal var cachedCoopRewardsData = mutableListOf<CoopGearData>()
|
||||
internal var cachedSplatnetItemData = mutableListOf<SplatnetItemData>()
|
||||
internal var cachedSplatnetLimitedItemData = mutableListOf<SplatnetItemData>()
|
||||
internal lateinit var splatnetShopBrandData: BrandData
|
||||
internal lateinit var splatnetShopNextBrandData: BrandData
|
||||
fun updateData(dataType: ApiDataType, requestType: ApiRequestType) {
|
||||
Logger.out("Updating data for $dataType with USER-AGENT: ${user_agent}")
|
||||
Logger.out("Updating data for $dataType with USER-AGENT: $user_agent")
|
||||
Logger.out("Reason for update: $requestType")
|
||||
when (dataType) {
|
||||
ApiDataType.SCHEDULES -> {
|
||||
|
@ -226,8 +225,7 @@ object Splatoon3ApiCache {
|
|||
val obj = it as JsonObject
|
||||
val imageURL = Url(obj.jsonObject["originalImage"]!!.jsonObject["url"]!!.jsonPrimitive.content)
|
||||
val id = obj.jsonObject["vsStageId"]!!.jsonPrimitive.int
|
||||
cachedMapData[id] =
|
||||
MapData(
|
||||
cachedMapData[id] = MapData(
|
||||
id,
|
||||
imageURL,
|
||||
it.jsonObject["name"]!!.jsonPrimitive.content
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.coop
|
||||
package net.moonleay.lilJudd.data.api.entry.coop
|
||||
|
||||
import io.ktor.http.*
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule
|
||||
package net.moonleay.lilJudd.data.api.entry.schedule
|
||||
|
||||
data class ChallengeModeData(
|
||||
val leagueMatchEventId: String,
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule
|
||||
package net.moonleay.lilJudd.data.api.entry.schedule
|
||||
|
||||
import io.ktor.http.*
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule
|
||||
package net.moonleay.lilJudd.data.api.entry.schedule
|
||||
|
||||
data class ModeData(
|
||||
val startTime: String,
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule
|
||||
package net.moonleay.lilJudd.data.api.entry.schedule
|
||||
|
||||
import io.ktor.http.*
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule
|
||||
package net.moonleay.lilJudd.data.api.entry.schedule
|
||||
|
||||
data class TimePeriodData(
|
||||
val startTime: String,
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.schedule
|
||||
package net.moonleay.lilJudd.data.api.entry.schedule
|
||||
|
||||
import io.ktor.http.*
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatfest
|
||||
package net.moonleay.lilJudd.data.api.entry.splatfest
|
||||
|
||||
data class SplatfestColor(
|
||||
val a: Int,
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatfest
|
||||
package net.moonleay.lilJudd.data.api.entry.splatfest
|
||||
|
||||
import io.ktor.http.*
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatfest
|
||||
package net.moonleay.lilJudd.data.api.entry.splatfest
|
||||
|
||||
data class SplatfestTeamData(
|
||||
val teamName: String,
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatfest
|
||||
package net.moonleay.lilJudd.data.api.entry.splatfest
|
||||
|
||||
data class SplatfestTeamResults(
|
||||
val isWinner: Boolean,
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatnet
|
||||
package net.moonleay.lilJudd.data.api.entry.splatnet
|
||||
|
||||
import io.ktor.http.*
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatnet
|
||||
package net.moonleay.lilJudd.data.api.entry.splatnet
|
||||
|
||||
import io.ktor.http.*
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.moonleay.lilJudd.data.api.splatoon3ink.entry.splatnet
|
||||
package net.moonleay.lilJudd.data.api.entry.splatnet
|
||||
|
||||
import io.ktor.http.*
|
||||
|
|
@ -1,36 +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.data.api.liljudd
|
||||
|
||||
import net.moonleay.lilJudd.data.CredentialManager
|
||||
|
||||
object LilJuddApi {
|
||||
val CONFIG_BASE = "${CredentialManager.apiDomain}/config/"
|
||||
val MATCH_BASE = "${CredentialManager.apiDomain}/match/"
|
||||
val TIMEPLANNINGMESSAGES_BASE = "${CredentialManager.apiDomain}/tp_messages/"
|
||||
|
||||
// GET https://liljudd.ink/api/config/<guild_id>/
|
||||
// DELETE https://liljudd.ink/api/config/<guild_id>/
|
||||
// GET https://liljudd.ink/api/tp_messages/<guild_id>/
|
||||
// PUT https://liljudd.ink/api/tp_messages/<guild_id>/
|
||||
// POST https://liljudd.ink/api/match/<guild_id>/<channel_id>/
|
||||
// PUT https://liljudd.ink/api/match/<guild_id>/<channel_id>/<match_message_id>/
|
||||
// GET https://liljudd.ink/api/match/<guild_id>/
|
||||
|
||||
}
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.moonleay.lilJudd.data.api.splatoon3ink.type
|
||||
package net.moonleay.lilJudd.data.api.type
|
||||
|
||||
enum class ApiDataType {
|
||||
SCHEDULES,
|
|
@ -16,7 +16,7 @@
|
|||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||
*/
|
||||
|
||||
package net.moonleay.lilJudd.data.api.splatoon3ink.type
|
||||
package net.moonleay.lilJudd.data.api.type
|
||||
|
||||
enum class ApiRequestType(val nameToDisplay: String) {
|
||||
AUTOMATIC_CACHE_UPDATE("automatic request to update the cache"),
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* lilJudd
|
||||
* Copyright (C) 2024 moonleay
|
||||
* Copyright (C) 2023 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
|
||||
|
@ -20,9 +20,9 @@ package net.moonleay.lilJudd.jobs
|
|||
|
||||
import dev.inmo.krontab.KronScheduler
|
||||
import kotlinx.coroutines.Job
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.Splatoon3ApiCache
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiDataType
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiRequestType
|
||||
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.jobs.component.CronjobType
|
||||
import net.moonleay.lilJudd.jobs.component.ICronjob
|
||||
import net.moonleay.lilJudd.util.Logger
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* lilJudd
|
||||
* Copyright (C) 2024 moonleay
|
||||
* Copyright (C) 2023 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
|
||||
|
@ -20,9 +20,9 @@ package net.moonleay.lilJudd.jobs
|
|||
|
||||
import dev.inmo.krontab.KronScheduler
|
||||
import kotlinx.coroutines.Job
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.Splatoon3ApiCache
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiDataType
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiRequestType
|
||||
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.jobs.component.CronjobType
|
||||
import net.moonleay.lilJudd.jobs.component.ICronjob
|
||||
import net.moonleay.lilJudd.util.Logger
|
||||
|
|
|
@ -1,6 +1,6 @@
|
|||
/*
|
||||
* lilJudd
|
||||
* Copyright (C) 2024 moonleay
|
||||
* Copyright (C) 2023 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
|
||||
|
@ -20,9 +20,9 @@ package net.moonleay.lilJudd.jobs
|
|||
|
||||
import dev.inmo.krontab.KronScheduler
|
||||
import kotlinx.coroutines.Job
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.Splatoon3ApiCache
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiDataType
|
||||
import net.moonleay.lilJudd.data.api.splatoon3ink.type.ApiRequestType
|
||||
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.jobs.component.CronjobType
|
||||
import net.moonleay.lilJudd.jobs.component.ICronjob
|
||||
import net.moonleay.lilJudd.util.Logger
|
||||
|
|
Loading…
Reference in a new issue