forked from DiscordBots/lilJudd
Compare commits
107 commits
Author | SHA1 | Date | |
---|---|---|---|
4b46d34f45 | |||
0cd3e4d6a8 | |||
a7e656bcbe | |||
404e043da1 | |||
c65e4031d9 | |||
ab7016cdb3 | |||
d928258028 | |||
8e1551cd6c | |||
4dceef6a1f | |||
906c41be88 | |||
0f399cb58c | |||
95321b4895 | |||
d0ae43e420 | |||
46ee799760 | |||
02b29da5fd | |||
98cdbebf79 | |||
05b4dc39b5 | |||
58f2379f45 | |||
39917e4b5a | |||
97d4143cda | |||
b65dadd42f | |||
38d61ae862 | |||
2182f8751a | |||
894e03c9c6 | |||
abd17b3256 | |||
ec92cac2e7 | |||
0f2410c7c1 | |||
734ac1b74c | |||
e6803f6474 | |||
f3b28ac392 | |||
d8753a8c1f | |||
c1536b259b | |||
7d442bd224 | |||
5581f8f348 | |||
a2dafa5c72 | |||
fc7edc0d0d | |||
b2c43e2c04 | |||
32da9ac7af | |||
d71db45532 | |||
60c30af3e9 | |||
5ad7fe0ae6 | |||
52703b4b61 | |||
984bcabd0c | |||
94149e4272 | |||
0bf527b6e0 | |||
05d2d1a6b9 | |||
5b613d25f2 | |||
bf057dd317 | |||
dac2bdd6d3 | |||
75b8321ba6 | |||
2834989bbb | |||
486417b383 | |||
a2fa3c0d51 | |||
daf3ed0c21 | |||
89e6142ebf | |||
390cd2a345 | |||
e02117fa36 | |||
594050dd61 | |||
ef6820da11 | |||
1b24a9b7d7 | |||
1c17a5d2be | |||
886d891787 | |||
06edbb9288 | |||
028e566c70 | |||
984c9653d9 | |||
11cc32ce72 | |||
59c399d41f | |||
9e1a06bdd5 | |||
1cdcef209b | |||
76571f10e4 | |||
8c33192472 | |||
ea505a1395 | |||
344751b9de | |||
9072109b34 | |||
a730bdffa5 | |||
39c8867722 | |||
47a703156c | |||
3d1b2750e5 | |||
3695f716ed | |||
4e4876a61d | |||
2b42ef5dec | |||
79b0dd8d6a | |||
266376f7cb | |||
0a2368417a | |||
24687d4060 | |||
1cd622a778 | |||
50ab9c0b0d | |||
eee820917d | |||
8a2d2be505 | |||
e0e522f561 | |||
5ce99c904e | |||
7d1952d870 | |||
266b331699 | |||
fa0ba09412 | |||
998de8bae5 | |||
5d2ef4fc44 | |||
6b612dcec6 | |||
8dd123fe44 | |||
5431515976 | |||
9c27e13ec6 | |||
b8915cfefa | |||
e051335d84 | |||
c16ff4bdba | |||
4f3c76910c | |||
6ab6aa1279 | |||
a3d3005ff0 | |||
0c363391ba |
117 changed files with 2846 additions and 1545 deletions
|
@ -1,3 +1,4 @@
|
||||||
**.nils
|
**.nils
|
||||||
/run
|
/run
|
||||||
/run/
|
/run/
|
||||||
|
docker-compose.yml
|
||||||
|
|
|
@ -5,12 +5,10 @@ on:
|
||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
build-gradle-project:
|
build-gradle-project:
|
||||||
runs-on: ubuntu-latest
|
runs-on: docker
|
||||||
steps:
|
steps:
|
||||||
- name: apt update
|
- name: apt update
|
||||||
run: apt update
|
run: apt update
|
||||||
- name: apt upgrade
|
|
||||||
run: apt upgrade -y
|
|
||||||
- name: install prerequisits
|
- name: install prerequisits
|
||||||
run: apt install openjdk-17-jdk ca-certificates-java ssl-cert openssl ca-certificates -y
|
run: apt install openjdk-17-jdk ca-certificates-java ssl-cert openssl ca-certificates -y
|
||||||
- name: Checkout project sources
|
- name: Checkout project sources
|
||||||
|
|
29
README.md
29
README.md
|
@ -4,15 +4,13 @@
|
||||||
|
|
||||||
A Discord Bot for Splatoon Teams.
|
A Discord Bot for Splatoon Teams.
|
||||||
|
|
||||||
More information can be found on the [Homepage](https://liljudd.ink).
|
|
||||||
|
|
||||||
## Contributors
|
## Contributors
|
||||||
|
|
||||||
[![Developer](https://img.shields.io/badge/moonleay-Developer-red)](https://gitlab.com/moonleay)
|
[![Developer](https://img.shields.io/badge/moonleay-Developer-red)](https://gitlab.com/moonleay)
|
||||||
|
|
||||||
## Known issues
|
## Known issues
|
||||||
|
|
||||||
##### If you encounter any bugs, message me on Discord (@moonleay) or send me a mail (issues@moonleay.net). You can also open a ticket [on the support server](https://discord.gg/HTZRktfH4A).
|
##### If you encounter any bugs, message me on Discord (@moonleay) or email me (issues@moonleay.net). You can also open a ticket [on the support server](https://discord.gg/HTZRktfH4A).
|
||||||
|
|
||||||
## Commands & Features
|
## Commands & Features
|
||||||
|
|
||||||
|
@ -22,23 +20,34 @@ More information can be found on the [Homepage](https://liljudd.ink).
|
||||||
- match -- Create a new match
|
- match -- Create a new match
|
||||||
- updateroles -- Update the roles of all users
|
- updateroles -- Update the roles of all users
|
||||||
- sendplanner -- Send the planner message
|
- sendplanner -- Send the planner message
|
||||||
|
- rotation -- See the current rotation
|
||||||
- Features
|
- Features
|
||||||
- Time Planner -- Make the bot send messages and reactions into a selected channel in order to make planning easier
|
- Time Planner -- Make the bot send messages and reactions into a selected channel in order to make planning easier
|
||||||
- Availability Manager -- Make the bot assign users roles every day, so it is possible to notify available people
|
- Availability Manager -- Make the bot assign users roles every day, so it is possible to notify available people
|
||||||
- Match Planner -- Make a match, for which players can sign up and the bot will assign teams and roles to them
|
- Match Planner -- Make a match, for which players can sign up and the bot will assign teams and roles to them
|
||||||
|
|
||||||
## (Maybe) upcoming features
|
## The todo list
|
||||||
|
|
||||||
##### See the [todo list](https://todo.moonleay.net/share/OmisuzgPDdsrCAXKjGrTfYzWwqNDNclOMGJWeMsi/auth?view=kanban) for more information.
|
##### See the [todo list](https://todo.moonleay.net/share/OmisuzgPDdsrCAXKjGrTfYzWwqNDNclOMGJWeMsi/auth?view=kanban) for more information.
|
||||||
|
|
||||||
## How to self-host (using the Docker container)
|
## How to self-host (using the Docker container)
|
||||||
|
|
||||||
1. Pull the container from [Docker Hub](https://hub.docker.com/repository/docker/limiteddev/liljudd/general)
|
1. Copy the docker-compose.yml file from the repository.
|
||||||
2. Map /data/ to a folder on disk
|
2. Install docker and docker-compose.
|
||||||
3. Run the Bot once
|
3. Create a directory called "data" in the same directory as the docker-compose.yml file.
|
||||||
4. follow step 4 and 5 from the JAR section
|
4. Create a directory called "config" in the same directory as the docker-compose.yml file.
|
||||||
5. Run the Bot again
|
5. Start the bot once.
|
||||||
6. Profit.
|
6. After 10 seconds, stop the bot.
|
||||||
|
7. Open the config file "credentials.nils" in the config directory.
|
||||||
|
8. Put in your credentials.
|
||||||
|
1. token: your Discord bot token
|
||||||
|
2. dbDomain: the domain and port of your postgresql database (e.g.: "postgresql", when using the docker-compose.yml
|
||||||
|
file)
|
||||||
|
3. dbName: the name of the database
|
||||||
|
4. dbUser: the username of the database
|
||||||
|
5. dbPassword: the password to the db user
|
||||||
|
9. Start the bot again.
|
||||||
|
10. The bot should now be up and running.
|
||||||
|
|
||||||
## How to self-host (using the JAR)
|
## How to self-host (using the JAR)
|
||||||
|
|
||||||
|
|
|
@ -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
|
||||||
|
@ -21,25 +21,27 @@ import org.jetbrains.gradle.ext.TaskTriggersConfig
|
||||||
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
import org.jetbrains.kotlin.gradle.tasks.KotlinCompile
|
||||||
|
|
||||||
plugins {
|
plugins {
|
||||||
kotlin("jvm") version "1.9.10"
|
kotlin("jvm") version "1.9.22"
|
||||||
|
kotlin("plugin.serialization") version "1.9.22"
|
||||||
id("com.github.johnrengelman.shadow") version "8.1.1"
|
id("com.github.johnrengelman.shadow") version "8.1.1"
|
||||||
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.7"
|
id("org.jetbrains.gradle.plugin.idea-ext") version "1.1.7"
|
||||||
`maven-publish`
|
`maven-publish`
|
||||||
}
|
}
|
||||||
|
|
||||||
//lilJudd version 2
|
//lilJudd version 2
|
||||||
val ownerID = 372703841151614976L
|
val creatorID = 372703841151614976L
|
||||||
group = "net.moonleay.liljudd"
|
group = "net.moonleay.liljudd"
|
||||||
version = System.getenv("CI_COMMIT_TAG")?.let { "$it-${System.getenv("CI_COMMIT_SHORT_SHA")}-prod" }
|
version = System.getenv("CI_COMMIT_TAG")?.let { "$it-${System.getenv("CI_COMMIT_SHORT_SHA")}-prod" }
|
||||||
?: System.getenv("CI_COMMIT_SHORT_SHA")?.let { "$it-dev" }
|
?: System.getenv("CI_COMMIT_SHORT_SHA")?.let { "$it-dev" }
|
||||||
?: "2.6.5"
|
?: "2.7.2"
|
||||||
|
|
||||||
val kordver = "1.5.9-SNAPSHOT"
|
val kordver = "1.7.1-SNAPSHOT"
|
||||||
val coroutinesver = "1.7.3"
|
val coroutinesver = "1.7.3"
|
||||||
val ktorver = "2.3.5"
|
val ktorver = "2.3.7"
|
||||||
val exposedver = "0.43.0"
|
val exposedver = "0.46.0"
|
||||||
val postgresver = "42.6.0"
|
val postgresver = "42.7.1"
|
||||||
val krontabver = "2.2.1"
|
val krontabver = "2.2.6"
|
||||||
|
val kotlinxserializationver = "1.6.0"
|
||||||
|
|
||||||
val mavenArtifact = "lilJudd"
|
val mavenArtifact = "lilJudd"
|
||||||
project.base.archivesName.set(mavenArtifact)
|
project.base.archivesName.set(mavenArtifact)
|
||||||
|
@ -93,6 +95,9 @@ dependencies {
|
||||||
//Coroutines
|
//Coroutines
|
||||||
shadow("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesver")
|
shadow("org.jetbrains.kotlinx:kotlinx-coroutines-core:$coroutinesver")
|
||||||
|
|
||||||
|
//JSON Stuff
|
||||||
|
shadow("org.jetbrains.kotlinx:kotlinx-serialization-json:$kotlinxserializationver")
|
||||||
|
|
||||||
//Logging
|
//Logging
|
||||||
shadow("org.slf4j:slf4j-api:2.0.3")
|
shadow("org.slf4j:slf4j-api:2.0.3")
|
||||||
shadow("org.slf4j:slf4j-simple:2.0.3")
|
shadow("org.slf4j:slf4j-simple:2.0.3")
|
||||||
|
@ -105,8 +110,8 @@ dependencies {
|
||||||
|
|
||||||
//Krontab
|
//Krontab
|
||||||
shadow("dev.inmo:krontab:$krontabver")
|
shadow("dev.inmo:krontab:$krontabver")
|
||||||
shadow("io.ktor:ktor-client-core-jvm:2.3.5")
|
shadow("io.ktor:ktor-client-core-jvm:$ktorver")
|
||||||
shadow("io.ktor:ktor-client-cio-jvm:2.3.5")
|
shadow("io.ktor:ktor-client-cio-jvm:$ktorver")
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -115,13 +120,14 @@ val templateSrc = project.rootDir.resolve("src/main/templates")
|
||||||
val templateDest = project.projectDir.resolve("build/generated/templates")
|
val templateDest = project.projectDir.resolve("build/generated/templates")
|
||||||
val templateProps = mapOf(
|
val templateProps = mapOf(
|
||||||
"version" to project.version as String,
|
"version" to project.version as String,
|
||||||
"ownerID" to ownerID,
|
"creatorID" to creatorID,
|
||||||
"kordversion" to kordver,
|
"kordversion" to kordver,
|
||||||
"coroutinesversion" to coroutinesver,
|
"coroutinesversion" to coroutinesver,
|
||||||
"ktorversion" to ktorver,
|
"ktorversion" to ktorver,
|
||||||
"exposedversion" to exposedver,
|
"exposedversion" to exposedver,
|
||||||
"postgresversion" to postgresver,
|
"postgresversion" to postgresver,
|
||||||
"krontabversion" to krontabver
|
"krontabversion" to krontabver,
|
||||||
|
"kotlinxserializationversion" to kotlinxserializationver
|
||||||
)
|
)
|
||||||
|
|
||||||
|
|
||||||
|
|
32
docker-compose.yml
Normal file
32
docker-compose.yml
Normal file
|
@ -0,0 +1,32 @@
|
||||||
|
version: "3"
|
||||||
|
services:
|
||||||
|
lilJudd:
|
||||||
|
container_name: liljudd
|
||||||
|
image: limiteddev/liljudd:x.x.x
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: "1"
|
||||||
|
memory: 1G
|
||||||
|
networks:
|
||||||
|
- traefik
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./config/liljudd/:/data/
|
||||||
|
postgresql:
|
||||||
|
container_name: postgresql
|
||||||
|
image: postgres:13.3-alpine
|
||||||
|
deploy:
|
||||||
|
resources:
|
||||||
|
limits:
|
||||||
|
cpus: "1"
|
||||||
|
memory: 1G
|
||||||
|
environment:
|
||||||
|
- POSTGRES_USER=liljudd
|
||||||
|
- POSTGRES_PASSWORD=changeme
|
||||||
|
- POSTGRES_DB=liljudd
|
||||||
|
networks:
|
||||||
|
- traefik
|
||||||
|
restart: unless-stopped
|
||||||
|
volumes:
|
||||||
|
- ./data/postgresql/:/var/lib/postgresql/data/
|
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
BIN
gradle/wrapper/gradle-wrapper.jar
vendored
Binary file not shown.
6
gradle/wrapper/gradle-wrapper.properties
vendored
6
gradle/wrapper/gradle-wrapper.properties
vendored
|
@ -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
|
||||||
|
@ -18,6 +18,8 @@
|
||||||
|
|
||||||
distributionBase=GRADLE_USER_HOME
|
distributionBase=GRADLE_USER_HOME
|
||||||
distributionPath=wrapper/dists
|
distributionPath=wrapper/dists
|
||||||
distributionUrl=https\://services.gradle.org/distributions/gradle-8.3-bin.zip
|
distributionUrl=https\://services.gradle.org/distributions/gradle-8.5-bin.zip
|
||||||
|
networkTimeout=10000
|
||||||
|
validateDistributionUrl=true
|
||||||
zipStoreBase=GRADLE_USER_HOME
|
zipStoreBase=GRADLE_USER_HOME
|
||||||
zipStorePath=wrapper/dists
|
zipStorePath=wrapper/dists
|
||||||
|
|
43
gradlew
vendored
43
gradlew
vendored
|
@ -2,7 +2,7 @@
|
||||||
|
|
||||||
#
|
#
|
||||||
# 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
|
||||||
|
@ -57,7 +57,7 @@
|
||||||
# Darwin, MinGW, and NonStop.
|
# Darwin, MinGW, and NonStop.
|
||||||
#
|
#
|
||||||
# (3) This script is generated from the Groovy template
|
# (3) This script is generated from the Groovy template
|
||||||
# https://github.com/gradle/gradle/blob/master/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
# https://github.com/gradle/gradle/blob/HEAD/subprojects/plugins/src/main/resources/org/gradle/api/internal/plugins/unixStartScript.txt
|
||||||
# within the Gradle project.
|
# within the Gradle project.
|
||||||
#
|
#
|
||||||
# You can find Gradle at https://github.com/gradle/gradle/.
|
# You can find Gradle at https://github.com/gradle/gradle/.
|
||||||
|
@ -82,13 +82,11 @@ do
|
||||||
esac
|
esac
|
||||||
done
|
done
|
||||||
|
|
||||||
APP_HOME=$( cd "${APP_HOME:-./}" && pwd -P ) || exit
|
# This is normally unused
|
||||||
|
# shellcheck disable=SC2034
|
||||||
APP_NAME="Gradle"
|
|
||||||
APP_BASE_NAME=${0##*/}
|
APP_BASE_NAME=${0##*/}
|
||||||
|
# Discard cd standard output in case $CDPATH is set (https://github.com/gradle/gradle/issues/25036)
|
||||||
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
APP_HOME=$( cd "${APP_HOME:-./}" > /dev/null && pwd -P ) || exit
|
||||||
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
|
||||||
|
|
||||||
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
# Use the maximum available, or set MAX_FD != -1 to use that value.
|
||||||
MAX_FD=maximum
|
MAX_FD=maximum
|
||||||
|
@ -135,22 +133,29 @@ location of your Java installation."
|
||||||
fi
|
fi
|
||||||
else
|
else
|
||||||
JAVACMD=java
|
JAVACMD=java
|
||||||
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
if ! command -v java >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
|
||||||
Please set the JAVA_HOME variable in your environment to match the
|
Please set the JAVA_HOME variable in your environment to match the
|
||||||
location of your Java installation."
|
location of your Java installation."
|
||||||
fi
|
fi
|
||||||
|
fi
|
||||||
|
|
||||||
# Increase the maximum file descriptors if we can.
|
# Increase the maximum file descriptors if we can.
|
||||||
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
max*)
|
max*)
|
||||||
|
# In POSIX sh, ulimit -H is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
MAX_FD=$( ulimit -H -n ) ||
|
MAX_FD=$( ulimit -H -n ) ||
|
||||||
warn "Could not query maximum file descriptor limit"
|
warn "Could not query maximum file descriptor limit"
|
||||||
esac
|
esac
|
||||||
case $MAX_FD in #(
|
case $MAX_FD in #(
|
||||||
'' | soft) :;; #(
|
'' | soft) :;; #(
|
||||||
*)
|
*)
|
||||||
|
# In POSIX sh, ulimit -n is undefined. That's why the result is checked to see if it worked.
|
||||||
|
# shellcheck disable=SC2039,SC3045
|
||||||
ulimit -n "$MAX_FD" ||
|
ulimit -n "$MAX_FD" ||
|
||||||
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
warn "Could not set maximum file descriptor limit to $MAX_FD"
|
||||||
esac
|
esac
|
||||||
|
@ -195,11 +200,15 @@ if "$cygwin" || "$msys" ; then
|
||||||
done
|
done
|
||||||
fi
|
fi
|
||||||
|
|
||||||
# Collect all arguments for the java command;
|
|
||||||
# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $GRADLE_OPTS can contain fragments of
|
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
|
||||||
# shell script including quotes and variable substitutions, so put them in
|
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
|
||||||
# double quotes to make sure that they get re-expanded; and
|
|
||||||
# * put everything else in single quotes, so that it's not re-expanded.
|
# Collect all arguments for the java command:
|
||||||
|
# * DEFAULT_JVM_OPTS, JAVA_OPTS, JAVA_OPTS, and optsEnvironmentVar are not allowed to contain shell fragments,
|
||||||
|
# and any embedded shellness will be escaped.
|
||||||
|
# * For example: A user cannot expect ${Hostname} to be expanded, as it is an environment variable and will be
|
||||||
|
# treated as '${Hostname}' itself on the command line.
|
||||||
|
|
||||||
set -- \
|
set -- \
|
||||||
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
"-Dorg.gradle.appname=$APP_BASE_NAME" \
|
||||||
|
@ -207,6 +216,12 @@ set -- \
|
||||||
org.gradle.wrapper.GradleWrapperMain \
|
org.gradle.wrapper.GradleWrapperMain \
|
||||||
"$@"
|
"$@"
|
||||||
|
|
||||||
|
# Stop when "xargs" is not available.
|
||||||
|
if ! command -v xargs >/dev/null 2>&1
|
||||||
|
then
|
||||||
|
die "xargs is not available"
|
||||||
|
fi
|
||||||
|
|
||||||
# Use "xargs" to parse quoted args.
|
# Use "xargs" to parse quoted args.
|
||||||
#
|
#
|
||||||
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
|
||||||
|
|
11
gradlew.bat
vendored
11
gradlew.bat
vendored
|
@ -26,6 +26,7 @@ if "%OS%"=="Windows_NT" setlocal
|
||||||
|
|
||||||
set DIRNAME=%~dp0
|
set DIRNAME=%~dp0
|
||||||
if "%DIRNAME%"=="" set DIRNAME=.
|
if "%DIRNAME%"=="" set DIRNAME=.
|
||||||
|
@rem This is normally unused
|
||||||
set APP_BASE_NAME=%~n0
|
set APP_BASE_NAME=%~n0
|
||||||
set APP_HOME=%DIRNAME%
|
set APP_HOME=%DIRNAME%
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ if defined JAVA_HOME goto findJavaFromJavaHome
|
||||||
|
|
||||||
set JAVA_EXE=java.exe
|
set JAVA_EXE=java.exe
|
||||||
%JAVA_EXE% -version >NUL 2>&1
|
%JAVA_EXE% -version >NUL 2>&1
|
||||||
if "%ERRORLEVEL%" == "0" goto execute
|
if %ERRORLEVEL% equ 0 goto execute
|
||||||
|
|
||||||
echo.
|
echo.
|
||||||
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
|
||||||
|
@ -75,13 +76,15 @@ set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
|
||||||
|
|
||||||
:end
|
:end
|
||||||
@rem End local scope for the variables with windows NT shell
|
@rem End local scope for the variables with windows NT shell
|
||||||
if "%ERRORLEVEL%"=="0" goto mainEnd
|
if %ERRORLEVEL% equ 0 goto mainEnd
|
||||||
|
|
||||||
:fail
|
:fail
|
||||||
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
|
||||||
rem the _cmd.exe /c_ return code!
|
rem the _cmd.exe /c_ return code!
|
||||||
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
|
set EXIT_CODE=%ERRORLEVEL%
|
||||||
exit /b 1
|
if %EXIT_CODE% equ 0 set EXIT_CODE=1
|
||||||
|
if not ""=="%GRADLE_EXIT_CONSOLE%" exit %EXIT_CODE%
|
||||||
|
exit /b %EXIT_CODE%
|
||||||
|
|
||||||
:mainEnd
|
:mainEnd
|
||||||
if "%OS%"=="Windows_NT" endlocal
|
if "%OS%"=="Windows_NT" endlocal
|
||||||
|
|
|
@ -1,117 +0,0 @@
|
||||||
/*
|
|
||||||
* lilJudd
|
|
||||||
* 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
|
|
||||||
* 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
|
|
||||||
|
|
||||||
import net.moonleay.lilJudd.data.api.entry.schedule.ModeData
|
|
||||||
import net.moonleay.lilJudd.util.TimeUtil
|
|
||||||
|
|
||||||
object Splatoon3Api {
|
|
||||||
private fun getRegularMode(timestamp: Long): ModeData {
|
|
||||||
Splatoon3ApiCache.cachedRegularModeData.map { modeData ->
|
|
||||||
val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC")
|
|
||||||
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
|
||||||
if (timestamp in startTime..endTime) {
|
|
||||||
return modeData
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw Exception("No current mode found")
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getOpenMode(timestamp: Long): ModeData {
|
|
||||||
Splatoon3ApiCache.cachedCompetitiveOpenModeData.map { modeData ->
|
|
||||||
val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC")
|
|
||||||
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
|
||||||
if (timestamp in startTime..endTime) {
|
|
||||||
return modeData
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw Exception("No current mode found")
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getXMode(timestamp: Long): ModeData {
|
|
||||||
Splatoon3ApiCache.cachedXModeData.map { modeData ->
|
|
||||||
val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC")
|
|
||||||
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
|
||||||
if (timestamp in startTime..endTime) {
|
|
||||||
return modeData
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw Exception("No current mode found")
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun getSeriesMode(timestamp: Long): ModeData {
|
|
||||||
Splatoon3ApiCache.cachedCompetitiveSeriesModeData.map { modeData ->
|
|
||||||
val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC")
|
|
||||||
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
|
||||||
if (timestamp in startTime..endTime) {
|
|
||||||
return modeData
|
|
||||||
}
|
|
||||||
}
|
|
||||||
throw Exception("No current mode found")
|
|
||||||
}
|
|
||||||
|
|
||||||
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"
|
|
||||||
}
|
|
||||||
|
|
||||||
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"
|
|
||||||
}
|
|
||||||
|
|
||||||
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"
|
|
||||||
}
|
|
||||||
|
|
||||||
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"
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,535 +0,0 @@
|
||||||
/*
|
|
||||||
* lilJudd
|
|
||||||
* 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
|
|
||||||
* 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
|
|
||||||
|
|
||||||
import io.ktor.http.*
|
|
||||||
import kotlinx.serialization.json.*
|
|
||||||
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
|
|
||||||
|
|
||||||
object Splatoon3ApiCache {
|
|
||||||
private val user_agent =
|
|
||||||
"lilJudd/${BuildConstants.version} (${System.getProperty("os.name")}/${System.getProperty("os.version")}) [contact@moonleay.net]"
|
|
||||||
private val base_url = "https://splatoon3.ink/data/" // Thank god there is an API
|
|
||||||
|
|
||||||
internal var cachedSplatfestData = mutableListOf<SplatfestData>()
|
|
||||||
internal var cachedMapData = mutableMapOf<Int, MapData>()
|
|
||||||
internal var cachedRegularModeData = mutableListOf<ModeData>()
|
|
||||||
internal var cachedCompetitiveSeriesModeData = mutableListOf<ModeData>()
|
|
||||||
internal var cachedCompetitiveOpenModeData = mutableListOf<ModeData>()
|
|
||||||
internal var cachedXModeData = mutableListOf<ModeData>()
|
|
||||||
internal var cachedChallengesData = mutableListOf<ChallengeModeData>()
|
|
||||||
internal var cachedShiftData = mutableListOf<ShiftData>()
|
|
||||||
internal var cachedBigRunShiftData = mutableListOf<ShiftData>()
|
|
||||||
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("Reason for update: $requestType")
|
|
||||||
when (dataType) {
|
|
||||||
ApiDataType.SCHEDULES -> {
|
|
||||||
updateScheduleCache(user_agent)
|
|
||||||
}
|
|
||||||
|
|
||||||
ApiDataType.SPLATNETGEAR -> {
|
|
||||||
updateSplatnetGearCache(user_agent)
|
|
||||||
}
|
|
||||||
|
|
||||||
ApiDataType.COOP -> {
|
|
||||||
updateCOOPCache(user_agent)
|
|
||||||
}
|
|
||||||
|
|
||||||
ApiDataType.SPLATFESTS -> {
|
|
||||||
updateSplatfestCache(user_agent)
|
|
||||||
}
|
|
||||||
|
|
||||||
ApiDataType.ALL -> {
|
|
||||||
updateScheduleCache(user_agent)
|
|
||||||
updateSplatnetGearCache(user_agent)
|
|
||||||
updateSplatfestCache(user_agent)
|
|
||||||
updateCOOPCache(user_agent)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Logger.out("Finished updating data for $dataType")
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateSplatnetGearCache(uag: String) {
|
|
||||||
val apiResponse = NetUtil.GETJsonData("${base_url}gear.json", uag)
|
|
||||||
if (apiResponse.startsWith("Error")) {
|
|
||||||
Logger.out("Error getting splatnet data: $apiResponse")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val json = Json.parseToJsonElement(apiResponse)
|
|
||||||
val pickupBrandData = json.jsonObject["data"]!!.jsonObject["gesotown"]!!.jsonObject["pickupBrand"]!!.jsonObject
|
|
||||||
|
|
||||||
val brand = pickupBrandData["brand"]!!.jsonObject
|
|
||||||
splatnetShopBrandData =
|
|
||||||
BrandData(
|
|
||||||
brand["name"]!!.jsonPrimitive.content,
|
|
||||||
Url(pickupBrandData["image"]!!.jsonObject["url"]!!.jsonPrimitive.content),
|
|
||||||
GearAbilityData(
|
|
||||||
brand["usualGearPower"]!!.jsonObject["name"]!!.jsonPrimitive.content,
|
|
||||||
brand["usualGearPower"]!!.jsonObject["desc"]!!.jsonPrimitive.content,
|
|
||||||
Url(brand["usualGearPower"]!!.jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content)
|
|
||||||
),
|
|
||||||
pickupBrandData["saleEndTime"]!!.jsonPrimitive.content
|
|
||||||
)
|
|
||||||
val nextBrand = pickupBrandData["nextBrand"]!!.jsonObject
|
|
||||||
splatnetShopNextBrandData =
|
|
||||||
BrandData(
|
|
||||||
nextBrand["name"]!!.jsonPrimitive.content,
|
|
||||||
Url(pickupBrandData["image"]!!.jsonObject["url"]!!.jsonPrimitive.content),
|
|
||||||
null,
|
|
||||||
null
|
|
||||||
)
|
|
||||||
cachedSplatnetItemData = mutableListOf()
|
|
||||||
val items = pickupBrandData["brandGears"]!!.jsonArray
|
|
||||||
items.forEach {
|
|
||||||
val obj = it as JsonObject
|
|
||||||
val gear = it["gear"]!!.jsonObject
|
|
||||||
val primaryGearPower = gear["primaryGearPower"]!!.jsonObject
|
|
||||||
val additionalGearPowers = gear["additionalGearPowers"]!!.jsonArray
|
|
||||||
val additionalGearPowersList = mutableListOf<GearAbilityData>()
|
|
||||||
additionalGearPowers.forEach {
|
|
||||||
val ob = it as JsonObject
|
|
||||||
additionalGearPowersList.add(
|
|
||||||
GearAbilityData(
|
|
||||||
ob["name"]!!.jsonPrimitive.content,
|
|
||||||
null,
|
|
||||||
Url(ob["image"]!!.jsonObject["url"]!!.jsonPrimitive.content)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
cachedSplatnetItemData.add(
|
|
||||||
SplatnetItemData(
|
|
||||||
obj["saleEndTime"]!!.jsonPrimitive.content,
|
|
||||||
obj["price"]!!.jsonPrimitive.int,
|
|
||||||
gear["__typename"]!!.jsonPrimitive.content,
|
|
||||||
gear["name"]!!.jsonPrimitive.content,
|
|
||||||
GearAbilityData(
|
|
||||||
primaryGearPower["name"]!!.jsonPrimitive.content,
|
|
||||||
null,
|
|
||||||
Url(primaryGearPower["image"]!!.jsonObject["url"]!!.jsonPrimitive.content)
|
|
||||||
),
|
|
||||||
additionalGearPowersList,
|
|
||||||
Url(gear["image"]!!.jsonObject["url"]!!.jsonPrimitive.content),
|
|
||||||
splatnetShopBrandData
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Logger.out("Updated gear data")
|
|
||||||
|
|
||||||
val limitedItemData = json.jsonObject["data"]!!.jsonObject["gesotown"]!!.jsonObject["limitedGears"]!!.jsonArray
|
|
||||||
cachedSplatnetLimitedItemData = mutableListOf()
|
|
||||||
limitedItemData.forEach {
|
|
||||||
val obj = it as JsonObject
|
|
||||||
val gear = obj["gear"]!!.jsonObject
|
|
||||||
val additionalGearPowers = gear["additionalGearPowers"]!!.jsonArray
|
|
||||||
val additionalGearPowersList = mutableListOf<GearAbilityData>()
|
|
||||||
additionalGearPowers.forEach {
|
|
||||||
val ob = it as JsonObject
|
|
||||||
additionalGearPowersList.add(
|
|
||||||
GearAbilityData(
|
|
||||||
ob["name"]!!.jsonPrimitive.content,
|
|
||||||
null,
|
|
||||||
Url(ob["image"]!!.jsonObject["url"]!!.jsonPrimitive.content)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
cachedSplatnetLimitedItemData.add(
|
|
||||||
SplatnetItemData(
|
|
||||||
obj["saleEndTime"]!!.jsonPrimitive.content,
|
|
||||||
obj["price"]!!.jsonPrimitive.int,
|
|
||||||
gear["__typename"]!!.jsonPrimitive.content,
|
|
||||||
gear["name"]!!.jsonPrimitive.content,
|
|
||||||
GearAbilityData(
|
|
||||||
gear["primaryGearPower"]!!.jsonObject["name"]!!.jsonPrimitive.content,
|
|
||||||
null,
|
|
||||||
Url(gear["primaryGearPower"]!!.jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content)
|
|
||||||
),
|
|
||||||
additionalGearPowersList,
|
|
||||||
Url(gear["image"]!!.jsonObject["url"]!!.jsonPrimitive.content),
|
|
||||||
splatnetShopBrandData
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateCOOPCache(uag: String) {
|
|
||||||
val apiResponse = NetUtil.GETJsonData("${base_url}coop.json", uag)
|
|
||||||
if (apiResponse.startsWith("Error")) {
|
|
||||||
Logger.out("Error getting coop data: $apiResponse")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val json = Json.parseToJsonElement(apiResponse)
|
|
||||||
val data = json.jsonObject["data"]!!.jsonObject["coopResult"]!!.jsonObject["monthlyGear"]!!.jsonObject
|
|
||||||
cachedCoopRewardsData = mutableListOf()
|
|
||||||
cachedCoopRewardsData.add(
|
|
||||||
CoopGearData(
|
|
||||||
data["name"]!!.jsonPrimitive.content,
|
|
||||||
Url(data["image"]!!.jsonObject["url"]!!.jsonPrimitive.content),
|
|
||||||
data["__typename"]!!.jsonPrimitive.content
|
|
||||||
)
|
|
||||||
)
|
|
||||||
Logger.out("Updated COOP data")
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateScheduleCache(uag: String) {
|
|
||||||
val apiResponse = NetUtil.GETJsonData("${base_url}schedules.json", uag)
|
|
||||||
if (apiResponse.startsWith("Error")) {
|
|
||||||
Logger.out("Error getting schedule data: $apiResponse")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val json = Json.decodeFromString(apiResponse) as JsonObject
|
|
||||||
val data = json["data"]!!.jsonObject
|
|
||||||
|
|
||||||
val mapList = data["vsStages"]!!.jsonObject["nodes"]!!.jsonArray
|
|
||||||
cachedMapData = mutableMapOf()
|
|
||||||
mapList.forEach {
|
|
||||||
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(
|
|
||||||
id,
|
|
||||||
imageURL,
|
|
||||||
it.jsonObject["name"]!!.jsonPrimitive.content
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Logger.out("Updated maplist data")
|
|
||||||
|
|
||||||
val regularMatches = data["regularSchedules"]!!.jsonObject["nodes"]!!.jsonArray
|
|
||||||
cachedRegularModeData = mutableListOf()
|
|
||||||
regularMatches.forEach {
|
|
||||||
val obj = it as JsonObject
|
|
||||||
val setting = obj["regularMatchSetting"]!!.jsonObject
|
|
||||||
cachedRegularModeData.add(
|
|
||||||
ModeData(
|
|
||||||
obj["startTime"]!!.jsonPrimitive.content,
|
|
||||||
obj["endTime"]!!.jsonPrimitive.content,
|
|
||||||
setting["__typename"]!!.jsonPrimitive.content,
|
|
||||||
cachedMapData[setting["vsStages"]!!.jsonArray[0].jsonObject["vsStageId"]!!.jsonPrimitive.int],
|
|
||||||
cachedMapData[setting["vsStages"]!!.jsonArray[1].jsonObject["vsStageId"]!!.jsonPrimitive.int],
|
|
||||||
setting["vsRule"]!!.jsonObject["name"]!!.jsonPrimitive.content,
|
|
||||||
setting["vsRule"]!!.jsonObject["rule"]!!.jsonPrimitive.content,
|
|
||||||
"TURF_WAR"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Logger.out("Updated Regular match data")
|
|
||||||
|
|
||||||
val compMatches = data["bankaraSchedules"]!!.jsonObject["nodes"]!!.jsonArray
|
|
||||||
cachedCompetitiveSeriesModeData = mutableListOf()
|
|
||||||
cachedCompetitiveOpenModeData = mutableListOf()
|
|
||||||
compMatches.forEach {
|
|
||||||
val obj = it as JsonObject
|
|
||||||
val setting = obj["bankaraMatchSettings"]!!.jsonArray
|
|
||||||
setting.forEach {
|
|
||||||
val ob = it as JsonObject
|
|
||||||
val mode = ob["bankaraMode"]!!.jsonPrimitive.content
|
|
||||||
if (mode == "CHALLENGE") {
|
|
||||||
cachedCompetitiveSeriesModeData.add(
|
|
||||||
ModeData(
|
|
||||||
obj["startTime"]!!.jsonPrimitive.content,
|
|
||||||
obj["endTime"]!!.jsonPrimitive.content,
|
|
||||||
ob["__typename"]!!.jsonPrimitive.content,
|
|
||||||
cachedMapData[ob["vsStages"]!!.jsonArray[0].jsonObject["vsStageId"]!!.jsonPrimitive.int],
|
|
||||||
cachedMapData[ob["vsStages"]!!.jsonArray[1].jsonObject["vsStageId"]!!.jsonPrimitive.int],
|
|
||||||
ob["vsRule"]!!.jsonObject["name"]!!.jsonPrimitive.content,
|
|
||||||
ob["vsRule"]!!.jsonObject["rule"]!!.jsonPrimitive.content,
|
|
||||||
mode
|
|
||||||
)
|
|
||||||
)
|
|
||||||
} else if (mode == "OPEN") {
|
|
||||||
cachedCompetitiveOpenModeData.add(
|
|
||||||
ModeData(
|
|
||||||
obj["startTime"]!!.jsonPrimitive.content,
|
|
||||||
obj["endTime"]!!.jsonPrimitive.content,
|
|
||||||
ob["__typename"]!!.jsonPrimitive.content,
|
|
||||||
cachedMapData[ob["vsStages"]!!.jsonArray[0].jsonObject["vsStageId"]!!.jsonPrimitive.int],
|
|
||||||
cachedMapData[ob["vsStages"]!!.jsonArray[1].jsonObject["vsStageId"]!!.jsonPrimitive.int],
|
|
||||||
ob["vsRule"]!!.jsonObject["name"]!!.jsonPrimitive.content,
|
|
||||||
ob["vsRule"]!!.jsonObject["rule"]!!.jsonPrimitive.content,
|
|
||||||
mode
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
Logger.out("Updated Competitive match data")
|
|
||||||
|
|
||||||
val xMatches = data["xSchedules"]!!.jsonObject["nodes"]!!.jsonArray
|
|
||||||
cachedXModeData = mutableListOf()
|
|
||||||
xMatches.forEach {
|
|
||||||
val obj = it as JsonObject
|
|
||||||
val setting = obj["xMatchSetting"]!!.jsonObject
|
|
||||||
cachedXModeData.add(
|
|
||||||
ModeData(
|
|
||||||
obj["startTime"]!!.jsonPrimitive.content,
|
|
||||||
obj["endTime"]!!.jsonPrimitive.content,
|
|
||||||
setting["__typename"]!!.jsonPrimitive.content,
|
|
||||||
cachedMapData[setting["vsStages"]!!.jsonArray[0].jsonObject["vsStageId"]!!.jsonPrimitive.int],
|
|
||||||
cachedMapData[setting["vsStages"]!!.jsonArray[1].jsonObject["vsStageId"]!!.jsonPrimitive.int],
|
|
||||||
setting["vsRule"]!!.jsonObject["name"]!!.jsonPrimitive.content,
|
|
||||||
setting["vsRule"]!!.jsonObject["rule"]!!.jsonPrimitive.content,
|
|
||||||
"X"
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Logger.out("Updated X match data")
|
|
||||||
|
|
||||||
val challengeData = data["eventSchedules"]!!.jsonObject["nodes"]!!.jsonArray
|
|
||||||
cachedChallengesData = mutableListOf()
|
|
||||||
challengeData.forEach {
|
|
||||||
val obj = it as JsonObject
|
|
||||||
val tpd = obj["timePeriods"]!!.jsonArray
|
|
||||||
val setting = obj["leagueMatchSetting"]!!.jsonObject
|
|
||||||
val event = setting["leagueMatchEvent"]!!.jsonObject
|
|
||||||
cachedChallengesData.add(
|
|
||||||
ChallengeModeData(
|
|
||||||
event["leagueMatchEventId"]!!.jsonPrimitive.content,
|
|
||||||
event["name"]!!.jsonPrimitive.content,
|
|
||||||
event["desc"]!!.jsonPrimitive.content,
|
|
||||||
event["regulation"]!!.jsonPrimitive.content,
|
|
||||||
cachedMapData[setting["vsStages"]!!.jsonArray[0].jsonObject["vsStageId"]!!.jsonPrimitive.int],
|
|
||||||
cachedMapData[setting["vsStages"]!!.jsonArray[1].jsonObject["vsStageId"]!!.jsonPrimitive.int],
|
|
||||||
setting["__typename"]!!.jsonPrimitive.content,
|
|
||||||
setting["vsRule"]!!.jsonObject["rule"]!!.jsonPrimitive.content,
|
|
||||||
setting["vsRule"]!!.jsonObject["name"]!!.jsonPrimitive.content,
|
|
||||||
TimePeriodData(
|
|
||||||
tpd[0].jsonObject["startTime"]!!.jsonPrimitive.content,
|
|
||||||
tpd[0].jsonObject["endTime"]!!.jsonPrimitive.content
|
|
||||||
),
|
|
||||||
TimePeriodData(
|
|
||||||
tpd[1].jsonObject["startTime"]!!.jsonPrimitive.content,
|
|
||||||
tpd[1].jsonObject["endTime"]!!.jsonPrimitive.content
|
|
||||||
),
|
|
||||||
TimePeriodData(
|
|
||||||
tpd[2].jsonObject["startTime"]!!.jsonPrimitive.content,
|
|
||||||
tpd[2].jsonObject["endTime"]!!.jsonPrimitive.content
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Logger.out("Updated Challenge data")
|
|
||||||
|
|
||||||
val shiftData = data["coopGroupingSchedule"]!!.jsonObject["regularSchedules"]!!.jsonObject["nodes"]!!.jsonArray
|
|
||||||
cachedShiftData = mutableListOf()
|
|
||||||
shiftData.forEach {
|
|
||||||
val obj = it as JsonObject
|
|
||||||
val setting = obj["setting"]!!.jsonObject
|
|
||||||
val stage = setting["coopStage"]!!.jsonObject
|
|
||||||
val weapons = setting["weapons"]!!.jsonArray
|
|
||||||
cachedShiftData.add(
|
|
||||||
ShiftData(
|
|
||||||
obj["startTime"]!!.jsonPrimitive.content,
|
|
||||||
obj["endTime"]!!.jsonPrimitive.content,
|
|
||||||
obj["__splatoon3ink_king_salmonid_guess"]!!.jsonPrimitive.content,
|
|
||||||
setting["__typename"]!!.jsonPrimitive.content,
|
|
||||||
stage["name"]!!.jsonPrimitive.content,
|
|
||||||
Url(stage["image"]!!.jsonObject["url"]!!.jsonPrimitive.content),
|
|
||||||
WeaponData(
|
|
||||||
weapons[0].jsonObject["name"]!!.jsonPrimitive.content,
|
|
||||||
Url(weapons[0].jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content)
|
|
||||||
),
|
|
||||||
WeaponData(
|
|
||||||
weapons[1].jsonObject["name"]!!.jsonPrimitive.content,
|
|
||||||
Url(weapons[1].jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content)
|
|
||||||
),
|
|
||||||
WeaponData(
|
|
||||||
weapons[2].jsonObject["name"]!!.jsonPrimitive.content,
|
|
||||||
Url(weapons[2].jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content)
|
|
||||||
),
|
|
||||||
WeaponData(
|
|
||||||
weapons[3].jsonObject["name"]!!.jsonPrimitive.content,
|
|
||||||
Url(weapons[3].jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
|
|
||||||
val bigRunData = data["coopGroupingSchedule"]!!.jsonObject["bigRunSchedules"]!!.jsonObject["nodes"]!!.jsonArray
|
|
||||||
cachedBigRunShiftData = mutableListOf()
|
|
||||||
bigRunData.forEach {
|
|
||||||
val obj = it as JsonObject
|
|
||||||
val setting = obj["setting"]!!.jsonObject
|
|
||||||
val stage = setting["coopStage"]!!.jsonObject
|
|
||||||
val weapons = setting["weapons"]!!.jsonArray
|
|
||||||
cachedBigRunShiftData.add(
|
|
||||||
ShiftData(
|
|
||||||
obj["startTime"]!!.jsonPrimitive.content,
|
|
||||||
obj["endTime"]!!.jsonPrimitive.content,
|
|
||||||
obj["__splatoon3ink_king_salmonid_guess"]!!.jsonPrimitive.content,
|
|
||||||
setting["__typename"]!!.jsonPrimitive.content,
|
|
||||||
stage["name"]!!.jsonPrimitive.content,
|
|
||||||
Url(stage["image"]!!.jsonObject["url"]!!.jsonPrimitive.content),
|
|
||||||
WeaponData(
|
|
||||||
weapons[0].jsonObject["name"]!!.jsonPrimitive.content,
|
|
||||||
Url(weapons[0].jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content)
|
|
||||||
),
|
|
||||||
WeaponData(
|
|
||||||
weapons[1].jsonObject["name"]!!.jsonPrimitive.content,
|
|
||||||
Url(weapons[1].jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content)
|
|
||||||
),
|
|
||||||
WeaponData(
|
|
||||||
weapons[2].jsonObject["name"]!!.jsonPrimitive.content,
|
|
||||||
Url(weapons[2].jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content)
|
|
||||||
),
|
|
||||||
WeaponData(
|
|
||||||
weapons[3].jsonObject["name"]!!.jsonPrimitive.content,
|
|
||||||
Url(weapons[3].jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Logger.out("Updated big run data")
|
|
||||||
|
|
||||||
Logger.out("Updated all Schedules")
|
|
||||||
}
|
|
||||||
|
|
||||||
private fun updateSplatfestCache(uag: String) {
|
|
||||||
val apiResponse = NetUtil.GETJsonData("${base_url}festivals.json", uag)
|
|
||||||
if (apiResponse.startsWith("Error")) {
|
|
||||||
Logger.out("Error getting splatfest data: $apiResponse")
|
|
||||||
return
|
|
||||||
}
|
|
||||||
val json = Json.decodeFromString(apiResponse) as JsonObject
|
|
||||||
val festivals = json["US"]!!.jsonObject["data"]!!.jsonObject["festRecords"]!!.jsonObject["nodes"]!!.jsonArray
|
|
||||||
cachedSplatfestData = mutableListOf()
|
|
||||||
festivals.forEach {
|
|
||||||
val fest = it as JsonObject
|
|
||||||
val teams = fest.jsonObject["teams"]!!.jsonArray
|
|
||||||
val team1 = teams[0].jsonObject
|
|
||||||
val team1Color = team1["color"]!!.jsonObject
|
|
||||||
var team1Result: JsonObject? = null
|
|
||||||
if (team1["result"] !is JsonNull) {
|
|
||||||
team1Result = team1["result"]!!.jsonObject
|
|
||||||
}
|
|
||||||
val team2 = teams[1].jsonObject
|
|
||||||
val team2Color = team2["color"]!!.jsonObject
|
|
||||||
var team2Result: JsonObject? = null
|
|
||||||
if (team2["result"] !is JsonNull) {
|
|
||||||
team2Result = team2["result"]!!.jsonObject
|
|
||||||
}
|
|
||||||
val team3 = teams[2].jsonObject
|
|
||||||
val team3Color = team3["color"]!!.jsonObject
|
|
||||||
var team3Result: JsonObject? = null
|
|
||||||
if (team3["result"] !is JsonNull) {
|
|
||||||
team3Result = team3["result"]!!.jsonObject
|
|
||||||
}
|
|
||||||
cachedSplatfestData.add(
|
|
||||||
SplatfestData(
|
|
||||||
fest.jsonObject["id"]!!.jsonPrimitive.content,
|
|
||||||
fest.jsonObject["state"]!!.jsonPrimitive.content,
|
|
||||||
fest.jsonObject["startTime"]!!.jsonPrimitive.content,
|
|
||||||
fest.jsonObject["endTime"]!!.jsonPrimitive.content,
|
|
||||||
fest.jsonObject["title"]!!.jsonPrimitive.content,
|
|
||||||
Url(fest.jsonObject["image"]!!.jsonObject["url"]!!.jsonPrimitive.content),
|
|
||||||
SplatfestTeamData(
|
|
||||||
team1["teamName"]!!.jsonPrimitive.content,
|
|
||||||
SplatfestColor(
|
|
||||||
team1Color["a"]!!.jsonPrimitive.int,
|
|
||||||
team1Color["b"]!!.jsonPrimitive.double,
|
|
||||||
team1Color["g"]!!.jsonPrimitive.double,
|
|
||||||
team1Color["r"]!!.jsonPrimitive.double
|
|
||||||
),
|
|
||||||
if (team1Result.isNullOrEmpty() || team1Result["tricolorContributionRatio"]!!.jsonPrimitive.doubleOrNull == null)
|
|
||||||
null
|
|
||||||
else SplatfestTeamResults(
|
|
||||||
team1Result["isWinner"]!!.jsonPrimitive.boolean,
|
|
||||||
team1Result["horagaiRatio"]!!.jsonPrimitive.double,
|
|
||||||
team1Result["isHoragaiRatioTop"]!!.jsonPrimitive.boolean,
|
|
||||||
team1Result["voteRatio"]!!.jsonPrimitive.double,
|
|
||||||
team1Result["isVoteRatioTop"]!!.jsonPrimitive.boolean,
|
|
||||||
team1Result["regularContributionRatio"]!!.jsonPrimitive.double,
|
|
||||||
team1Result["isRegularContributionRatioTop"]!!.jsonPrimitive.boolean,
|
|
||||||
team1Result["challengeContributionRatio"]!!.jsonPrimitive.double,
|
|
||||||
team1Result["isChallengeContributionRatioTop"]!!.jsonPrimitive.boolean,
|
|
||||||
team1Result["tricolorContributionRatio"]!!.jsonPrimitive.double,
|
|
||||||
team1Result["isTricolorContributionRatioTop"]!!.jsonPrimitive.boolean,
|
|
||||||
)
|
|
||||||
),
|
|
||||||
SplatfestTeamData(
|
|
||||||
team2["teamName"]!!.jsonPrimitive.content,
|
|
||||||
SplatfestColor(
|
|
||||||
team2Color["a"]!!.jsonPrimitive.int,
|
|
||||||
team2Color["b"]!!.jsonPrimitive.double,
|
|
||||||
team2Color["g"]!!.jsonPrimitive.double,
|
|
||||||
team2Color["r"]!!.jsonPrimitive.double
|
|
||||||
),
|
|
||||||
if (team2Result.isNullOrEmpty() || team2Result["tricolorContributionRatio"]!!.jsonPrimitive.doubleOrNull == null)
|
|
||||||
null
|
|
||||||
else SplatfestTeamResults(
|
|
||||||
team2Result["isWinner"]!!.jsonPrimitive.boolean,
|
|
||||||
team2Result["horagaiRatio"]!!.jsonPrimitive.double,
|
|
||||||
team2Result["isHoragaiRatioTop"]!!.jsonPrimitive.boolean,
|
|
||||||
team2Result["voteRatio"]!!.jsonPrimitive.double,
|
|
||||||
team2Result["isVoteRatioTop"]!!.jsonPrimitive.boolean,
|
|
||||||
team2Result["regularContributionRatio"]!!.jsonPrimitive.double,
|
|
||||||
team2Result["isRegularContributionRatioTop"]!!.jsonPrimitive.boolean,
|
|
||||||
team2Result["challengeContributionRatio"]!!.jsonPrimitive.double,
|
|
||||||
team2Result["isChallengeContributionRatioTop"]!!.jsonPrimitive.boolean,
|
|
||||||
team2Result["tricolorContributionRatio"]!!.jsonPrimitive.double,
|
|
||||||
team2Result["isTricolorContributionRatioTop"]!!.jsonPrimitive.boolean,
|
|
||||||
)
|
|
||||||
),
|
|
||||||
SplatfestTeamData(
|
|
||||||
team3["teamName"]!!.jsonPrimitive.content,
|
|
||||||
SplatfestColor(
|
|
||||||
team3Color["a"]!!.jsonPrimitive.int,
|
|
||||||
team3Color["b"]!!.jsonPrimitive.double,
|
|
||||||
team3Color["g"]!!.jsonPrimitive.double,
|
|
||||||
team3Color["r"]!!.jsonPrimitive.double
|
|
||||||
),
|
|
||||||
if (team3Result.isNullOrEmpty() || team3Result["tricolorContributionRatio"]!!.jsonPrimitive.doubleOrNull == null)
|
|
||||||
null
|
|
||||||
else SplatfestTeamResults(
|
|
||||||
team3Result["isWinner"]!!.jsonPrimitive.boolean,
|
|
||||||
team3Result["horagaiRatio"]!!.jsonPrimitive.double,
|
|
||||||
team3Result["isHoragaiRatioTop"]!!.jsonPrimitive.boolean,
|
|
||||||
team3Result["voteRatio"]!!.jsonPrimitive.double,
|
|
||||||
team3Result["isVoteRatioTop"]!!.jsonPrimitive.boolean,
|
|
||||||
team3Result["regularContributionRatio"]!!.jsonPrimitive.double,
|
|
||||||
team3Result["isRegularContributionRatioTop"]!!.jsonPrimitive.boolean,
|
|
||||||
team3Result["challengeContributionRatio"]!!.jsonPrimitive.double,
|
|
||||||
team3Result["isChallengeContributionRatioTop"]!!.jsonPrimitive.boolean,
|
|
||||||
team3Result["tricolorContributionRatio"]!!.jsonPrimitive.double,
|
|
||||||
team3Result["isTricolorContributionRatioTop"]!!.jsonPrimitive.boolean,
|
|
||||||
)
|
|
||||||
),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
}
|
|
||||||
Logger.out("Updated Splatfest data")
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,25 +0,0 @@
|
||||||
/*
|
|
||||||
* lilJudd
|
|
||||||
* 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
|
|
||||||
* 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.entry.splatfest
|
|
||||||
|
|
||||||
data class SplatfestTeamData(
|
|
||||||
val teamName: String,
|
|
||||||
val color: SplatfestColor,
|
|
||||||
val results: SplatfestTeamResults?,
|
|
||||||
)
|
|
|
@ -1,33 +0,0 @@
|
||||||
/*
|
|
||||||
* lilJudd
|
|
||||||
* 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
|
|
||||||
* 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.entry.splatfest
|
|
||||||
|
|
||||||
data class SplatfestTeamResults(
|
|
||||||
val isWinner: Boolean,
|
|
||||||
val horagaiRatio: Double,
|
|
||||||
val horagaiRatioTop: Boolean,
|
|
||||||
val voteRatio: Double,
|
|
||||||
val voteRatioTop: Boolean,
|
|
||||||
val regularRatio: Double,
|
|
||||||
val regularRatioTop: Boolean,
|
|
||||||
val challengeRatio: Double,
|
|
||||||
val challengeRatioTop: Boolean,
|
|
||||||
val tricolorRatio: Double,
|
|
||||||
val tricolorRatioTop: Boolean,
|
|
||||||
)
|
|
|
@ -1,32 +0,0 @@
|
||||||
/*
|
|
||||||
* lilJudd
|
|
||||||
* 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
|
|
||||||
* 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.entry.splatnet
|
|
||||||
|
|
||||||
import io.ktor.http.*
|
|
||||||
|
|
||||||
data class SplatnetItemData(
|
|
||||||
val saleEndTime: String,
|
|
||||||
val price: Int,
|
|
||||||
val typeName: String,
|
|
||||||
val name: String,
|
|
||||||
val primaryGearPower: GearAbilityData,
|
|
||||||
val additionalGearPowers: List<GearAbilityData>,
|
|
||||||
val image: Url,
|
|
||||||
val brand: BrandData,
|
|
||||||
)
|
|
|
@ -1,50 +0,0 @@
|
||||||
/*
|
|
||||||
* lilJudd
|
|
||||||
* 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
|
|
||||||
* 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.jobs
|
|
||||||
|
|
||||||
import dev.inmo.krontab.KronScheduler
|
|
||||||
import kotlinx.coroutines.Job
|
|
||||||
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
|
|
||||||
|
|
||||||
object Splatoon3ApiFestivalAndCoopUpdateScheduler : ICronjob {
|
|
||||||
override val jobName: String
|
|
||||||
get() = "Splatoon3ApiFestivalAndCoopUpdateScheduler"
|
|
||||||
override val jobIncoming: String
|
|
||||||
get() = "0 0 0 /1 * * 0o *" // once a day
|
|
||||||
override val jobType: CronjobType
|
|
||||||
get() = CronjobType.INFINITE
|
|
||||||
override val continueJob: Boolean
|
|
||||||
get() = true
|
|
||||||
override lateinit var cronjobJob: Job
|
|
||||||
override lateinit var scheduler: KronScheduler
|
|
||||||
|
|
||||||
override suspend fun jobFunction() {
|
|
||||||
Logger.out("Running Splatoon3ApiFestivalUpdateScheduler.")
|
|
||||||
Splatoon3ApiCache.updateData(ApiDataType.SPLATFESTS, ApiRequestType.AUTOMATIC_CACHE_UPDATE)
|
|
||||||
Logger.out("Splatoon3ApiFestivalUpdateScheduler finished.")
|
|
||||||
Logger.out("Running Splatoon3ApiCoopUpdateScheduler.")
|
|
||||||
Splatoon3ApiCache.updateData(ApiDataType.COOP, ApiRequestType.AUTOMATIC_CACHE_UPDATE)
|
|
||||||
Logger.out("Splatoon3ApiCoopUpdateScheduler finished.")
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -1,47 +0,0 @@
|
||||||
/*
|
|
||||||
* lilJudd
|
|
||||||
* 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
|
|
||||||
* 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.jobs
|
|
||||||
|
|
||||||
import dev.inmo.krontab.KronScheduler
|
|
||||||
import kotlinx.coroutines.Job
|
|
||||||
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
|
|
||||||
|
|
||||||
object Splatoon3ApiSplatnetGearUpdateScheduler : ICronjob {
|
|
||||||
override val jobName: String
|
|
||||||
get() = "Splatoon3ApiSplatnetGearUpdateScheduler"
|
|
||||||
override val jobIncoming: String
|
|
||||||
get() = "0 0 /6 * * * 0o *" //Every 6 hours
|
|
||||||
override val jobType: CronjobType
|
|
||||||
get() = CronjobType.INFINITE
|
|
||||||
override val continueJob: Boolean
|
|
||||||
get() = true
|
|
||||||
override lateinit var cronjobJob: Job
|
|
||||||
override lateinit var scheduler: KronScheduler
|
|
||||||
|
|
||||||
override suspend fun jobFunction() {
|
|
||||||
Logger.out("Running Splatoon3ApiSplatnetGearUpdateScheduler.")
|
|
||||||
Splatoon3ApiCache.updateData(ApiDataType.SPLATNETGEAR, ApiRequestType.AUTOMATIC_CACHE_UPDATE)
|
|
||||||
Logger.out("Splatoon3ApiSplatnetGearUpdateScheduler 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
|
||||||
|
@ -16,9 +16,10 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd
|
package net.moonleay.liljudd
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.ExtensibleBot
|
import com.kotlindiscord.kord.extensions.ExtensibleBot
|
||||||
|
import com.kotlindiscord.kord.extensions.utils.dm
|
||||||
import dev.kord.common.entity.PresenceStatus
|
import dev.kord.common.entity.PresenceStatus
|
||||||
import dev.kord.core.behavior.interaction.response.respond
|
import dev.kord.core.behavior.interaction.response.respond
|
||||||
import dev.kord.core.event.gateway.ReadyEvent
|
import dev.kord.core.event.gateway.ReadyEvent
|
||||||
|
@ -26,23 +27,28 @@ import dev.kord.core.event.interaction.ButtonInteractionCreateEvent
|
||||||
import dev.kord.core.on
|
import dev.kord.core.on
|
||||||
import dev.kord.gateway.Intent
|
import dev.kord.gateway.Intent
|
||||||
import dev.kord.gateway.PrivilegedIntent
|
import dev.kord.gateway.PrivilegedIntent
|
||||||
|
import dev.kord.gateway.builder.Shards
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import kotlinx.coroutines.CoroutineScope
|
import kotlinx.coroutines.CoroutineScope
|
||||||
import kotlinx.coroutines.Dispatchers
|
import kotlinx.coroutines.Dispatchers
|
||||||
import kotlinx.coroutines.Job
|
import kotlinx.coroutines.Job
|
||||||
import kotlinx.coroutines.launch
|
import kotlinx.coroutines.launch
|
||||||
import net.moonleay.lilJudd.buttons.component.EditButtonManager
|
|
||||||
import net.moonleay.lilJudd.data.CredentialManager
|
|
||||||
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.util.EmbedColor
|
|
||||||
import net.moonleay.lilJudd.util.Logger
|
|
||||||
import net.moonleay.lilJudd.util.MessageUtil
|
|
||||||
import net.moonleay.liljudd.build.BuildConstants
|
import net.moonleay.liljudd.build.BuildConstants
|
||||||
|
import net.moonleay.liljudd.buttons.component.EditButtonManager
|
||||||
|
import net.moonleay.liljudd.data.CredentialManager
|
||||||
|
import net.moonleay.liljudd.data.NewsManager
|
||||||
|
import net.moonleay.liljudd.data.StacktraceSaver
|
||||||
|
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.util.EmbedColor
|
||||||
|
import net.moonleay.liljudd.util.Logger
|
||||||
|
import net.moonleay.liljudd.util.MessageUtil
|
||||||
import kotlin.system.exitProcess
|
import kotlin.system.exitProcess
|
||||||
|
|
||||||
|
|
||||||
object Bot {
|
object Bot {
|
||||||
//The kord object gets set at app launch
|
//The kord object gets set at app launch
|
||||||
lateinit var bot: ExtensibleBot
|
lateinit var bot: ExtensibleBot
|
||||||
|
@ -68,6 +74,12 @@ object Bot {
|
||||||
exitProcess(3)
|
exitProcess(3)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
// Check if there are api credentials
|
||||||
|
if (CredentialManager.apiDomain == "empty" || CredentialManager.apiToken == "empty") {
|
||||||
|
Logger.out("The config does not contain the whole API credentials.")
|
||||||
|
exitProcess(3)
|
||||||
|
}
|
||||||
|
|
||||||
// Connect to the database
|
// Connect to the database
|
||||||
DB.connect(
|
DB.connect(
|
||||||
CredentialManager.dbDomain,
|
CredentialManager.dbDomain,
|
||||||
|
@ -104,6 +116,7 @@ object Bot {
|
||||||
add(::SendPlannerExtension)
|
add(::SendPlannerExtension)
|
||||||
add(::MatchExtension)
|
add(::MatchExtension)
|
||||||
add(::UpdateRolesExtension)
|
add(::UpdateRolesExtension)
|
||||||
|
add(::RotationExtension)
|
||||||
}
|
}
|
||||||
|
|
||||||
this.presence {
|
this.presence {
|
||||||
|
@ -115,11 +128,26 @@ object Bot {
|
||||||
+Intent.GuildMembers
|
+Intent.GuildMembers
|
||||||
}
|
}
|
||||||
|
|
||||||
// Will add Sharding someday, I promise
|
errorResponse { _, type ->
|
||||||
/*
|
val stamp = System.currentTimeMillis()
|
||||||
sharding { recommended ->
|
this.embed {
|
||||||
|
this.title = "Oops. Something went wrong."
|
||||||
|
this.description = "The bot encountered an error during execution.\n" +
|
||||||
|
"Please report this to <@${BuildConstants.creatorID}>.\n" +
|
||||||
|
"The errorid is \"$stamp.stk\""
|
||||||
|
this.field {
|
||||||
|
this.name = "Error message:"
|
||||||
|
this.value = type.error.message.toString()
|
||||||
|
this.inline = false
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
StacktraceSaver.saveStacktrace(type.error, stamp)
|
||||||
|
}
|
||||||
|
|
||||||
|
this.sharding { recommended ->
|
||||||
Shards(recommended)
|
Shards(recommended)
|
||||||
} */
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Register button presses
|
// Register button presses
|
||||||
|
@ -157,12 +185,38 @@ object Bot {
|
||||||
bot.kordRef.on<ReadyEvent> {
|
bot.kordRef.on<ReadyEvent> {
|
||||||
AvailabilityManager.runThread() // Update Availabilities
|
AvailabilityManager.runThread() // Update Availabilities
|
||||||
MatchManager.update() // Update Matches
|
MatchManager.update() // Update Matches
|
||||||
|
// Load news
|
||||||
|
NewsManager.load()
|
||||||
|
if(NewsManager.shouldPost == "yes"){
|
||||||
|
val contactedOwners = mutableListOf<ULong>()
|
||||||
|
bot.kordRef.guilds.collect {
|
||||||
|
val owner = it.owner.asUser()
|
||||||
|
if (!contactedOwners.contains(owner.id.value)) {
|
||||||
|
Logger.out("Sent News to ${owner.username} from ${it.name}")
|
||||||
|
owner.dm {
|
||||||
|
this.embed {
|
||||||
|
this.title = NewsManager.title
|
||||||
|
this.description = NewsManager.news
|
||||||
|
this.footer {
|
||||||
|
this.icon = bot.kordRef.getSelf().avatar?.cdnUrl?.toUrl()
|
||||||
|
this.text = MessageUtil.getFooter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
contactedOwners.add(owner.id.value)
|
||||||
|
}
|
||||||
|
}
|
||||||
|
NewsManager.shouldPost = "no"
|
||||||
|
NewsManager.update()
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
// Make the bot update the status every 6 seconds
|
// Make the bot update the status every 6 seconds
|
||||||
// JobManager.addJob(StatusUpdater)
|
// JobManager.addJob(StatusUpdater)
|
||||||
}
|
}
|
||||||
|
|
||||||
// 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
|
||||||
|
@ -172,10 +226,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()
|
||||||
}
|
}
|
|
@ -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
|
||||||
|
@ -15,9 +15,10 @@
|
||||||
* You should have received a copy of the GNU General Public License
|
* You should have received a copy of the GNU General Public License
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
package net.moonleay.lilJudd
|
package net.moonleay.liljudd
|
||||||
|
|
||||||
import net.moonleay.liljudd.build.BuildConstants
|
import net.moonleay.liljudd.build.BuildConstants
|
||||||
|
import net.moonleay.liljudd.util.Logger
|
||||||
|
|
||||||
|
|
||||||
suspend fun main() {
|
suspend fun main() {
|
||||||
|
@ -27,9 +28,11 @@ suspend fun main() {
|
||||||
"| |_| |__| |_ _ _| |_| |\n" +
|
"| |_| |__| |_ _ _| |_| |\n" +
|
||||||
"| | | | | | | | . | . |\n" +
|
"| | | | | | | | . | . |\n" +
|
||||||
"|_|_|_|_____|___|___|___|\n" +
|
"|_|_|_|_____|___|___|___|\n" +
|
||||||
" "
|
"v.${BuildConstants.version}\n"
|
||||||
)
|
)
|
||||||
println("v.${BuildConstants.version}")
|
|
||||||
|
Logger.out("li'l Judd made by moonleay (https://moonleay.net). Web UI made by aronmal (https://mal-noh.de).")
|
||||||
|
Logger.out("For more information check out https://liljudd.ink and https://git.moonleay.net/DiscordBots/lilJudd")
|
||||||
|
|
||||||
Bot.start()
|
Bot.start()
|
||||||
}
|
}
|
|
@ -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
|
||||||
|
@ -16,14 +16,14 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.buttons.component
|
package net.moonleay.liljudd.buttons.component
|
||||||
|
|
||||||
import net.moonleay.lilJudd.buttons.matchplanner.AcceptEditButton
|
import net.moonleay.liljudd.buttons.matchplanner.AcceptEditButton
|
||||||
import net.moonleay.lilJudd.buttons.matchplanner.CancelEditButton
|
import net.moonleay.liljudd.buttons.matchplanner.CancelEditButton
|
||||||
import net.moonleay.lilJudd.buttons.matchplanner.DeclineEditButton
|
import net.moonleay.liljudd.buttons.matchplanner.DeclineEditButton
|
||||||
import net.moonleay.lilJudd.buttons.timeplanner.IsAvailableEditButton
|
import net.moonleay.liljudd.buttons.timeplanner.IsAvailableEditButton
|
||||||
import net.moonleay.lilJudd.buttons.timeplanner.MaybeAvailableEditButton
|
import net.moonleay.liljudd.buttons.timeplanner.MaybeAvailableEditButton
|
||||||
import net.moonleay.lilJudd.buttons.timeplanner.NotAvailableEditButton
|
import net.moonleay.liljudd.buttons.timeplanner.NotAvailableEditButton
|
||||||
|
|
||||||
object EditButtonManager {
|
object EditButtonManager {
|
||||||
val buttons = listOf(
|
val buttons = listOf(
|
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.buttons.component
|
package net.moonleay.liljudd.buttons.component
|
||||||
|
|
||||||
import dev.kord.core.behavior.interaction.response.PublicMessageInteractionResponseBehavior
|
import dev.kord.core.behavior.interaction.response.PublicMessageInteractionResponseBehavior
|
||||||
import dev.kord.core.entity.Guild
|
import dev.kord.core.entity.Guild
|
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.buttons.matchplanner
|
package net.moonleay.liljudd.buttons.matchplanner
|
||||||
|
|
||||||
import dev.kord.common.entity.Snowflake
|
import dev.kord.common.entity.Snowflake
|
||||||
import dev.kord.core.behavior.edit
|
import dev.kord.core.behavior.edit
|
||||||
|
@ -25,15 +25,16 @@ import dev.kord.core.entity.Guild
|
||||||
import dev.kord.core.entity.User
|
import dev.kord.core.entity.User
|
||||||
import dev.kord.core.entity.channel.MessageChannel
|
import dev.kord.core.entity.channel.MessageChannel
|
||||||
import dev.kord.core.entity.interaction.ButtonInteraction
|
import dev.kord.core.entity.interaction.ButtonInteraction
|
||||||
import dev.kord.rest.builder.message.modify.embed
|
import dev.kord.rest.builder.message.EmbedBuilder
|
||||||
import net.moonleay.lilJudd.Bot
|
import dev.kord.rest.builder.message.embed
|
||||||
import net.moonleay.lilJudd.buttons.component.IEditButton
|
import net.moonleay.liljudd.Bot
|
||||||
import net.moonleay.lilJudd.data.database.repository.MatchPlanningDataRepository
|
import net.moonleay.liljudd.buttons.component.IEditButton
|
||||||
import net.moonleay.lilJudd.util.EmbedUtil
|
import net.moonleay.liljudd.data.database.repository.MatchPlanningDataRepository
|
||||||
import net.moonleay.lilJudd.util.Logger
|
import net.moonleay.liljudd.util.EmbedUtil
|
||||||
import net.moonleay.lilJudd.util.MessageUtil
|
import net.moonleay.liljudd.util.Logger
|
||||||
|
import net.moonleay.liljudd.util.MessageUtil
|
||||||
|
|
||||||
class AcceptEditButton() : IEditButton {
|
class AcceptEditButton : IEditButton {
|
||||||
override val id: String = "public.edit.btn.matchmanagement.accept"
|
override val id: String = "public.edit.btn.matchmanagement.accept"
|
||||||
|
|
||||||
override suspend fun onInteraction(
|
override suspend fun onInteraction(
|
||||||
|
@ -59,7 +60,7 @@ class AcceptEditButton() : IEditButton {
|
||||||
Logger.out("role is null")
|
Logger.out("role is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val member = interaction.user.asMember(guild.id) ?: return
|
val member = interaction.user.asMember(guild.id)
|
||||||
// do the checks and update
|
// do the checks and update
|
||||||
if (m.embeds[0].fields[0].value.contains(user.id.value.toString())) {
|
if (m.embeds[0].fields[0].value.contains(user.id.value.toString())) {
|
||||||
if (member.roleIds.contains(Snowflake(mpdd.roleID))) {
|
if (member.roleIds.contains(Snowflake(mpdd.roleID))) {
|
||||||
|
@ -89,13 +90,13 @@ class AcceptEditButton() : IEditButton {
|
||||||
if (shouldEditButton) {
|
if (shouldEditButton) {
|
||||||
// update the message
|
// update the message
|
||||||
Bot.bot.kordRef.getChannelOf<MessageChannel>(interaction.channelId)!!.getMessage(m.id).edit {
|
Bot.bot.kordRef.getChannelOf<MessageChannel>(interaction.channelId)!!.getMessage(m.id).edit {
|
||||||
this.embed {
|
this.embed(fun EmbedBuilder.() {
|
||||||
this.color = eb.color
|
color = eb.color
|
||||||
this.title = eb.title
|
title = eb.title
|
||||||
this.description = eb.description
|
description = eb.description
|
||||||
this.fields = eb.fields
|
fields = eb.fields
|
||||||
this.footer = eb.footer
|
footer = eb.footer
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.buttons.matchplanner
|
package net.moonleay.liljudd.buttons.matchplanner
|
||||||
|
|
||||||
import dev.kord.common.entity.Snowflake
|
import dev.kord.common.entity.Snowflake
|
||||||
import dev.kord.core.behavior.edit
|
import dev.kord.core.behavior.edit
|
||||||
|
@ -25,12 +25,13 @@ import dev.kord.core.entity.Guild
|
||||||
import dev.kord.core.entity.User
|
import dev.kord.core.entity.User
|
||||||
import dev.kord.core.entity.channel.MessageChannel
|
import dev.kord.core.entity.channel.MessageChannel
|
||||||
import dev.kord.core.entity.interaction.ButtonInteraction
|
import dev.kord.core.entity.interaction.ButtonInteraction
|
||||||
import dev.kord.rest.builder.message.modify.embed
|
import dev.kord.rest.builder.message.EmbedBuilder
|
||||||
import net.moonleay.lilJudd.Bot
|
import dev.kord.rest.builder.message.embed
|
||||||
import net.moonleay.lilJudd.buttons.component.IEditButton
|
import net.moonleay.liljudd.Bot
|
||||||
import net.moonleay.lilJudd.data.database.repository.MatchPlanningDataRepository
|
import net.moonleay.liljudd.buttons.component.IEditButton
|
||||||
import net.moonleay.lilJudd.util.EmbedUtil
|
import net.moonleay.liljudd.data.database.repository.MatchPlanningDataRepository
|
||||||
import net.moonleay.lilJudd.util.Logger
|
import net.moonleay.liljudd.util.EmbedUtil
|
||||||
|
import net.moonleay.liljudd.util.Logger
|
||||||
|
|
||||||
class CancelEditButton : IEditButton {
|
class CancelEditButton : IEditButton {
|
||||||
override val id: String = "public.edit.btn.matchmanagement.cancel"
|
override val id: String = "public.edit.btn.matchmanagement.cancel"
|
||||||
|
@ -62,14 +63,14 @@ class CancelEditButton : IEditButton {
|
||||||
member.removeRole(role.id)
|
member.removeRole(role.id)
|
||||||
}
|
}
|
||||||
Bot.bot.kordRef.getChannelOf<MessageChannel>(interaction.channelId)!!.getMessage(m.id).edit {
|
Bot.bot.kordRef.getChannelOf<MessageChannel>(interaction.channelId)!!.getMessage(m.id).edit {
|
||||||
this.embed {
|
this.embed(fun EmbedBuilder.() {
|
||||||
val temp = EmbedUtil.replaceXWithYinValuesAtTable(user.id.value.toString(), "", m.embeds[0], 1)
|
val temp = EmbedUtil.replaceXWithYinValuesAtTable(user.id.value.toString(), "", m.embeds[0], 1)
|
||||||
this.color = temp.color
|
color = temp.color
|
||||||
this.title = temp.title
|
title = temp.title
|
||||||
this.description = temp.description
|
description = temp.description
|
||||||
this.fields = temp.fields
|
fields = temp.fields
|
||||||
this.footer = temp.footer
|
footer = temp.footer
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.buttons.matchplanner
|
package net.moonleay.liljudd.buttons.matchplanner
|
||||||
|
|
||||||
import dev.kord.common.entity.Snowflake
|
import dev.kord.common.entity.Snowflake
|
||||||
import dev.kord.core.behavior.edit
|
import dev.kord.core.behavior.edit
|
||||||
|
@ -25,13 +25,14 @@ import dev.kord.core.entity.Guild
|
||||||
import dev.kord.core.entity.User
|
import dev.kord.core.entity.User
|
||||||
import dev.kord.core.entity.channel.MessageChannel
|
import dev.kord.core.entity.channel.MessageChannel
|
||||||
import dev.kord.core.entity.interaction.ButtonInteraction
|
import dev.kord.core.entity.interaction.ButtonInteraction
|
||||||
import dev.kord.rest.builder.message.modify.embed
|
import dev.kord.rest.builder.message.EmbedBuilder
|
||||||
import net.moonleay.lilJudd.Bot
|
import dev.kord.rest.builder.message.embed
|
||||||
import net.moonleay.lilJudd.buttons.component.IEditButton
|
import net.moonleay.liljudd.Bot
|
||||||
import net.moonleay.lilJudd.data.database.repository.MatchPlanningDataRepository
|
import net.moonleay.liljudd.buttons.component.IEditButton
|
||||||
import net.moonleay.lilJudd.util.EmbedUtil
|
import net.moonleay.liljudd.data.database.repository.MatchPlanningDataRepository
|
||||||
import net.moonleay.lilJudd.util.Logger
|
import net.moonleay.liljudd.util.EmbedUtil
|
||||||
import net.moonleay.lilJudd.util.MessageUtil
|
import net.moonleay.liljudd.util.Logger
|
||||||
|
import net.moonleay.liljudd.util.MessageUtil
|
||||||
|
|
||||||
class DeclineEditButton : IEditButton {
|
class DeclineEditButton : IEditButton {
|
||||||
override val id: String = "public.edit.btn.matchmanagement.decline"
|
override val id: String = "public.edit.btn.matchmanagement.decline"
|
||||||
|
@ -59,7 +60,7 @@ class DeclineEditButton : IEditButton {
|
||||||
Logger.out("role is null")
|
Logger.out("role is null")
|
||||||
return
|
return
|
||||||
}
|
}
|
||||||
val member = interaction.user.asMember(guild.id) ?: return
|
val member = interaction.user.asMember(guild.id)
|
||||||
if (m.embeds[0].fields[0].value.contains(user.id.value.toString())) {
|
if (m.embeds[0].fields[0].value.contains(user.id.value.toString())) {
|
||||||
if (member.roleIds.contains(Snowflake(mpdd.roleID))) {
|
if (member.roleIds.contains(Snowflake(mpdd.roleID))) {
|
||||||
Logger.out("Removing role from ${member.username}")
|
Logger.out("Removing role from ${member.username}")
|
||||||
|
@ -89,13 +90,13 @@ class DeclineEditButton : IEditButton {
|
||||||
if (shouldEditButton) {
|
if (shouldEditButton) {
|
||||||
// update the message
|
// update the message
|
||||||
Bot.bot.kordRef.getChannelOf<MessageChannel>(interaction.channelId)!!.getMessage(m.id).edit {
|
Bot.bot.kordRef.getChannelOf<MessageChannel>(interaction.channelId)!!.getMessage(m.id).edit {
|
||||||
this.embed {
|
this.embed(fun EmbedBuilder.() {
|
||||||
this.color = eb.color
|
color = eb.color
|
||||||
this.title = eb.title
|
title = eb.title
|
||||||
this.description = eb.description
|
description = eb.description
|
||||||
this.fields = eb.fields
|
fields = eb.fields
|
||||||
this.footer = eb.footer
|
footer = eb.footer
|
||||||
}
|
})
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.buttons.timeplanner
|
package net.moonleay.liljudd.buttons.timeplanner
|
||||||
|
|
||||||
import dev.kord.core.behavior.edit
|
import dev.kord.core.behavior.edit
|
||||||
import dev.kord.core.behavior.interaction.response.PublicMessageInteractionResponseBehavior
|
import dev.kord.core.behavior.interaction.response.PublicMessageInteractionResponseBehavior
|
||||||
|
@ -24,11 +24,11 @@ import dev.kord.core.entity.Guild
|
||||||
import dev.kord.core.entity.User
|
import dev.kord.core.entity.User
|
||||||
import dev.kord.core.entity.channel.MessageChannel
|
import dev.kord.core.entity.channel.MessageChannel
|
||||||
import dev.kord.core.entity.interaction.ButtonInteraction
|
import dev.kord.core.entity.interaction.ButtonInteraction
|
||||||
import dev.kord.rest.builder.message.modify.embed
|
import dev.kord.rest.builder.message.embed
|
||||||
import net.moonleay.lilJudd.Bot
|
import net.moonleay.liljudd.Bot
|
||||||
import net.moonleay.lilJudd.buttons.component.IEditButton
|
import net.moonleay.liljudd.buttons.component.IEditButton
|
||||||
import net.moonleay.lilJudd.features.AvailabilityManager
|
import net.moonleay.liljudd.features.AvailabilityManager
|
||||||
import net.moonleay.lilJudd.util.EmbedUtil
|
import net.moonleay.liljudd.util.EmbedUtil
|
||||||
|
|
||||||
class IsAvailableEditButton : IEditButton {
|
class IsAvailableEditButton : IEditButton {
|
||||||
override val id: String = "public.edit.btn.timemanagement.available"
|
override val id: String = "public.edit.btn.timemanagement.available"
|
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.buttons.timeplanner
|
package net.moonleay.liljudd.buttons.timeplanner
|
||||||
|
|
||||||
import dev.kord.core.behavior.edit
|
import dev.kord.core.behavior.edit
|
||||||
import dev.kord.core.behavior.interaction.response.PublicMessageInteractionResponseBehavior
|
import dev.kord.core.behavior.interaction.response.PublicMessageInteractionResponseBehavior
|
||||||
|
@ -24,11 +24,11 @@ import dev.kord.core.entity.Guild
|
||||||
import dev.kord.core.entity.User
|
import dev.kord.core.entity.User
|
||||||
import dev.kord.core.entity.channel.MessageChannel
|
import dev.kord.core.entity.channel.MessageChannel
|
||||||
import dev.kord.core.entity.interaction.ButtonInteraction
|
import dev.kord.core.entity.interaction.ButtonInteraction
|
||||||
import dev.kord.rest.builder.message.modify.embed
|
import dev.kord.rest.builder.message.embed
|
||||||
import net.moonleay.lilJudd.Bot
|
import net.moonleay.liljudd.Bot
|
||||||
import net.moonleay.lilJudd.buttons.component.IEditButton
|
import net.moonleay.liljudd.buttons.component.IEditButton
|
||||||
import net.moonleay.lilJudd.features.AvailabilityManager
|
import net.moonleay.liljudd.features.AvailabilityManager
|
||||||
import net.moonleay.lilJudd.util.EmbedUtil
|
import net.moonleay.liljudd.util.EmbedUtil
|
||||||
|
|
||||||
class MaybeAvailableEditButton : IEditButton {
|
class MaybeAvailableEditButton : IEditButton {
|
||||||
override val id: String = "public.edit.btn.timemanagement.maybeavailable"
|
override val id: String = "public.edit.btn.timemanagement.maybeavailable"
|
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.buttons.timeplanner
|
package net.moonleay.liljudd.buttons.timeplanner
|
||||||
|
|
||||||
import dev.kord.core.behavior.edit
|
import dev.kord.core.behavior.edit
|
||||||
import dev.kord.core.behavior.interaction.response.PublicMessageInteractionResponseBehavior
|
import dev.kord.core.behavior.interaction.response.PublicMessageInteractionResponseBehavior
|
||||||
|
@ -24,11 +24,11 @@ import dev.kord.core.entity.Guild
|
||||||
import dev.kord.core.entity.User
|
import dev.kord.core.entity.User
|
||||||
import dev.kord.core.entity.channel.MessageChannel
|
import dev.kord.core.entity.channel.MessageChannel
|
||||||
import dev.kord.core.entity.interaction.ButtonInteraction
|
import dev.kord.core.entity.interaction.ButtonInteraction
|
||||||
import dev.kord.rest.builder.message.modify.embed
|
import dev.kord.rest.builder.message.embed
|
||||||
import net.moonleay.lilJudd.Bot
|
import net.moonleay.liljudd.Bot
|
||||||
import net.moonleay.lilJudd.buttons.component.IEditButton
|
import net.moonleay.liljudd.buttons.component.IEditButton
|
||||||
import net.moonleay.lilJudd.features.AvailabilityManager
|
import net.moonleay.liljudd.features.AvailabilityManager
|
||||||
import net.moonleay.lilJudd.util.EmbedUtil
|
import net.moonleay.liljudd.util.EmbedUtil
|
||||||
|
|
||||||
class NotAvailableEditButton : IEditButton {
|
class NotAvailableEditButton : IEditButton {
|
||||||
override val id: String = "public.edit.btn.timemanagement.notavailable"
|
override val id: String = "public.edit.btn.timemanagement.notavailable"
|
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data
|
package net.moonleay.liljudd.data
|
||||||
|
|
||||||
import java.io.*
|
import java.io.*
|
||||||
import java.util.*
|
import java.util.*
|
||||||
|
@ -29,6 +29,8 @@ object CredentialManager {
|
||||||
lateinit var dbName: String
|
lateinit var dbName: String
|
||||||
lateinit var dbUser: String
|
lateinit var dbUser: String
|
||||||
lateinit var dbPassword: String
|
lateinit var dbPassword: String
|
||||||
|
lateinit var apiDomain: String
|
||||||
|
lateinit var apiToken: String
|
||||||
|
|
||||||
///Load the needed credentials, generate a config if there is none
|
///Load the needed credentials, generate a config if there is none
|
||||||
fun load() {
|
fun load() {
|
||||||
|
@ -51,6 +53,8 @@ object CredentialManager {
|
||||||
dbName = prop.getProperty("dbName")
|
dbName = prop.getProperty("dbName")
|
||||||
dbUser = prop.getProperty("dbUser")
|
dbUser = prop.getProperty("dbUser")
|
||||||
dbPassword = prop.getProperty("dbPassword")
|
dbPassword = prop.getProperty("dbPassword")
|
||||||
|
apiDomain = prop.getProperty("apiDomain")
|
||||||
|
apiToken = prop.getProperty("apiToken")
|
||||||
input.close()
|
input.close()
|
||||||
} catch (e: IOException) {
|
} catch (e: IOException) {
|
||||||
e.printStackTrace()
|
e.printStackTrace()
|
||||||
|
@ -83,6 +87,8 @@ object CredentialManager {
|
||||||
prop.setProperty("dbName", "empty")
|
prop.setProperty("dbName", "empty")
|
||||||
prop.setProperty("dbUser", "empty")
|
prop.setProperty("dbUser", "empty")
|
||||||
prop.setProperty("dbPassword", "empty")
|
prop.setProperty("dbPassword", "empty")
|
||||||
|
prop.setProperty("apiDomain", "empty")
|
||||||
|
prop.setProperty("apiToken", "empty")
|
||||||
prop.store(output, null)
|
prop.store(output, null)
|
||||||
output.close()
|
output.close()
|
||||||
|
|
120
src/main/kotlin/net/moonleay/liljudd/data/NewsManager.kt
Normal file
120
src/main/kotlin/net/moonleay/liljudd/data/NewsManager.kt
Normal file
|
@ -0,0 +1,120 @@
|
||||||
|
/*
|
||||||
|
* 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
|
||||||
|
|
||||||
|
import java.io.*
|
||||||
|
import java.util.*
|
||||||
|
|
||||||
|
object NewsManager {
|
||||||
|
private const val foldername = "data"
|
||||||
|
private const val filename = "news.nick"
|
||||||
|
lateinit var shouldPost: String
|
||||||
|
lateinit var title: String
|
||||||
|
lateinit var news: String
|
||||||
|
|
||||||
|
///Load the needed credentials, generate a config if there is none
|
||||||
|
fun load() {
|
||||||
|
val folder = File(foldername)
|
||||||
|
if (!folder.exists()) {
|
||||||
|
save()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
val configFile = File(folder, filename)
|
||||||
|
if (!configFile.exists()) {
|
||||||
|
save()
|
||||||
|
return
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
val input: InputStream = FileInputStream(foldername + File.separator + filename)
|
||||||
|
val prop = Properties()
|
||||||
|
prop.load(input)
|
||||||
|
shouldPost = prop.getProperty("shouldPost")
|
||||||
|
title = prop.getProperty("title")
|
||||||
|
news = prop.getProperty("news")
|
||||||
|
input.close()
|
||||||
|
} catch (e: IOException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
fun update(){
|
||||||
|
val folder = File(foldername)
|
||||||
|
if (!folder.exists()) {
|
||||||
|
try {
|
||||||
|
folder.mkdirs()
|
||||||
|
} catch (e: IOException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val configFile = File(foldername + File.separator + filename)
|
||||||
|
if (!configFile.exists()) {
|
||||||
|
try {
|
||||||
|
configFile.createNewFile()
|
||||||
|
} catch (e: IOException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
val output: OutputStream = FileOutputStream(foldername + File.separator + filename)
|
||||||
|
val prop = Properties()
|
||||||
|
prop.setProperty("shouldPost", shouldPost)
|
||||||
|
prop.setProperty("title", title)
|
||||||
|
prop.setProperty("news", news)
|
||||||
|
prop.store(output, null)
|
||||||
|
output.close()
|
||||||
|
} catch (e: IOException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
///generate a new sample config
|
||||||
|
private fun save() {
|
||||||
|
val folder = File(foldername)
|
||||||
|
if (!folder.exists()) {
|
||||||
|
try {
|
||||||
|
folder.mkdirs()
|
||||||
|
} catch (e: IOException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
val configFile = File(foldername + File.separator + filename)
|
||||||
|
if (!configFile.exists()) {
|
||||||
|
try {
|
||||||
|
configFile.createNewFile()
|
||||||
|
} catch (e: IOException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
try {
|
||||||
|
val output: OutputStream = FileOutputStream(foldername + File.separator + filename)
|
||||||
|
val prop = Properties()
|
||||||
|
prop.setProperty("shouldPost", "no")
|
||||||
|
prop.setProperty("title", "empty")
|
||||||
|
prop.setProperty("news", "empty")
|
||||||
|
prop.store(output, null)
|
||||||
|
output.close()
|
||||||
|
|
||||||
|
shouldPost = "no"
|
||||||
|
title = "empty"
|
||||||
|
news = "empty"
|
||||||
|
} catch (e: IOException) {
|
||||||
|
e.printStackTrace()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
||||||
|
@ -16,13 +16,22 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.api.entry.coop
|
package net.moonleay.liljudd.data
|
||||||
|
|
||||||
import io.ktor.http.*
|
import java.io.File
|
||||||
|
|
||||||
data class CoopGearData(
|
object StacktraceSaver {
|
||||||
val name: String,
|
fun saveStacktrace(stacktrace: Throwable, timestamp: Long) {
|
||||||
val image: Url,
|
createFolder()
|
||||||
val __typename: String,
|
val dir = File("data", "stacktraces")
|
||||||
|
File(dir, "$timestamp.stk").bufferedWriter().use { out ->
|
||||||
|
out.write(stacktrace.stackTraceToString())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
)
|
private fun createFolder() {
|
||||||
|
val dir = File("data", "stacktraces")
|
||||||
|
if (!dir.exists())
|
||||||
|
dir.mkdir()
|
||||||
|
}
|
||||||
|
}
|
|
@ -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
|
||||||
|
@ -16,11 +16,23 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.api.type
|
package net.moonleay.liljudd.data.api.splatoon3ink
|
||||||
|
|
||||||
enum class ApiRequestType(val nameToDisplay: String) {
|
import kotlinx.serialization.json.Json
|
||||||
AUTOMATIC_CACHE_UPDATE("automatic request to update the cache"),
|
import net.moonleay.liljudd.build.BuildConstants
|
||||||
AUTOMATIC_CACHE_CREATION_AT_STARTUP("automatic request to create cache at startup"),
|
import net.moonleay.liljudd.data.api.splatoon3ink.schedules.Schedules
|
||||||
MANUAL("manual request"),
|
import net.moonleay.liljudd.util.NetUtil
|
||||||
DEBUG("debug request")
|
|
||||||
|
object Splatoon3Api {
|
||||||
|
|
||||||
|
var schedules: Schedules? = null
|
||||||
|
|
||||||
|
fun updateSchedule() {
|
||||||
|
val response = NetUtil.GETJsonData("https://splatoon3.ink/data/schedules.json", "lilJudd/${BuildConstants.version}")
|
||||||
|
if (response.startsWith("error")){
|
||||||
|
println("Error: $response")
|
||||||
|
return
|
||||||
|
}
|
||||||
|
schedules = Json.decodeFromString(response)
|
||||||
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,140 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink
|
||||||
|
|
||||||
|
import net.moonleay.liljudd.data.api.splatoon3ink.schedules.BankaraNode
|
||||||
|
import net.moonleay.liljudd.data.api.splatoon3ink.schedules.RegularNode
|
||||||
|
import net.moonleay.liljudd.data.api.splatoon3ink.schedules.SalmonRunNode
|
||||||
|
import net.moonleay.liljudd.data.api.splatoon3ink.schedules.XNode
|
||||||
|
import net.moonleay.liljudd.util.TimeUtil
|
||||||
|
|
||||||
|
object Splatoon3ApiDataGrabber {
|
||||||
|
fun getRegularMode(timestamp: Long): RegularNode {
|
||||||
|
Splatoon3Api.schedules!!.data.regularSchedules.nodes.map { modeData ->
|
||||||
|
val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC")
|
||||||
|
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
||||||
|
if (timestamp in startTime..endTime) {
|
||||||
|
return modeData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw Exception("No current mode found")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getOpenMode(timestamp: Long): BankaraNode {
|
||||||
|
Splatoon3Api.schedules!!.data.bankaraSchedules.nodes.map { modeData ->
|
||||||
|
val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC")
|
||||||
|
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
||||||
|
if (timestamp in startTime..endTime) {
|
||||||
|
modeData.bankaraMatchSettings!!.map { matchSetting ->
|
||||||
|
if (matchSetting.bankaraMode == "OPEN")
|
||||||
|
return modeData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw Exception("No current mode found")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getXMode(timestamp: Long): XNode {
|
||||||
|
Splatoon3Api.schedules!!.data.xSchedules.nodes.map { modeData ->
|
||||||
|
val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC")
|
||||||
|
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
||||||
|
if (timestamp in startTime..endTime) {
|
||||||
|
return modeData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw Exception("No current mode found")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getSeriesMode(timestamp: Long): BankaraNode {
|
||||||
|
Splatoon3Api.schedules!!.data.bankaraSchedules.nodes.map { modeData ->
|
||||||
|
val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC")
|
||||||
|
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
||||||
|
if (timestamp in startTime..endTime) {
|
||||||
|
modeData.bankaraMatchSettings!!.map { matchSetting ->
|
||||||
|
if (matchSetting.bankaraMode == "CHALLENGE")
|
||||||
|
return modeData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
throw Exception("No current mode found")
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getSalmonRun(timestamp: Long): SalmonRunNode {
|
||||||
|
Splatoon3Api.schedules!!.data.coopGroupingSchedule.regularSchedules.nodes.map { modeData ->
|
||||||
|
val startTime = TimeUtil.deformatJSONTime(modeData.startTime, "UTC")
|
||||||
|
val endTime = TimeUtil.deformatJSONTime(modeData.endTime, "UTC")
|
||||||
|
if (timestamp in startTime..endTime) {
|
||||||
|
return modeData
|
||||||
|
}
|
||||||
|
}
|
||||||
|
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.regularMatchSetting.vsStages[0].name.split(" ")[0]
|
||||||
|
val map2 = modeData.regularMatchSetting.vsStages[1].name.split(" ")[0]
|
||||||
|
return "R: $map1, $map2"
|
||||||
|
}
|
||||||
|
|
||||||
|
fun getOpenMapFormatted(timestamp: Long): String {
|
||||||
|
val modeData = getOpenMode(timestamp)
|
||||||
|
// FIXME: This may cause issues if there is a Splatfest going on
|
||||||
|
// TODO: Check if this works during splatfest
|
||||||
|
// The Open Mode should always be the second mode in the list
|
||||||
|
// FIXME: Add check if 2nd itm in list is open mode
|
||||||
|
val map1 = modeData.bankaraMatchSettings!![1].vsStages[0].name.split(" ")[0]
|
||||||
|
val map2 = modeData.bankaraMatchSettings[1].vsStages[1].name.split(" ")[0]
|
||||||
|
return "O: ${modeData.bankaraMatchSettings[1].vsRule.name}: $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)
|
||||||
|
// FIXME: This may cause issues if there is a Splatfest going on
|
||||||
|
// TODO: Check all the same things as in getOpenMapFormatted
|
||||||
|
val map1 = modeData.bankaraMatchSettings!![0].vsStages[0].name.split(" ")[0]
|
||||||
|
val map2 = modeData.bankaraMatchSettings[0].vsStages[1].name.split(" ")[0]
|
||||||
|
return "S: ${modeData.bankaraMatchSettings[0].vsRule.name}: $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.xMatchSetting.vsStages[0].name.split(" ")[0]
|
||||||
|
val map2 = modeData.xMatchSetting.vsStages[1].name.split(" ")[0]
|
||||||
|
return "X: ${modeData.xMatchSetting.vsRule.name}: $map1, $map2"
|
||||||
|
.replace("Rainmaker", "RMK")
|
||||||
|
.replace("Tower Control", "TC")
|
||||||
|
.replace("Splat Zones", "SZ")
|
||||||
|
.replace("Clam Blitz", "CB")
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class BankaraMatchSetting(
|
||||||
|
@SerialName("bankaraMode")
|
||||||
|
val bankaraMode: String,
|
||||||
|
@SerialName("__isVsSetting")
|
||||||
|
val isVsSetting: String,
|
||||||
|
@SerialName("__typename")
|
||||||
|
val typename: String,
|
||||||
|
@SerialName("vsRule")
|
||||||
|
val vsRule: VsRule,
|
||||||
|
@SerialName("vsStages")
|
||||||
|
val vsStages: List<VsStage>
|
||||||
|
)
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class BankaraNode(
|
||||||
|
@SerialName("bankaraMatchSettings")
|
||||||
|
val bankaraMatchSettings: List<BankaraMatchSetting>?,
|
||||||
|
@SerialName("endTime")
|
||||||
|
val endTime: String,
|
||||||
|
@SerialName("festMatchSettings")
|
||||||
|
val festMatchSettings: List<FestMatchSettingX>?,
|
||||||
|
@SerialName("startTime")
|
||||||
|
val startTime: String
|
||||||
|
)
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class BankaraSchedules(
|
||||||
|
@SerialName("nodes")
|
||||||
|
val nodes: List<BankaraNode>
|
||||||
|
)
|
|
@ -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
|
||||||
|
@ -16,12 +16,14 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.api.entry.schedule
|
package net.moonleay.liljudd.data.api.splatoon3ink.schedules
|
||||||
|
|
||||||
import io.ktor.http.*
|
|
||||||
|
|
||||||
data class MapData(
|
import kotlinx.serialization.SerialName
|
||||||
val stageID: Int,
|
import kotlinx.serialization.Serializable
|
||||||
val image: Url,
|
|
||||||
val name: String,
|
@Serializable
|
||||||
|
data class BannerImage(
|
||||||
|
@SerialName("url")
|
||||||
|
val url: String,
|
||||||
)
|
)
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class BigRunSchedules(
|
||||||
|
@SerialName("nodes")
|
||||||
|
val nodes: List<SalmonRunNode>
|
||||||
|
)
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class Boss(
|
||||||
|
@SerialName("id")
|
||||||
|
val id: String,
|
||||||
|
@SerialName("name")
|
||||||
|
val name: String
|
||||||
|
)
|
|
@ -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
|
||||||
|
@ -16,11 +16,20 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.api.entry.splatfest
|
package net.moonleay.liljudd.data.api.splatoon3ink.schedules
|
||||||
|
|
||||||
data class SplatfestColor(
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class Color(
|
||||||
|
@SerialName("a")
|
||||||
val a: Int,
|
val a: Int,
|
||||||
|
@SerialName("b")
|
||||||
val b: Double,
|
val b: Double,
|
||||||
|
@SerialName("g")
|
||||||
val g: Double,
|
val g: Double,
|
||||||
val r: Double,
|
@SerialName("r")
|
||||||
|
val r: Double
|
||||||
)
|
)
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class CoopGroupingSchedule(
|
||||||
|
@SerialName("bannerImage")
|
||||||
|
val bannerImage: BannerImage?, // is null
|
||||||
|
@SerialName("bigRunSchedules")
|
||||||
|
val bigRunSchedules: BigRunSchedules,
|
||||||
|
@SerialName("regularSchedules")
|
||||||
|
val regularSchedules: RegularSchedules,
|
||||||
|
@SerialName("teamContestSchedules")
|
||||||
|
val teamContestSchedules: TeamContestSchedules?
|
||||||
|
)
|
|
@ -0,0 +1,39 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class CoopSetting(
|
||||||
|
@SerialName("boss")
|
||||||
|
val boss: String?, // Not really String, but idk
|
||||||
|
@SerialName("coopStage")
|
||||||
|
val coopStage: CoopStage,
|
||||||
|
@SerialName("__isCoopSetting")
|
||||||
|
val isCoopSetting: String,
|
||||||
|
@SerialName("rule")
|
||||||
|
val rule: String,
|
||||||
|
@SerialName("__typename")
|
||||||
|
val typename: String,
|
||||||
|
@SerialName("weapons")
|
||||||
|
val weapons: List<Weapon>
|
||||||
|
)
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class CoopStage(
|
||||||
|
@SerialName("id")
|
||||||
|
val id: String,
|
||||||
|
@SerialName("image")
|
||||||
|
val image: Image,
|
||||||
|
@SerialName("name")
|
||||||
|
val name: String,
|
||||||
|
@SerialName("thumbnailImage")
|
||||||
|
val thumbnailImage: ThumbnailImage
|
||||||
|
)
|
|
@ -0,0 +1,43 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class CurrentFest(
|
||||||
|
@SerialName("endTime")
|
||||||
|
val endTime: String,
|
||||||
|
@SerialName("id")
|
||||||
|
val id: String,
|
||||||
|
@SerialName("midtermTime")
|
||||||
|
val midtermTime: String,
|
||||||
|
@SerialName("startTime")
|
||||||
|
val startTime: String,
|
||||||
|
@SerialName("state")
|
||||||
|
val state: String,
|
||||||
|
@SerialName("teams")
|
||||||
|
val teams: List<Team>,
|
||||||
|
@SerialName("title")
|
||||||
|
val title: String,
|
||||||
|
@SerialName("tricolorStage")
|
||||||
|
val tricolorStage: TricolorStage
|
||||||
|
)
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class CurrentPlayer(
|
||||||
|
@SerialName("userIcon")
|
||||||
|
val userIcon: UserIcon
|
||||||
|
)
|
|
@ -0,0 +1,31 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class EventNode(
|
||||||
|
@SerialName("leagueMatchSetting")
|
||||||
|
val leagueMatchSetting: LeagueMatchSetting,
|
||||||
|
@SerialName("timePeriods")
|
||||||
|
val timePeriods: List<TimePeriod>
|
||||||
|
)
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class EventSchedules(
|
||||||
|
@SerialName("nodes")
|
||||||
|
val nodes: List<EventNode>
|
||||||
|
)
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class FestMatchSettingX(
|
||||||
|
@SerialName("__isVsSetting")
|
||||||
|
val isVsSetting: String,
|
||||||
|
@SerialName("__typename")
|
||||||
|
val typename: String,
|
||||||
|
@SerialName("vsRule")
|
||||||
|
val vsRule: VsRule,
|
||||||
|
@SerialName("vsStages")
|
||||||
|
val vsStages: List<VsStage>
|
||||||
|
)
|
|
@ -0,0 +1,28 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class FestMatchSettingXX(
|
||||||
|
@SerialName("__typename")
|
||||||
|
val typename: String
|
||||||
|
)
|
|
@ -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
|
||||||
|
@ -16,19 +16,18 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.api.entry.schedule
|
package net.moonleay.liljudd.data.api.splatoon3ink.schedules
|
||||||
|
|
||||||
import io.ktor.http.*
|
|
||||||
|
|
||||||
data class ShiftData(
|
import kotlinx.serialization.SerialName
|
||||||
val startTime: String,
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class FestNode(
|
||||||
|
@SerialName("endTime")
|
||||||
val endTime: String,
|
val endTime: String,
|
||||||
val __splatoon3ink_king_salmonid_guess: String,
|
@SerialName("festMatchSettings")
|
||||||
val __typename: String,
|
val festMatchSettings: FestMatchSettingX?,
|
||||||
val stageName: String,
|
@SerialName("startTime")
|
||||||
val image: Url,
|
val startTime: String
|
||||||
val weapon1: WeaponData,
|
|
||||||
val weapon2: WeaponData,
|
|
||||||
val weapon3: WeaponData,
|
|
||||||
val weapon4: WeaponData,
|
|
||||||
)
|
)
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class FestSchedules(
|
||||||
|
@SerialName("nodes")
|
||||||
|
val nodes: List<FestNode>
|
||||||
|
)
|
|
@ -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
|
||||||
|
@ -16,13 +16,14 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.api.entry.splatnet
|
package net.moonleay.liljudd.data.api.splatoon3ink.schedules
|
||||||
|
|
||||||
import io.ktor.http.*
|
|
||||||
|
|
||||||
data class BrandData(
|
import kotlinx.serialization.SerialName
|
||||||
val name: String,
|
import kotlinx.serialization.Serializable
|
||||||
val image: Url,
|
|
||||||
val usualGearPower: GearAbilityData?,
|
@Serializable
|
||||||
val saleEndTime: String?,
|
data class Image(
|
||||||
|
@SerialName("url")
|
||||||
|
val url: String
|
||||||
)
|
)
|
|
@ -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
|
||||||
|
@ -16,19 +16,24 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.api.entry.schedule
|
package net.moonleay.liljudd.data.api.splatoon3ink.schedules
|
||||||
|
|
||||||
data class ChallengeModeData(
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class LeagueMatchEvent(
|
||||||
|
@SerialName("desc")
|
||||||
|
val desc: String,
|
||||||
|
@SerialName("id")
|
||||||
|
val id: String,
|
||||||
|
@SerialName("leagueMatchEventId")
|
||||||
val leagueMatchEventId: String,
|
val leagueMatchEventId: String,
|
||||||
|
@SerialName("name")
|
||||||
val name: String,
|
val name: String,
|
||||||
val description: String,
|
@SerialName("regulation")
|
||||||
val regulation: String,
|
val regulation: String,
|
||||||
val map1: MapData?,
|
@SerialName("regulationUrl")
|
||||||
val map2: MapData?,
|
val regulationUrl: String? // is null
|
||||||
val __typename: String,
|
|
||||||
val ruleSet: String,
|
|
||||||
val ruleSetName: String,
|
|
||||||
val timePeriod1: TimePeriodData,
|
|
||||||
val timePeriod2: TimePeriodData,
|
|
||||||
val timePeriod3: TimePeriodData,
|
|
||||||
)
|
)
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class LeagueMatchSetting(
|
||||||
|
@SerialName("__isVsSetting")
|
||||||
|
val isVsSetting: String,
|
||||||
|
@SerialName("leagueMatchEvent")
|
||||||
|
val leagueMatchEvent: LeagueMatchEvent,
|
||||||
|
@SerialName("__typename")
|
||||||
|
val typename: String,
|
||||||
|
@SerialName("vsRule")
|
||||||
|
val vsRule: VsRule,
|
||||||
|
@SerialName("vsStages")
|
||||||
|
val vsStages: List<VsStage>
|
||||||
|
)
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class MapNode(
|
||||||
|
@SerialName("id")
|
||||||
|
val id: String,
|
||||||
|
@SerialName("name")
|
||||||
|
val name: String,
|
||||||
|
@SerialName("originalImage")
|
||||||
|
val originalImage: OriginalImage,
|
||||||
|
@SerialName("stats")
|
||||||
|
val stats: String?, // is null
|
||||||
|
@SerialName("vsStageId")
|
||||||
|
val vsStageId: Int
|
||||||
|
)
|
|
@ -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
|
||||||
|
@ -16,12 +16,14 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.api.entry.splatnet
|
package net.moonleay.liljudd.data.api.splatoon3ink.schedules
|
||||||
|
|
||||||
import io.ktor.http.*
|
|
||||||
|
|
||||||
data class GearAbilityData(
|
import kotlinx.serialization.SerialName
|
||||||
val name: String,
|
import kotlinx.serialization.Serializable
|
||||||
val description: String?,
|
|
||||||
val image: Url,
|
@Serializable
|
||||||
|
data class OriginalImage(
|
||||||
|
@SerialName("url")
|
||||||
|
val url: String
|
||||||
)
|
)
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class RegularMatchSetting(
|
||||||
|
@SerialName("__isVsSetting")
|
||||||
|
val isVsSetting: String,
|
||||||
|
@SerialName("__typename")
|
||||||
|
val typename: String,
|
||||||
|
@SerialName("vsRule")
|
||||||
|
val vsRule: VsRule,
|
||||||
|
@SerialName("vsStages")
|
||||||
|
val vsStages: List<VsStage>
|
||||||
|
)
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class RegularNode(
|
||||||
|
@SerialName("endTime")
|
||||||
|
val endTime: String,
|
||||||
|
@SerialName("festMatchSettings")
|
||||||
|
val festMatchSettings: FestMatchSettingXX?,
|
||||||
|
@SerialName("regularMatchSetting")
|
||||||
|
val regularMatchSetting: RegularMatchSetting,
|
||||||
|
@SerialName("startTime")
|
||||||
|
val startTime: String
|
||||||
|
)
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class RegularSchedules(
|
||||||
|
@SerialName("nodes")
|
||||||
|
val nodes: List<SalmonRunNode>
|
||||||
|
)
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class RegularSchedulesX(
|
||||||
|
@SerialName("nodes")
|
||||||
|
val nodes: List<RegularNode>
|
||||||
|
)
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class SalmonRunNode(
|
||||||
|
@SerialName("endTime")
|
||||||
|
val endTime: String,
|
||||||
|
@SerialName("setting")
|
||||||
|
val setting: Setting,
|
||||||
|
@SerialName("__splatoon3ink_king_salmonid_guess")
|
||||||
|
val splatoon3inkKingSalmonidGuess: String,
|
||||||
|
@SerialName("startTime")
|
||||||
|
val startTime: String
|
||||||
|
)
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class Schedules(
|
||||||
|
@SerialName("data")
|
||||||
|
val data: SchedulesData
|
||||||
|
)
|
|
@ -0,0 +1,45 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class SchedulesData(
|
||||||
|
@SerialName("bankaraSchedules")
|
||||||
|
val bankaraSchedules: BankaraSchedules,
|
||||||
|
@SerialName("coopGroupingSchedule")
|
||||||
|
val coopGroupingSchedule: CoopGroupingSchedule,
|
||||||
|
@SerialName("currentFest")
|
||||||
|
val currentFest: CurrentFest?,
|
||||||
|
@SerialName("currentPlayer")
|
||||||
|
val currentPlayer: CurrentPlayer,
|
||||||
|
@SerialName("eventSchedules")
|
||||||
|
val eventSchedules: EventSchedules,
|
||||||
|
@SerialName("festSchedules")
|
||||||
|
val festSchedules: FestSchedules,
|
||||||
|
@SerialName("regularSchedules")
|
||||||
|
val regularSchedules: RegularSchedulesX,
|
||||||
|
@SerialName("vsStages")
|
||||||
|
val vsStages: VsStages,
|
||||||
|
@SerialName("xSchedules")
|
||||||
|
val xSchedules: XSchedules
|
||||||
|
)
|
|
@ -0,0 +1,37 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class Setting(
|
||||||
|
@SerialName("boss")
|
||||||
|
val boss: Boss,
|
||||||
|
@SerialName("coopStage")
|
||||||
|
val coopStage: CoopStage,
|
||||||
|
@SerialName("__isCoopSetting")
|
||||||
|
val isCoopSetting: String,
|
||||||
|
@SerialName("__typename")
|
||||||
|
val typename: String,
|
||||||
|
@SerialName("weapons")
|
||||||
|
val weapons: List<Weapon>
|
||||||
|
)
|
|
@ -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
|
||||||
|
@ -16,18 +16,18 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.api.entry.splatfest
|
package net.moonleay.liljudd.data.api.splatoon3ink.schedules
|
||||||
|
|
||||||
import io.ktor.http.*
|
|
||||||
|
|
||||||
data class SplatfestData(
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class Team(
|
||||||
|
@SerialName("color")
|
||||||
|
val color: Color,
|
||||||
|
@SerialName("id")
|
||||||
val id: String,
|
val id: String,
|
||||||
val state: String,
|
// @SerialName("myVoteState")
|
||||||
val startTime: String,
|
// val myVoteState: Any?
|
||||||
val endTime: String,
|
|
||||||
val title: String,
|
|
||||||
val image: Url,
|
|
||||||
val team1: SplatfestTeamData,
|
|
||||||
val team2: SplatfestTeamData,
|
|
||||||
val team3: SplatfestTeamData,
|
|
||||||
)
|
)
|
|
@ -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
|
||||||
|
@ -16,9 +16,18 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.api.entry.schedule
|
package net.moonleay.liljudd.data.api.splatoon3ink.schedules
|
||||||
|
|
||||||
data class TimePeriodData(
|
|
||||||
val startTime: String,
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class TeamContestNode(
|
||||||
|
@SerialName("endTime")
|
||||||
val endTime: String,
|
val endTime: String,
|
||||||
|
@SerialName("setting")
|
||||||
|
val setting: CoopSetting,
|
||||||
|
@SerialName("startTime")
|
||||||
|
val startTime: String
|
||||||
)
|
)
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class TeamContestSchedules(
|
||||||
|
@SerialName("nodes")
|
||||||
|
val nodes: List<TeamContestNode> // This is a placeholder.
|
||||||
|
)
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class ThumbnailImage(
|
||||||
|
@SerialName("url")
|
||||||
|
val url: String
|
||||||
|
)
|
|
@ -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
|
||||||
|
@ -16,15 +16,16 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.api.entry.schedule
|
package net.moonleay.liljudd.data.api.splatoon3ink.schedules
|
||||||
|
|
||||||
data class ModeData(
|
|
||||||
val startTime: String,
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class TimePeriod(
|
||||||
|
@SerialName("endTime")
|
||||||
val endTime: String,
|
val endTime: String,
|
||||||
val matchType: String,
|
@SerialName("startTime")
|
||||||
val map1: MapData?,
|
val startTime: String
|
||||||
val map2: MapData?,
|
|
||||||
val ruleSetName: String,
|
|
||||||
val ruleSet: String,
|
|
||||||
val mode: String,
|
|
||||||
)
|
)
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class TricolorStage(
|
||||||
|
@SerialName("id")
|
||||||
|
val id: String,
|
||||||
|
@SerialName("image")
|
||||||
|
val image: Image,
|
||||||
|
@SerialName("name")
|
||||||
|
val name: String
|
||||||
|
)
|
|
@ -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
|
||||||
|
@ -16,11 +16,14 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.api.entry.schedule
|
package net.moonleay.liljudd.data.api.splatoon3ink.schedules
|
||||||
|
|
||||||
import io.ktor.http.*
|
|
||||||
|
|
||||||
data class WeaponData(
|
import kotlinx.serialization.SerialName
|
||||||
val name: String,
|
import kotlinx.serialization.Serializable
|
||||||
val image: Url,
|
|
||||||
|
@Serializable
|
||||||
|
data class UserIcon(
|
||||||
|
@SerialName("url")
|
||||||
|
val url: String
|
||||||
)
|
)
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class VsRule(
|
||||||
|
@SerialName("id")
|
||||||
|
val id: String,
|
||||||
|
@SerialName("name")
|
||||||
|
val name: String,
|
||||||
|
@SerialName("rule")
|
||||||
|
val rule: String
|
||||||
|
)
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class VsStage(
|
||||||
|
@SerialName("id")
|
||||||
|
val id: String,
|
||||||
|
@SerialName("image")
|
||||||
|
val image: Image,
|
||||||
|
@SerialName("name")
|
||||||
|
val name: String,
|
||||||
|
@SerialName("vsStageId")
|
||||||
|
val vsStageId: Int
|
||||||
|
)
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class VsStages(
|
||||||
|
@SerialName("nodes")
|
||||||
|
val nodes: List<MapNode>
|
||||||
|
)
|
|
@ -0,0 +1,33 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class Weapon(
|
||||||
|
@SerialName("image")
|
||||||
|
val image: Image,
|
||||||
|
@SerialName("name")
|
||||||
|
val name: String,
|
||||||
|
@SerialName("__splatoon3ink_id")
|
||||||
|
val splatoon3inkId: String
|
||||||
|
)
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class XMatchSetting(
|
||||||
|
@SerialName("__isVsSetting")
|
||||||
|
val isVsSetting: String,
|
||||||
|
@SerialName("__typename")
|
||||||
|
val typename: String,
|
||||||
|
@SerialName("vsRule")
|
||||||
|
val vsRule: VsRule,
|
||||||
|
@SerialName("vsStages")
|
||||||
|
val vsStages: List<VsStage>
|
||||||
|
)
|
|
@ -0,0 +1,35 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class XNode(
|
||||||
|
@SerialName("endTime")
|
||||||
|
val endTime: String,
|
||||||
|
@SerialName("festMatchSettings")
|
||||||
|
val festMatchSettings: FestMatchSettingXX?,
|
||||||
|
@SerialName("startTime")
|
||||||
|
val startTime: String,
|
||||||
|
@SerialName("xMatchSetting")
|
||||||
|
val xMatchSetting: XMatchSetting
|
||||||
|
)
|
|
@ -0,0 +1,29 @@
|
||||||
|
/*
|
||||||
|
* 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.splatoon3ink.schedules
|
||||||
|
|
||||||
|
|
||||||
|
import kotlinx.serialization.SerialName
|
||||||
|
import kotlinx.serialization.Serializable
|
||||||
|
|
||||||
|
@Serializable
|
||||||
|
data class XSchedules(
|
||||||
|
@SerialName("nodes")
|
||||||
|
val nodes: List<XNode>
|
||||||
|
)
|
|
@ -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
|
||||||
|
@ -16,13 +16,13 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.database
|
package net.moonleay.liljudd.data.database
|
||||||
|
|
||||||
|
|
||||||
import net.moonleay.lilJudd.data.database.tables.MatchPlanningData
|
import net.moonleay.liljudd.data.database.tables.MatchPlanningData
|
||||||
import net.moonleay.lilJudd.data.database.tables.PlanningNotifierRoles
|
import net.moonleay.liljudd.data.database.tables.PlanningNotifierRoles
|
||||||
import net.moonleay.lilJudd.data.database.tables.TimePlanningChannels
|
import net.moonleay.liljudd.data.database.tables.TimePlanningChannels
|
||||||
import net.moonleay.lilJudd.data.database.tables.TimePlanningMessages
|
import net.moonleay.liljudd.data.database.tables.TimePlanningMessages
|
||||||
import org.jetbrains.exposed.sql.Database
|
import org.jetbrains.exposed.sql.Database
|
||||||
import org.jetbrains.exposed.sql.SchemaUtils
|
import org.jetbrains.exposed.sql.SchemaUtils
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.transaction
|
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.database.entry
|
package net.moonleay.liljudd.data.database.entry
|
||||||
|
|
||||||
data class MatchPlanningDataData(
|
data class MatchPlanningDataData(
|
||||||
val id: Int,
|
val id: Int,
|
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.database.entry
|
package net.moonleay.liljudd.data.database.entry
|
||||||
|
|
||||||
data class PlanningNotifierRolesData(
|
data class PlanningNotifierRolesData(
|
||||||
val id: Int, // The id of the entry
|
val id: Int, // The id of the entry
|
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.database.entry
|
package net.moonleay.liljudd.data.database.entry
|
||||||
|
|
||||||
data class TimePlanningChannelsData(
|
data class TimePlanningChannelsData(
|
||||||
val id: Int,
|
val id: Int,
|
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.database.entry
|
package net.moonleay.liljudd.data.database.entry
|
||||||
|
|
||||||
data class TimePlanningMessagesData(
|
data class TimePlanningMessagesData(
|
||||||
val id: Int, // The id of the entry
|
val id: Int, // The id of the entry
|
|
@ -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
|
||||||
|
@ -16,12 +16,15 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.database.repository
|
package net.moonleay.liljudd.data.database.repository
|
||||||
|
|
||||||
import net.moonleay.lilJudd.data.database.entry.MatchPlanningDataData
|
import net.moonleay.liljudd.data.database.entry.MatchPlanningDataData
|
||||||
import net.moonleay.lilJudd.data.database.tables.MatchPlanningData
|
import net.moonleay.liljudd.data.database.tables.MatchPlanningData
|
||||||
import org.jetbrains.exposed.sql.*
|
|
||||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||||
|
import org.jetbrains.exposed.sql.and
|
||||||
|
import org.jetbrains.exposed.sql.deleteWhere
|
||||||
|
import org.jetbrains.exposed.sql.insert
|
||||||
|
import org.jetbrains.exposed.sql.selectAll
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
|
|
||||||
object MatchPlanningDataRepository {
|
object MatchPlanningDataRepository {
|
||||||
|
@ -51,7 +54,7 @@ object MatchPlanningDataRepository {
|
||||||
|
|
||||||
fun get(id: Int): MatchPlanningDataData? =
|
fun get(id: Int): MatchPlanningDataData? =
|
||||||
transaction {
|
transaction {
|
||||||
MatchPlanningData.select { MatchPlanningData.id eq id }.firstOrNull()?.let {
|
MatchPlanningData.selectAll().where { MatchPlanningData.id eq id }.firstOrNull()?.let {
|
||||||
MatchPlanningDataData(
|
MatchPlanningDataData(
|
||||||
it[MatchPlanningData.id],
|
it[MatchPlanningData.id],
|
||||||
it[MatchPlanningData.serverid],
|
it[MatchPlanningData.serverid],
|
||||||
|
@ -69,7 +72,7 @@ object MatchPlanningDataRepository {
|
||||||
|
|
||||||
fun getFromMessageInChannelInServer(messageID: Long, channelID: Long, serverID: Long): MatchPlanningDataData? =
|
fun getFromMessageInChannelInServer(messageID: Long, channelID: Long, serverID: Long): MatchPlanningDataData? =
|
||||||
transaction {
|
transaction {
|
||||||
MatchPlanningData.select {
|
MatchPlanningData.selectAll().where {
|
||||||
MatchPlanningData.messageid eq (messageID) and (
|
MatchPlanningData.messageid eq (messageID) and (
|
||||||
MatchPlanningData.serverid eq (serverID)) and (
|
MatchPlanningData.serverid eq (serverID)) and (
|
||||||
MatchPlanningData.channelid eq (channelID))
|
MatchPlanningData.channelid eq (channelID))
|
||||||
|
@ -98,15 +101,15 @@ object MatchPlanningDataRepository {
|
||||||
fun write(data: MatchPlanningDataData): Int =
|
fun write(data: MatchPlanningDataData): Int =
|
||||||
transaction {
|
transaction {
|
||||||
MatchPlanningData.insert {
|
MatchPlanningData.insert {
|
||||||
it[MatchPlanningData.serverid] = data.serverID
|
it[serverid] = data.serverID
|
||||||
it[MatchPlanningData.channelid] = data.channelID
|
it[channelid] = data.channelID
|
||||||
it[MatchPlanningData.matchtype] = data.matchType
|
it[matchtype] = data.matchType
|
||||||
it[MatchPlanningData.registererid] = data.registererID
|
it[registererid] = data.registererID
|
||||||
it[MatchPlanningData.roleid] = data.roleID
|
it[roleid] = data.roleID
|
||||||
it[MatchPlanningData.opponentName] = data.opponentName
|
it[opponentName] = data.opponentName
|
||||||
it[MatchPlanningData.messageid] = data.messageID
|
it[messageid] = data.messageID
|
||||||
it[MatchPlanningData.timestamp] = data.timestamp
|
it[timestamp] = data.timestamp
|
||||||
it[MatchPlanningData.jobstr] = data.jobString
|
it[jobstr] = data.jobString
|
||||||
} get MatchPlanningData.id
|
} get MatchPlanningData.id
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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
|
||||||
|
@ -16,12 +16,15 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.database.repository
|
package net.moonleay.liljudd.data.database.repository
|
||||||
|
|
||||||
import net.moonleay.lilJudd.data.database.entry.PlanningNotifierRolesData
|
import net.moonleay.liljudd.data.database.entry.PlanningNotifierRolesData
|
||||||
import net.moonleay.lilJudd.data.database.tables.PlanningNotifierRoles
|
import net.moonleay.liljudd.data.database.tables.PlanningNotifierRoles
|
||||||
import org.jetbrains.exposed.sql.*
|
|
||||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||||
|
import org.jetbrains.exposed.sql.and
|
||||||
|
import org.jetbrains.exposed.sql.deleteWhere
|
||||||
|
import org.jetbrains.exposed.sql.insert
|
||||||
|
import org.jetbrains.exposed.sql.selectAll
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
|
|
||||||
object PlanningNotifierRolesRepository {
|
object PlanningNotifierRolesRepository {
|
||||||
|
@ -46,9 +49,7 @@ object PlanningNotifierRolesRepository {
|
||||||
|
|
||||||
fun getForChannel(channelID: Long): PlanningNotifierRolesData? =
|
fun getForChannel(channelID: Long): PlanningNotifierRolesData? =
|
||||||
transaction {
|
transaction {
|
||||||
PlanningNotifierRoles.select {
|
PlanningNotifierRoles.selectAll().where { PlanningNotifierRoles.channelid eq channelID }.firstOrNull()?.let {
|
||||||
PlanningNotifierRoles.channelid eq channelID
|
|
||||||
}.firstOrNull()?.let {
|
|
||||||
PlanningNotifierRolesData(
|
PlanningNotifierRolesData(
|
||||||
it[PlanningNotifierRoles.id],
|
it[PlanningNotifierRoles.id],
|
||||||
it[PlanningNotifierRoles.serverid],
|
it[PlanningNotifierRoles.serverid],
|
||||||
|
@ -61,9 +62,9 @@ object PlanningNotifierRolesRepository {
|
||||||
|
|
||||||
fun getForChannelInServer(channelID: Long, serverID: Long): PlanningNotifierRolesData? =
|
fun getForChannelInServer(channelID: Long, serverID: Long): PlanningNotifierRolesData? =
|
||||||
transaction {
|
transaction {
|
||||||
PlanningNotifierRoles.select {
|
PlanningNotifierRoles.selectAll()
|
||||||
PlanningNotifierRoles.channelid eq channelID and (PlanningNotifierRoles.serverid eq serverID)
|
.where { PlanningNotifierRoles.channelid eq channelID and (PlanningNotifierRoles.serverid eq serverID) }
|
||||||
}.firstOrNull()?.let {
|
.firstOrNull()?.let {
|
||||||
PlanningNotifierRolesData(
|
PlanningNotifierRolesData(
|
||||||
it[PlanningNotifierRoles.id],
|
it[PlanningNotifierRoles.id],
|
||||||
it[PlanningNotifierRoles.serverid],
|
it[PlanningNotifierRoles.serverid],
|
||||||
|
@ -76,22 +77,23 @@ object PlanningNotifierRolesRepository {
|
||||||
|
|
||||||
fun existsInChannel(channelID: Long): Boolean =
|
fun existsInChannel(channelID: Long): Boolean =
|
||||||
transaction {
|
transaction {
|
||||||
PlanningNotifierRoles.select { PlanningNotifierRoles.channelid eq channelID }.count() > 0
|
PlanningNotifierRoles.selectAll().where { PlanningNotifierRoles.channelid eq channelID }.count() > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
fun existsInChannelFromSever(channelID: Long, serverID: Long): Boolean =
|
fun existsInChannelFromSever(channelID: Long, serverID: Long): Boolean =
|
||||||
transaction {
|
transaction {
|
||||||
PlanningNotifierRoles.select { PlanningNotifierRoles.channelid eq channelID and (PlanningNotifierRoles.serverid eq serverID) }
|
PlanningNotifierRoles.selectAll()
|
||||||
|
.where { PlanningNotifierRoles.channelid eq channelID and (PlanningNotifierRoles.serverid eq serverID) }
|
||||||
.count() > 0
|
.count() > 0
|
||||||
}
|
}
|
||||||
|
|
||||||
fun write(data: PlanningNotifierRolesData) {
|
fun write(data: PlanningNotifierRolesData) {
|
||||||
transaction {
|
transaction {
|
||||||
PlanningNotifierRoles.insert {
|
PlanningNotifierRoles.insert {
|
||||||
it[PlanningNotifierRoles.serverid] = data.serverID
|
it[serverid] = data.serverID
|
||||||
it[PlanningNotifierRoles.channelid] = data.channelID
|
it[channelid] = data.channelID
|
||||||
it[PlanningNotifierRoles.hastimeroleid] = data.hasTimeRoleID
|
it[hastimeroleid] = data.hasTimeRoleID
|
||||||
it[PlanningNotifierRoles.wantstobenotifiedid] = data.wantsToBeNotifiedID
|
it[wantstobenotifiedid] = data.wantsToBeNotifiedID
|
||||||
} get PlanningNotifierRoles.id
|
} get PlanningNotifierRoles.id
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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
|
||||||
|
@ -16,12 +16,15 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.database.repository
|
package net.moonleay.liljudd.data.database.repository
|
||||||
|
|
||||||
import net.moonleay.lilJudd.data.database.entry.TimePlanningChannelsData
|
import net.moonleay.liljudd.data.database.entry.TimePlanningChannelsData
|
||||||
import net.moonleay.lilJudd.data.database.tables.TimePlanningChannels
|
import net.moonleay.liljudd.data.database.tables.TimePlanningChannels
|
||||||
import org.jetbrains.exposed.sql.*
|
|
||||||
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
import org.jetbrains.exposed.sql.SqlExpressionBuilder.eq
|
||||||
|
import org.jetbrains.exposed.sql.and
|
||||||
|
import org.jetbrains.exposed.sql.deleteWhere
|
||||||
|
import org.jetbrains.exposed.sql.insert
|
||||||
|
import org.jetbrains.exposed.sql.selectAll
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
|
|
||||||
object TimePlanningChannelsRepository {
|
object TimePlanningChannelsRepository {
|
||||||
|
@ -43,7 +46,8 @@ object TimePlanningChannelsRepository {
|
||||||
|
|
||||||
fun exists(channelID: Long, serverID: Long): Boolean =
|
fun exists(channelID: Long, serverID: Long): Boolean =
|
||||||
transaction {
|
transaction {
|
||||||
TimePlanningChannels.select { TimePlanningChannels.channelid eq channelID and (TimePlanningChannels.serverid eq serverID) }
|
TimePlanningChannels.selectAll()
|
||||||
|
.where { TimePlanningChannels.channelid eq channelID and (TimePlanningChannels.serverid eq serverID) }
|
||||||
.firstOrNull() != null
|
.firstOrNull() != null
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -55,15 +59,15 @@ object TimePlanningChannelsRepository {
|
||||||
|
|
||||||
fun deleteFromChannelInServer(channelID: Long, serverID: Long) {
|
fun deleteFromChannelInServer(channelID: Long, serverID: Long) {
|
||||||
transaction {
|
transaction {
|
||||||
TimePlanningChannels.deleteWhere { TimePlanningChannels.channelid eq channelID and (TimePlanningChannels.serverid eq serverID) }
|
TimePlanningChannels.deleteWhere { channelid eq channelID and (serverid eq serverID) }
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
fun write(data: TimePlanningChannelsData): Int =
|
fun write(data: TimePlanningChannelsData): Int =
|
||||||
transaction {
|
transaction {
|
||||||
TimePlanningChannels.insert {
|
TimePlanningChannels.insert {
|
||||||
it[TimePlanningChannels.serverid] = data.serverID
|
it[serverid] = data.serverID
|
||||||
it[TimePlanningChannels.channelid] = data.channelID
|
it[channelid] = data.channelID
|
||||||
} get TimePlanningChannels.id
|
} get TimePlanningChannels.id
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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
|
||||||
|
@ -16,13 +16,13 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.database.repository
|
package net.moonleay.liljudd.data.database.repository
|
||||||
|
|
||||||
import net.moonleay.lilJudd.data.database.entry.TimePlanningMessagesData
|
import net.moonleay.liljudd.data.database.entry.TimePlanningMessagesData
|
||||||
import net.moonleay.lilJudd.data.database.tables.TimePlanningMessages
|
import net.moonleay.liljudd.data.database.tables.TimePlanningMessages
|
||||||
import org.jetbrains.exposed.sql.and
|
import org.jetbrains.exposed.sql.and
|
||||||
import org.jetbrains.exposed.sql.insert
|
import org.jetbrains.exposed.sql.insert
|
||||||
import org.jetbrains.exposed.sql.select
|
import org.jetbrains.exposed.sql.selectAll
|
||||||
import org.jetbrains.exposed.sql.transactions.transaction
|
import org.jetbrains.exposed.sql.transactions.transaction
|
||||||
|
|
||||||
object TimePlanningMessagesRepository {
|
object TimePlanningMessagesRepository {
|
||||||
|
@ -40,9 +40,7 @@ object TimePlanningMessagesRepository {
|
||||||
fun getWeek(stamp: Long): List<TimePlanningMessagesData> {
|
fun getWeek(stamp: Long): List<TimePlanningMessagesData> {
|
||||||
val dataList = mutableListOf<TimePlanningMessagesData>()
|
val dataList = mutableListOf<TimePlanningMessagesData>()
|
||||||
transaction {
|
transaction {
|
||||||
for (pnr in TimePlanningMessages.select {
|
for (pnr in TimePlanningMessages.selectAll().where { TimePlanningMessages.weekstamp eq (stamp) }) {
|
||||||
TimePlanningMessages.weekstamp eq (stamp)
|
|
||||||
}) {
|
|
||||||
dataList.add(
|
dataList.add(
|
||||||
TimePlanningMessagesData(
|
TimePlanningMessagesData(
|
||||||
pnr[TimePlanningMessages.id],
|
pnr[TimePlanningMessages.id],
|
||||||
|
@ -59,9 +57,8 @@ object TimePlanningMessagesRepository {
|
||||||
|
|
||||||
fun getWeekInChannel(stamp: Long, channelID: Long): TimePlanningMessagesData? =
|
fun getWeekInChannel(stamp: Long, channelID: Long): TimePlanningMessagesData? =
|
||||||
transaction {
|
transaction {
|
||||||
TimePlanningMessages.select {
|
TimePlanningMessages.selectAll()
|
||||||
TimePlanningMessages.weekstamp eq (stamp) and (TimePlanningMessages.channelid eq channelID)
|
.where { TimePlanningMessages.weekstamp eq (stamp) and (TimePlanningMessages.channelid eq channelID) }.firstOrNull()?.let {
|
||||||
}.firstOrNull()?.let {
|
|
||||||
TimePlanningMessagesData(
|
TimePlanningMessagesData(
|
||||||
it[TimePlanningMessages.id],
|
it[TimePlanningMessages.id],
|
||||||
it[TimePlanningMessages.serverid],
|
it[TimePlanningMessages.serverid],
|
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.database.tables
|
package net.moonleay.liljudd.data.database.tables
|
||||||
|
|
||||||
import org.jetbrains.exposed.sql.Table
|
import org.jetbrains.exposed.sql.Table
|
||||||
|
|
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.database.tables
|
package net.moonleay.liljudd.data.database.tables
|
||||||
|
|
||||||
import org.jetbrains.exposed.sql.Table
|
import org.jetbrains.exposed.sql.Table
|
||||||
|
|
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.database.tables
|
package net.moonleay.liljudd.data.database.tables
|
||||||
|
|
||||||
import org.jetbrains.exposed.sql.Table
|
import org.jetbrains.exposed.sql.Table
|
||||||
|
|
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.database.tables
|
package net.moonleay.liljudd.data.database.tables
|
||||||
|
|
||||||
import org.jetbrains.exposed.sql.Table
|
import org.jetbrains.exposed.sql.Table
|
||||||
|
|
|
@ -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
|
||||||
|
@ -16,22 +16,22 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.extensions
|
package net.moonleay.liljudd.extensions
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.commands.Arguments
|
import com.kotlindiscord.kord.extensions.commands.Arguments
|
||||||
import com.kotlindiscord.kord.extensions.commands.application.slash.converters.impl.enumChoice
|
import com.kotlindiscord.kord.extensions.commands.application.slash.converters.impl.enumChoice
|
||||||
import com.kotlindiscord.kord.extensions.commands.converters.impl.channel
|
import com.kotlindiscord.kord.extensions.commands.converters.impl.channel
|
||||||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
import com.kotlindiscord.kord.extensions.types.respond
|
|
||||||
import com.kotlindiscord.kord.extensions.utils.hasPermission
|
import com.kotlindiscord.kord.extensions.utils.hasPermission
|
||||||
import dev.kord.common.entity.Permission
|
import dev.kord.common.entity.Permission
|
||||||
import net.moonleay.lilJudd.extensions.component.EnableOrDisable
|
import dev.kord.rest.builder.message.embed
|
||||||
import net.moonleay.lilJudd.features.component.FeatureEnum
|
import net.moonleay.liljudd.extensions.component.EnableOrDisable
|
||||||
import net.moonleay.lilJudd.features.component.FeatureManager
|
import net.moonleay.liljudd.features.component.FeatureEnum
|
||||||
import net.moonleay.lilJudd.util.EmbedColor
|
import net.moonleay.liljudd.features.component.FeatureManager
|
||||||
import net.moonleay.lilJudd.util.Logger
|
import net.moonleay.liljudd.util.EmbedColor
|
||||||
import net.moonleay.lilJudd.util.MessageUtil
|
import net.moonleay.liljudd.util.Logger
|
||||||
|
import net.moonleay.liljudd.util.MessageUtil
|
||||||
|
|
||||||
class FeatureManageExtension : Extension() {
|
class FeatureManageExtension : Extension() {
|
||||||
|
|
||||||
|
@ -49,14 +49,16 @@ class FeatureManageExtension : Extension() {
|
||||||
val u = this.user
|
val u = this.user
|
||||||
if (!u.asMember(this.guild!!.id).hasPermission(Permission.Administrator)) {
|
if (!u.asMember(this.guild!!.id).hasPermission(Permission.Administrator)) {
|
||||||
this.respond {
|
this.respond {
|
||||||
embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = EmbedColor.ERROR.color
|
||||||
EmbedColor.ERROR,
|
this.title = "401: Not Authorized"
|
||||||
"403: Forbidden",
|
this.description =
|
||||||
"You cannot edit features, as you don't have the Administrator permission.",
|
"You cannot edit features, as you don't have the Administrator permission."
|
||||||
u.asUser().username + "#" + u.asUser().discriminator
|
this.footer {
|
||||||
)
|
this.icon = u.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
)
|
this.text = MessageUtil.getFooter(u)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
@ -68,26 +70,45 @@ class FeatureManageExtension : Extension() {
|
||||||
val f = FeatureManager.getFeature(args.feature)
|
val f = FeatureManager.getFeature(args.feature)
|
||||||
if (f == null) {
|
if (f == null) {
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = EmbedColor.ERROR.color
|
||||||
EmbedColor.ERROR,
|
this.title = "404: Not Found"
|
||||||
"404: Not Found",
|
this.description = "The feature you are trying to edit does not exist."
|
||||||
"The feature you are trying to edit does not exist.",
|
this.footer {
|
||||||
u.asUser().username + "#" + u.asUser().discriminator
|
this.icon = u.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
)
|
this.text = MessageUtil.getFooter(u)
|
||||||
)
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
|
||||||
if (this.arguments.setStatus == EnableOrDisable.ENABLE) {
|
if (this.arguments.setStatus == EnableOrDisable.ENABLE) {
|
||||||
|
val enabled = f.enable(u, gID, cID, channel, args)
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(f.enable(u, gID, cID, channel, args))
|
this.embed {
|
||||||
|
this.color = enabled.color
|
||||||
|
this.title = enabled.title
|
||||||
|
this.description = enabled.description
|
||||||
|
this.footer {
|
||||||
|
this.icon = u.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
|
this.text = MessageUtil.getFooter(u)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
val disabled = f.disable(u, gID, cID, channel, args)
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(f.disable(u, gID, cID, channel, args))
|
this.embed {
|
||||||
|
this.color = disabled.color
|
||||||
|
this.title = disabled.title
|
||||||
|
this.description = disabled.description
|
||||||
|
this.footer {
|
||||||
|
this.icon = u.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
|
this.text = MessageUtil.getFooter(u)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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
|
||||||
|
@ -16,13 +16,13 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.extensions
|
package net.moonleay.liljudd.extensions
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
import net.moonleay.lilJudd.util.EmbedColor
|
import dev.kord.rest.builder.message.embed
|
||||||
import net.moonleay.lilJudd.util.MessageUtil
|
|
||||||
import net.moonleay.liljudd.build.BuildConstants
|
import net.moonleay.liljudd.build.BuildConstants
|
||||||
|
import net.moonleay.liljudd.util.EmbedColor
|
||||||
|
|
||||||
class InfoExtension : Extension() {
|
class InfoExtension : Extension() {
|
||||||
override val name = "info"
|
override val name = "info"
|
||||||
|
@ -31,16 +31,17 @@ class InfoExtension : Extension() {
|
||||||
name = "info"
|
name = "info"
|
||||||
description = "Show infos about the bot"
|
description = "Show infos about the bot"
|
||||||
this.action {
|
this.action {
|
||||||
MessageUtil.sendEmbedForPublicSlashCommand(
|
this.respond {
|
||||||
this,
|
this.embed {
|
||||||
EmbedColor.INFO,
|
this.color = EmbedColor.INFO.color
|
||||||
"Lil' Judd",
|
this.title = "Li'l Judd"
|
||||||
"Lil' Judd ***v." + BuildConstants.version + "***\n" +
|
this.description = "Li'l Judd ***v." + BuildConstants.version + "***\n" +
|
||||||
"Kord-Extensions ***v." + BuildConstants.kordVersion + "***\n" +
|
"Kord-Extensions ***v." + BuildConstants.kordVersion + "***\n" +
|
||||||
"Coroutines ***v." + BuildConstants.coroutinesVersion + "***\n" +
|
"Coroutines ***v." + BuildConstants.coroutinesVersion + "***\n" +
|
||||||
"Krontab ***v." + BuildConstants.krontabVersion + "***\n\n" +
|
"Krontab ***v." + BuildConstants.krontabVersion + "***\n\n" +
|
||||||
"Splatoon 3 api data provided by splatoon3.ink"
|
"Splatoon 3 api data provided by splatoon3.ink"
|
||||||
)
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -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
|
||||||
|
@ -16,27 +16,25 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.extensions
|
package net.moonleay.liljudd.extensions
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.commands.Arguments
|
import com.kotlindiscord.kord.extensions.commands.Arguments
|
||||||
import com.kotlindiscord.kord.extensions.commands.application.slash.converters.impl.enumChoice
|
import com.kotlindiscord.kord.extensions.commands.application.slash.converters.impl.enumChoice
|
||||||
import com.kotlindiscord.kord.extensions.commands.converters.impl.optionalString
|
|
||||||
import com.kotlindiscord.kord.extensions.commands.converters.impl.string
|
import com.kotlindiscord.kord.extensions.commands.converters.impl.string
|
||||||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
import com.kotlindiscord.kord.extensions.types.respond
|
|
||||||
import dev.kord.core.behavior.channel.createMessage
|
|
||||||
import dev.kord.core.behavior.createRole
|
import dev.kord.core.behavior.createRole
|
||||||
import dev.kord.rest.builder.message.create.actionRow
|
import dev.kord.rest.builder.message.actionRow
|
||||||
import net.moonleay.lilJudd.data.database.entry.MatchPlanningDataData
|
import dev.kord.rest.builder.message.embed
|
||||||
import net.moonleay.lilJudd.data.database.repository.MatchPlanningDataRepository
|
import net.moonleay.liljudd.data.database.entry.MatchPlanningDataData
|
||||||
import net.moonleay.lilJudd.extensions.component.MatchTypes
|
import net.moonleay.liljudd.data.database.repository.MatchPlanningDataRepository
|
||||||
import net.moonleay.lilJudd.jobs.MatchJob
|
import net.moonleay.liljudd.extensions.component.MatchTypes
|
||||||
import net.moonleay.lilJudd.jobs.component.JobManager
|
import net.moonleay.liljudd.jobs.MatchJob
|
||||||
import net.moonleay.lilJudd.util.EmbedColor
|
import net.moonleay.liljudd.jobs.component.JobManager
|
||||||
import net.moonleay.lilJudd.util.EmbedUtil
|
import net.moonleay.liljudd.util.EmbedColor
|
||||||
import net.moonleay.lilJudd.util.MessageUtil
|
import net.moonleay.liljudd.util.EmbedUtil
|
||||||
import net.moonleay.lilJudd.util.TimeUtil
|
import net.moonleay.liljudd.util.MessageUtil
|
||||||
|
import net.moonleay.liljudd.util.TimeUtil
|
||||||
|
|
||||||
class MatchExtension : Extension() {
|
class MatchExtension : Extension() {
|
||||||
|
|
||||||
|
@ -54,26 +52,23 @@ class MatchExtension : Extension() {
|
||||||
val m = this.member!!
|
val m = this.member!!
|
||||||
val gID = this.guild!!.id.value
|
val gID = this.guild!!.id.value
|
||||||
val cID = this.channel.id.value
|
val cID = this.channel.id.value
|
||||||
val opponent = args.opponent ?: "?"
|
val opponent = args.opponent
|
||||||
val msg = this.respond {
|
if (!TimeUtil.validateDateString(args.timeStamp)) {
|
||||||
this.embeds.add(
|
this.respond {
|
||||||
MessageUtil.getEmbedWithTable(
|
this.embed {
|
||||||
EmbedColor.INFO,
|
this.color = EmbedColor.ERROR.color
|
||||||
args.matchType.readableName,
|
this.title = "400: Bad Request"
|
||||||
"***Vs. $opponent***\n" +
|
this.description = "The given timestamp is invalid.\n" +
|
||||||
"At ${args.timeStamp}\n" +
|
"Please use the format \"dd.MM.yyyy HH:mm\"."
|
||||||
"Registered by ${m.mention}",
|
this.footer {
|
||||||
mapOf(
|
this.icon = m.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
"Signed up" to listOf(),
|
this.text = MessageUtil.getFooter(m.asUser())
|
||||||
"Unavailable" to listOf(),
|
|
||||||
)
|
|
||||||
)
|
|
||||||
)
|
|
||||||
|
|
||||||
this.actionRow {
|
|
||||||
this.components.addAll(EmbedUtil.getMatchButtons().components)
|
|
||||||
}
|
}
|
||||||
} // filter time to date:
|
}
|
||||||
|
}
|
||||||
|
return@action
|
||||||
|
}
|
||||||
|
// filter time to date:
|
||||||
val zdt = TimeUtil.getDateFromString(args.timeStamp)
|
val zdt = TimeUtil.getDateFromString(args.timeStamp)
|
||||||
// get the string for the cronjob
|
// get the string for the cronjob
|
||||||
val jobString = TimeUtil.getCronjobStringFromDate(zdt)
|
val jobString = TimeUtil.getCronjobStringFromDate(zdt)
|
||||||
|
@ -85,19 +80,47 @@ class MatchExtension : Extension() {
|
||||||
}
|
}
|
||||||
// Check if the role was created successfully
|
// Check if the role was created successfully
|
||||||
if (role == null) {
|
if (role == null) {
|
||||||
this.channel.createMessage {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = EmbedColor.ERROR.color
|
||||||
EmbedColor.ERROR,
|
this.title = "500: Internal Error"
|
||||||
"500: Internal Error",
|
this.description = "Could not find created role.\n" +
|
||||||
"Could not find created role.\n" +
|
"It seems, that said role could not be created."
|
||||||
"It seems, that said role could not be created.",
|
this.footer {
|
||||||
"system message"
|
this.icon = m.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
)
|
this.text = MessageUtil.getFooter(m.asUser())
|
||||||
)
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
|
val msg = this.respond {
|
||||||
|
val eb = MessageUtil.getEmbedWithTable(
|
||||||
|
EmbedColor.INFO,
|
||||||
|
args.matchType.readableName,
|
||||||
|
"***Vs. $opponent***\n" +
|
||||||
|
"At ${args.timeStamp}\n" +
|
||||||
|
"Registered by ${m.mention}",
|
||||||
|
mapOf(
|
||||||
|
"Signed up" to listOf(),
|
||||||
|
"Unavailable" to listOf(),
|
||||||
|
)
|
||||||
|
)
|
||||||
|
this.embed {
|
||||||
|
this.color = eb.color
|
||||||
|
this.title = eb.title
|
||||||
|
this.description = eb.description
|
||||||
|
this.fields = eb.fields
|
||||||
|
this.footer {
|
||||||
|
this.icon = m.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
|
this.text = MessageUtil.getFooter(m.asUser())
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
this.actionRow {
|
||||||
|
this.components.addAll(EmbedUtil.getMatchButtons().components)
|
||||||
|
}
|
||||||
|
}
|
||||||
val tID = MatchPlanningDataRepository.write(
|
val tID = MatchPlanningDataRepository.write(
|
||||||
MatchPlanningDataData(
|
MatchPlanningDataData(
|
||||||
0,
|
0,
|
||||||
|
@ -114,6 +137,7 @@ class MatchExtension : Extension() {
|
||||||
)
|
)
|
||||||
if (tID == null || tID <= 0) {
|
if (tID == null || tID <= 0) {
|
||||||
return@action // Not saved to db
|
return@action // Not saved to db
|
||||||
|
// TODO: Add error message
|
||||||
}
|
}
|
||||||
JobManager.addJob(
|
JobManager.addJob(
|
||||||
MatchJob(
|
MatchJob(
|
||||||
|
@ -140,7 +164,7 @@ class MatchExtension : Extension() {
|
||||||
this.description = "The timestamp of the match. Format \"dd.MM.yyyy HH:mm\"."
|
this.description = "The timestamp of the match. Format \"dd.MM.yyyy HH:mm\"."
|
||||||
}
|
}
|
||||||
|
|
||||||
val opponent by optionalString {
|
val opponent by string {
|
||||||
this.name = "opponent"
|
this.name = "opponent"
|
||||||
this.description = "The opponent"
|
this.description = "The opponent"
|
||||||
}
|
}
|
|
@ -0,0 +1,464 @@
|
||||||
|
/*
|
||||||
|
* 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.extensions
|
||||||
|
|
||||||
|
import com.kotlindiscord.kord.extensions.commands.Arguments
|
||||||
|
import com.kotlindiscord.kord.extensions.commands.application.slash.converters.impl.enumChoice
|
||||||
|
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||||
|
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
|
import dev.kord.common.Color
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
|
import kotlinx.datetime.Clock
|
||||||
|
import net.moonleay.liljudd.data.api.splatoon3ink.Splatoon3ApiDataGrabber
|
||||||
|
import net.moonleay.liljudd.extensions.component.SplatoonOnlineMode
|
||||||
|
import net.moonleay.liljudd.util.TimeUtil
|
||||||
|
|
||||||
|
class RotationExtension : Extension() {
|
||||||
|
|
||||||
|
override val name = "rotation"
|
||||||
|
override val allowApplicationCommandInDMs: Boolean
|
||||||
|
get() = false
|
||||||
|
|
||||||
|
|
||||||
|
override suspend fun setup() {
|
||||||
|
publicSlashCommand(::RotationArguments) {
|
||||||
|
name = "rotation"
|
||||||
|
description = "Check the current rotations"
|
||||||
|
this.action {
|
||||||
|
val mode = this.arguments.mode
|
||||||
|
when (mode) {
|
||||||
|
SplatoonOnlineMode.ALL -> {
|
||||||
|
val regSched = Splatoon3ApiDataGrabber.getRegularMode(System.currentTimeMillis())
|
||||||
|
val regMaps = regSched.regularMatchSetting.vsStages
|
||||||
|
val regMap1 = regMaps[0]
|
||||||
|
val regMap2 = regMaps[1]
|
||||||
|
|
||||||
|
val serSched = Splatoon3ApiDataGrabber.getSeriesMode(System.currentTimeMillis())
|
||||||
|
val serMaps = serSched.bankaraMatchSettings!!.first().vsStages
|
||||||
|
val serMap1 = serMaps[0]
|
||||||
|
val serMap2 = serMaps[1]
|
||||||
|
|
||||||
|
val opnSched = Splatoon3ApiDataGrabber.getSeriesMode(System.currentTimeMillis())
|
||||||
|
val opnMaps = opnSched.bankaraMatchSettings!!.last().vsStages
|
||||||
|
val opnMap1 = opnMaps[0]
|
||||||
|
val opnMap2 = opnMaps[1]
|
||||||
|
|
||||||
|
val xSched = Splatoon3ApiDataGrabber.getXMode(System.currentTimeMillis())
|
||||||
|
val xMaps = xSched.xMatchSetting.vsStages
|
||||||
|
val xMap1 = xMaps[0]
|
||||||
|
val xMap2 = xMaps[1]
|
||||||
|
|
||||||
|
val salSched = Splatoon3ApiDataGrabber.getSalmonRun(System.currentTimeMillis())
|
||||||
|
val salMap = salSched.setting.coopStage.name
|
||||||
|
val salBoss = salSched.setting.boss.name
|
||||||
|
val salWeapons = salSched.setting.weapons
|
||||||
|
|
||||||
|
this.respond {
|
||||||
|
this.embed {
|
||||||
|
this.author {
|
||||||
|
this.name = "Current rotation for"
|
||||||
|
}
|
||||||
|
this.title = "All Modes"
|
||||||
|
this.description = "[[Open on website](https://splatoon3.ink/)]"
|
||||||
|
this.color = Color(0x1437FF)
|
||||||
|
|
||||||
|
this.thumbnail {
|
||||||
|
this.url = "https://static.moonleay.net/img/lilJudd/deepcut.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field {
|
||||||
|
this.name = "Regular (${
|
||||||
|
TimeUtil.getTimeFromJSONTime(
|
||||||
|
regSched.startTime,
|
||||||
|
"UTC"
|
||||||
|
)
|
||||||
|
} - ${TimeUtil.getTimeFromJSONTime(regSched.endTime, "UTC")})"
|
||||||
|
this.value =
|
||||||
|
"${regSched.regularMatchSetting.vsRule.name} on ${regMap1.name} & ${regMap2.name}"
|
||||||
|
this.inline = false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field {
|
||||||
|
this.name = "Series (${
|
||||||
|
TimeUtil.getTimeFromJSONTime(
|
||||||
|
serSched.startTime,
|
||||||
|
"UTC"
|
||||||
|
)
|
||||||
|
} - ${TimeUtil.getTimeFromJSONTime(serSched.endTime, "UTC")})"
|
||||||
|
this.value =
|
||||||
|
"${serSched.bankaraMatchSettings.first().vsRule.name} on ${serMap1.name} & ${serMap2.name}"
|
||||||
|
this.inline = false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field {
|
||||||
|
this.name = "Open (${
|
||||||
|
TimeUtil.getTimeFromJSONTime(
|
||||||
|
opnSched.startTime,
|
||||||
|
"UTC"
|
||||||
|
)
|
||||||
|
} - ${TimeUtil.getTimeFromJSONTime(opnSched.endTime, "UTC")})"
|
||||||
|
this.value =
|
||||||
|
"${opnSched.bankaraMatchSettings.last().vsRule.name} on ${opnMap1.name} & ${opnMap2.name}"
|
||||||
|
this.inline = false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field {
|
||||||
|
this.name = "X (${
|
||||||
|
TimeUtil.getTimeFromJSONTime(
|
||||||
|
xSched.startTime,
|
||||||
|
"UTC"
|
||||||
|
)
|
||||||
|
} - ${TimeUtil.getTimeFromJSONTime(xSched.endTime, "UTC")})"
|
||||||
|
this.value = "${xSched.xMatchSetting.vsRule.name} on ${xMap1.name} & ${xMap2.name}"
|
||||||
|
this.inline = false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field {
|
||||||
|
this.name = "Salmon Run (${
|
||||||
|
TimeUtil.getTimeFromJSONTimeLong(
|
||||||
|
salSched.startTime,
|
||||||
|
"UTC"
|
||||||
|
)
|
||||||
|
} - ${TimeUtil.getTimeFromJSONTimeLong(salSched.endTime, "UTC")})"
|
||||||
|
this.value =
|
||||||
|
"${salBoss} on ${salMap} with ${salWeapons[0].name}, ${salWeapons[1].name}, ${salWeapons[2].name} & ${salWeapons[3].name}"
|
||||||
|
this.inline = false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.timestamp = Clock.System.now()
|
||||||
|
this.footer {
|
||||||
|
this.text = "Data provided by splatoon3.ink"
|
||||||
|
this.icon = "https://fedi.splatoon3.ink/favicon.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SplatoonOnlineMode.REGULAR -> {
|
||||||
|
val regSched = Splatoon3ApiDataGrabber.getRegularMode(System.currentTimeMillis())
|
||||||
|
val regMaps = regSched.regularMatchSetting.vsStages
|
||||||
|
val regMap1 = regMaps[0]
|
||||||
|
val regMap2 = regMaps[1]
|
||||||
|
|
||||||
|
val regSched2 =
|
||||||
|
Splatoon3ApiDataGrabber.getRegularMode(System.currentTimeMillis() + 1000 * 60 * 60 * 2)
|
||||||
|
val regMaps2 = regSched2.regularMatchSetting.vsStages
|
||||||
|
val regMap12 = regMaps2[0]
|
||||||
|
val regMap22 = regMaps2[1]
|
||||||
|
|
||||||
|
this.respond {
|
||||||
|
this.embed {
|
||||||
|
this.author {
|
||||||
|
this.name = "Current rotation for"
|
||||||
|
}
|
||||||
|
this.title = "Regular Mode"
|
||||||
|
this.description = "[[Open on website](https://splatoon3.ink/)]"
|
||||||
|
this.color = Color(0x18c81b)
|
||||||
|
|
||||||
|
this.thumbnail {
|
||||||
|
this.url = "https://static.moonleay.net/img/lilJudd/regular.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field {
|
||||||
|
this.name = "Current (${
|
||||||
|
TimeUtil.getTimeFromJSONTime(
|
||||||
|
regSched.startTime,
|
||||||
|
"UTC"
|
||||||
|
)
|
||||||
|
} - ${TimeUtil.getTimeFromJSONTime(regSched.endTime, "UTC")})"
|
||||||
|
this.value =
|
||||||
|
"${regSched.regularMatchSetting.vsRule.name} on ${regMap1.name} & ${regMap2.name}"
|
||||||
|
this.inline = false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field {
|
||||||
|
this.name = "${
|
||||||
|
TimeUtil.getTimeFromJSONTime(
|
||||||
|
regSched2.startTime,
|
||||||
|
"UTC"
|
||||||
|
)
|
||||||
|
} - ${TimeUtil.getTimeFromJSONTime(regSched2.endTime, "UTC")}"
|
||||||
|
this.value =
|
||||||
|
"${regSched2.regularMatchSetting.vsRule.name} on ${regMap12.name} & ${regMap22.name}"
|
||||||
|
this.inline = false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.timestamp = Clock.System.now()
|
||||||
|
this.footer {
|
||||||
|
this.text = "Data provided by splatoon3.ink"
|
||||||
|
this.icon = "https://fedi.splatoon3.ink/favicon.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SplatoonOnlineMode.SERIES -> {
|
||||||
|
val serSched = Splatoon3ApiDataGrabber.getSeriesMode(System.currentTimeMillis())
|
||||||
|
val serMaps = serSched.bankaraMatchSettings!!.first().vsStages
|
||||||
|
val serMap1 = serMaps[0]
|
||||||
|
val serMap2 = serMaps[1]
|
||||||
|
|
||||||
|
val serSched2 =
|
||||||
|
Splatoon3ApiDataGrabber.getSeriesMode(System.currentTimeMillis() + 1000 * 60 * 60 * 2)
|
||||||
|
val serMaps2 = serSched2.bankaraMatchSettings!!.first().vsStages
|
||||||
|
val serMap12 = serMaps2[0]
|
||||||
|
val serMap22 = serMaps2[1]
|
||||||
|
|
||||||
|
this.respond {
|
||||||
|
this.embed {
|
||||||
|
this.author {
|
||||||
|
this.name = "Current rotation for"
|
||||||
|
}
|
||||||
|
this.title = "Ranked Series Mode"
|
||||||
|
this.description = "[[Open on website](https://splatoon3.ink/)]"
|
||||||
|
this.color = Color(0xE14412)
|
||||||
|
|
||||||
|
this.thumbnail {
|
||||||
|
this.url = "https://static.moonleay.net/img/lilJudd/bankara.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field {
|
||||||
|
this.name = "Current (${
|
||||||
|
TimeUtil.getTimeFromJSONTime(
|
||||||
|
serSched.startTime,
|
||||||
|
"UTC"
|
||||||
|
)
|
||||||
|
} - ${TimeUtil.getTimeFromJSONTime(serSched.endTime, "UTC")})"
|
||||||
|
this.value =
|
||||||
|
"${serSched.bankaraMatchSettings.first().vsRule.name} on ${serMap1.name} & ${serMap2.name}"
|
||||||
|
this.inline = false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field {
|
||||||
|
this.name = "${
|
||||||
|
TimeUtil.getTimeFromJSONTime(
|
||||||
|
serSched2.startTime,
|
||||||
|
"UTC"
|
||||||
|
)
|
||||||
|
} - ${TimeUtil.getTimeFromJSONTime(serSched2.endTime, "UTC")}"
|
||||||
|
this.value =
|
||||||
|
"${serSched2.bankaraMatchSettings.first().vsRule.name} on ${serMap12.name} & ${serMap22.name}"
|
||||||
|
this.inline = false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.timestamp = Clock.System.now()
|
||||||
|
this.footer {
|
||||||
|
this.text = "Data provided by splatoon3.ink"
|
||||||
|
this.icon = "https://fedi.splatoon3.ink/favicon.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SplatoonOnlineMode.OPEN -> {
|
||||||
|
val opnSched = Splatoon3ApiDataGrabber.getSeriesMode(System.currentTimeMillis())
|
||||||
|
val opnMaps = opnSched.bankaraMatchSettings!!.last().vsStages
|
||||||
|
val opnMap1 = opnMaps[0]
|
||||||
|
val opnMap2 = opnMaps[1]
|
||||||
|
|
||||||
|
val opnSched2 =
|
||||||
|
Splatoon3ApiDataGrabber.getSeriesMode(System.currentTimeMillis() + 1000 * 60 * 60 * 2)
|
||||||
|
val opnMaps2 = opnSched2.bankaraMatchSettings!!.last().vsStages
|
||||||
|
val opnMap12 = opnMaps2[0]
|
||||||
|
val opnMap22 = opnMaps2[1]
|
||||||
|
|
||||||
|
this.respond {
|
||||||
|
this.embed {
|
||||||
|
this.author {
|
||||||
|
this.name = "Current rotation for"
|
||||||
|
}
|
||||||
|
this.title = "Ranked Open Mode"
|
||||||
|
this.description = "[[Open on website](https://splatoon3.ink/)]"
|
||||||
|
this.color = Color(0xE14412)
|
||||||
|
|
||||||
|
this.thumbnail {
|
||||||
|
this.url = "https://static.moonleay.net/img/lilJudd/bankara.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field {
|
||||||
|
this.name = "Current (${
|
||||||
|
TimeUtil.getTimeFromJSONTime(
|
||||||
|
opnSched.startTime,
|
||||||
|
"UTC"
|
||||||
|
)
|
||||||
|
} - ${TimeUtil.getTimeFromJSONTime(opnSched.endTime, "UTC")})"
|
||||||
|
this.value =
|
||||||
|
"${opnSched.bankaraMatchSettings.last().vsRule.name} on ${opnMap1.name} & ${opnMap2.name}"
|
||||||
|
this.inline = false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field {
|
||||||
|
this.name = "${
|
||||||
|
TimeUtil.getTimeFromJSONTime(
|
||||||
|
opnSched2.startTime,
|
||||||
|
"UTC"
|
||||||
|
)
|
||||||
|
} - ${TimeUtil.getTimeFromJSONTime(opnSched2.endTime, "UTC")}"
|
||||||
|
this.value =
|
||||||
|
"${opnSched2.bankaraMatchSettings.last().vsRule.name} on ${opnMap12.name} & ${opnMap22.name}"
|
||||||
|
this.inline = false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.timestamp = Clock.System.now()
|
||||||
|
this.footer {
|
||||||
|
this.text = "Data provided by splatoon3.ink"
|
||||||
|
this.icon = "https://fedi.splatoon3.ink/favicon.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SplatoonOnlineMode.X -> {
|
||||||
|
val xSched = Splatoon3ApiDataGrabber.getXMode(System.currentTimeMillis())
|
||||||
|
val xMaps = xSched.xMatchSetting.vsStages
|
||||||
|
val xMap1 = xMaps[0]
|
||||||
|
val xMap2 = xMaps[1]
|
||||||
|
|
||||||
|
val xSched2 = Splatoon3ApiDataGrabber.getXMode(System.currentTimeMillis() + 1000 * 60 * 60 * 2)
|
||||||
|
val xMaps2 = xSched2.xMatchSetting.vsStages
|
||||||
|
val xMap12 = xMaps2[0]
|
||||||
|
val xMap22 = xMaps2[1]
|
||||||
|
|
||||||
|
this.respond {
|
||||||
|
this.embed {
|
||||||
|
this.author {
|
||||||
|
this.name = "Current rotation for"
|
||||||
|
}
|
||||||
|
this.title = "X Mode"
|
||||||
|
this.description = "[[Open on website](https://splatoon3.ink/)]"
|
||||||
|
this.color = Color(0x0ECB93)
|
||||||
|
|
||||||
|
this.thumbnail {
|
||||||
|
this.url = "https://static.moonleay.net/img/lilJudd/x.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field {
|
||||||
|
this.name = "Current (${
|
||||||
|
TimeUtil.getTimeFromJSONTime(
|
||||||
|
xSched.startTime,
|
||||||
|
"UTC"
|
||||||
|
)
|
||||||
|
} - ${TimeUtil.getTimeFromJSONTime(xSched.endTime, "UTC")})"
|
||||||
|
this.value = "${xSched.xMatchSetting.vsRule.name} on ${xMap1.name} & ${xMap2.name}"
|
||||||
|
this.inline = false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field {
|
||||||
|
this.name = "${
|
||||||
|
TimeUtil.getTimeFromJSONTime(
|
||||||
|
xSched2.startTime,
|
||||||
|
"UTC"
|
||||||
|
)
|
||||||
|
} - ${TimeUtil.getTimeFromJSONTime(xSched2.endTime, "UTC")}"
|
||||||
|
this.value =
|
||||||
|
"${xSched2.xMatchSetting.vsRule.name} on ${xMap12.name} & ${xMap22.name}"
|
||||||
|
this.inline = false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.timestamp = Clock.System.now()
|
||||||
|
this.footer {
|
||||||
|
this.text = "Data provided by splatoon3.ink"
|
||||||
|
this.icon = "https://fedi.splatoon3.ink/favicon.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
SplatoonOnlineMode.SALMON_RUN -> {
|
||||||
|
val salSched = Splatoon3ApiDataGrabber.getSalmonRun(System.currentTimeMillis())
|
||||||
|
val salMap = salSched.setting.coopStage.name
|
||||||
|
val salBoss = salSched.setting.boss.name
|
||||||
|
val salWeapons = salSched.setting.weapons
|
||||||
|
|
||||||
|
val salSched2 =
|
||||||
|
Splatoon3ApiDataGrabber.getSalmonRun(System.currentTimeMillis() + 1000 * 60 * 60 * 24 * 2)
|
||||||
|
val salMap2 = salSched2.setting.coopStage.name
|
||||||
|
val salBoss2 = salSched2.setting.boss.name
|
||||||
|
val salWeapons2 = salSched2.setting.weapons
|
||||||
|
|
||||||
|
this.respond {
|
||||||
|
this.embed {
|
||||||
|
this.author {
|
||||||
|
this.name = "Current rotation for"
|
||||||
|
}
|
||||||
|
this.title = "Salmon Run"
|
||||||
|
this.description = "[[Open on website](https://splatoon3.ink/salmonrun)]"
|
||||||
|
this.color = Color(0xEA4F03)
|
||||||
|
|
||||||
|
this.thumbnail {
|
||||||
|
this.url = "https://static.moonleay.net/img/lilJudd/grizz.png"
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field {
|
||||||
|
this.name = "Current (${
|
||||||
|
TimeUtil.getTimeFromJSONTimeLong(
|
||||||
|
salSched.startTime,
|
||||||
|
"UTC"
|
||||||
|
)
|
||||||
|
} - ${TimeUtil.getTimeFromJSONTimeLong(salSched.endTime, "UTC")})"
|
||||||
|
this.value =
|
||||||
|
"${salBoss} on ${salMap} with ${salWeapons[0].name}, ${salWeapons[1].name}, ${salWeapons[2].name} & ${salWeapons[3].name}"
|
||||||
|
this.inline = false
|
||||||
|
}
|
||||||
|
|
||||||
|
this.field {
|
||||||
|
this.name = "${
|
||||||
|
TimeUtil.getTimeFromJSONTimeLong(
|
||||||
|
salSched2.startTime,
|
||||||
|
"UTC"
|
||||||
|
)
|
||||||
|
} - ${TimeUtil.getTimeFromJSONTimeLong(salSched2.endTime, "UTC")}"
|
||||||
|
this.value =
|
||||||
|
"${salBoss2} on ${salMap2} with ${salWeapons2[0].name}, ${salWeapons2[1].name}, ${salWeapons2[2].name} & ${salWeapons2[3].name}"
|
||||||
|
this.inline = false
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
this.timestamp = Clock.System.now()
|
||||||
|
this.footer {
|
||||||
|
this.text = "Data provided by splatoon3.ink"
|
||||||
|
this.icon = "https://fedi.splatoon3.ink/favicon.png"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
inner class RotationArguments : Arguments() {
|
||||||
|
|
||||||
|
val mode by enumChoice<SplatoonOnlineMode> {
|
||||||
|
this.name = "mode"
|
||||||
|
this.description = "The mode you want to check the rotation for"
|
||||||
|
this.typeName = "en_US"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
|
@ -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
|
||||||
|
@ -16,19 +16,20 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.extensions
|
package net.moonleay.liljudd.extensions
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
import com.kotlindiscord.kord.extensions.types.respond
|
|
||||||
import com.kotlindiscord.kord.extensions.utils.hasPermission
|
import com.kotlindiscord.kord.extensions.utils.hasPermission
|
||||||
import dev.kord.common.entity.Permission
|
import dev.kord.common.entity.Permission
|
||||||
import dev.kord.core.behavior.channel.createMessage
|
import dev.kord.core.behavior.channel.createMessage
|
||||||
import dev.kord.rest.builder.message.create.actionRow
|
import dev.kord.rest.builder.message.actionRow
|
||||||
|
import dev.kord.rest.builder.message.embed
|
||||||
import kotlinx.coroutines.delay
|
import kotlinx.coroutines.delay
|
||||||
import net.moonleay.lilJudd.data.database.entry.TimePlanningMessagesData
|
import net.moonleay.liljudd.Bot
|
||||||
import net.moonleay.lilJudd.data.database.repository.TimePlanningMessagesRepository
|
import net.moonleay.liljudd.data.database.entry.TimePlanningMessagesData
|
||||||
import net.moonleay.lilJudd.util.*
|
import net.moonleay.liljudd.data.database.repository.TimePlanningMessagesRepository
|
||||||
|
import net.moonleay.liljudd.util.*
|
||||||
import java.time.ZoneId
|
import java.time.ZoneId
|
||||||
import java.time.ZonedDateTime
|
import java.time.ZonedDateTime
|
||||||
|
|
||||||
|
@ -40,7 +41,7 @@ class SendPlannerExtension : Extension() {
|
||||||
get() = false
|
get() = false
|
||||||
|
|
||||||
override suspend fun setup() {
|
override suspend fun setup() {
|
||||||
publicSlashCommand() {
|
publicSlashCommand {
|
||||||
name = "sendplanner"
|
name = "sendplanner"
|
||||||
description = "Send the planner for the current week"
|
description = "Send the planner for the current week"
|
||||||
this.action {
|
this.action {
|
||||||
|
@ -48,13 +49,31 @@ class SendPlannerExtension : Extension() {
|
||||||
.hasPermission(Permission.Administrator)
|
.hasPermission(Permission.Administrator)
|
||||||
) {
|
) {
|
||||||
val res = this.respond {
|
val res = this.respond {
|
||||||
this.content = "You need to be an administrator to use this command."
|
this.embed {
|
||||||
|
this.color = EmbedColor.ERROR.color
|
||||||
|
this.title = "401: Not Authorized"
|
||||||
|
this.description =
|
||||||
|
"You need the Administrator permission to use this command."
|
||||||
|
this.footer {
|
||||||
|
this.icon = user.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
|
this.text = MessageUtil.getFooter(user)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
res.delete()
|
res.delete()
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
val res = this.respond {
|
val res = this.respond {
|
||||||
this.content = "OK."
|
this.embed {
|
||||||
|
this.color = EmbedColor.INFO.color
|
||||||
|
this.title = "200: Success"
|
||||||
|
this.description = "Sending the planner.\n" +
|
||||||
|
"This may take a while, please be patient."
|
||||||
|
this.footer {
|
||||||
|
this.icon = user.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
|
this.text = MessageUtil.getFooter(user)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
res.delete() // Delete the response
|
res.delete() // Delete the response
|
||||||
val c = this.getChannel().asChannel()
|
val c = this.getChannel().asChannel()
|
||||||
|
@ -64,20 +83,19 @@ class SendPlannerExtension : Extension() {
|
||||||
.withHour(4)
|
.withHour(4)
|
||||||
.withMinute(0).withSecond(0)
|
.withMinute(0).withSecond(0)
|
||||||
c.createMessage {
|
c.createMessage {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = EmbedColor.INFO.color
|
||||||
EmbedColor.INFO,
|
this.title = "Time Planning Feature"
|
||||||
"Time Planning Feature",
|
this.description = "Do you have time on the following Days?"
|
||||||
"Do you have time on the following Days?",
|
this.footer {
|
||||||
"Automated Message"
|
this.icon = Bot.bot.kordRef.getSelf().avatar?.cdnUrl?.toUrl()
|
||||||
)
|
this.text = MessageUtil.getFooter()
|
||||||
)
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
delay(1000)
|
delay(1000)
|
||||||
repeat(7) {
|
repeat(7) {
|
||||||
val msg = c.createMessage {
|
val eb = MessageUtil.getEmbedWithTable(
|
||||||
this.embeds.add(
|
|
||||||
MessageUtil.getEmbedWithTable(
|
|
||||||
EmbedColor.INFO,
|
EmbedColor.INFO,
|
||||||
"",
|
"",
|
||||||
"${then.dayOfWeek.name}, ${then.dayOfMonth}.${then.monthValue}.${then.year} /${it + 1}. weekday",
|
"${then.dayOfWeek.name}, ${then.dayOfMonth}.${then.monthValue}.${then.year} /${it + 1}. weekday",
|
||||||
|
@ -87,7 +105,18 @@ class SendPlannerExtension : Extension() {
|
||||||
"Is not available" to listOf()
|
"Is not available" to listOf()
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
|
||||||
|
val msg = c.createMessage {
|
||||||
|
this.embed {
|
||||||
|
this.color = eb.color
|
||||||
|
this.title = eb.title
|
||||||
|
this.description = eb.description
|
||||||
|
this.fields = eb.fields
|
||||||
|
this.footer {
|
||||||
|
this.icon = Bot.bot.kordRef.getSelf().avatar?.cdnUrl?.toUrl()
|
||||||
|
this.text = MessageUtil.getFooter()
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
this.actionRow {
|
this.actionRow {
|
||||||
this.components.addAll(EmbedUtil.getTimePlannerButtons().components)
|
this.components.addAll(EmbedUtil.getTimePlannerButtons().components)
|
|
@ -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
|
||||||
|
@ -16,17 +16,17 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.extensions
|
package net.moonleay.liljudd.extensions
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.extensions.Extension
|
import com.kotlindiscord.kord.extensions.extensions.Extension
|
||||||
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
import com.kotlindiscord.kord.extensions.extensions.publicSlashCommand
|
||||||
import com.kotlindiscord.kord.extensions.types.respond
|
|
||||||
import com.kotlindiscord.kord.extensions.utils.hasPermission
|
import com.kotlindiscord.kord.extensions.utils.hasPermission
|
||||||
import dev.kord.common.entity.Permission
|
import dev.kord.common.entity.Permission
|
||||||
import net.moonleay.lilJudd.features.AvailabilityManager
|
import dev.kord.rest.builder.message.embed
|
||||||
import net.moonleay.lilJudd.util.EmbedColor
|
import net.moonleay.liljudd.features.AvailabilityManager
|
||||||
import net.moonleay.lilJudd.util.Logger
|
import net.moonleay.liljudd.util.EmbedColor
|
||||||
import net.moonleay.lilJudd.util.MessageUtil
|
import net.moonleay.liljudd.util.Logger
|
||||||
|
import net.moonleay.liljudd.util.MessageUtil
|
||||||
|
|
||||||
class UpdateRolesExtension : Extension() {
|
class UpdateRolesExtension : Extension() {
|
||||||
override val name = "updateroles"
|
override val name = "updateroles"
|
||||||
|
@ -34,7 +34,7 @@ class UpdateRolesExtension : Extension() {
|
||||||
get() = false
|
get() = false
|
||||||
|
|
||||||
override suspend fun setup() {
|
override suspend fun setup() {
|
||||||
publicSlashCommand() {
|
publicSlashCommand {
|
||||||
name = "updateroles"
|
name = "updateroles"
|
||||||
description = "Update the roles of the members in the current server"
|
description = "Update the roles of the members in the current server"
|
||||||
this.action {
|
this.action {
|
||||||
|
@ -42,30 +42,31 @@ class UpdateRolesExtension : Extension() {
|
||||||
.hasPermission(Permission.Administrator)
|
.hasPermission(Permission.Administrator)
|
||||||
) {
|
) {
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = EmbedColor.ERROR.color
|
||||||
EmbedColor.ERROR,
|
this.title = "401: Not Authorized"
|
||||||
"403: Forbidden",
|
this.description =
|
||||||
"You need to be an administrator to use this command.",
|
"You need the Administrator permission to use this command."
|
||||||
user.asUser().username + "#" + user.asUser().discriminator
|
this.footer {
|
||||||
)
|
this.icon = user.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
)
|
this.text = MessageUtil.getFooter(user)
|
||||||
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
return@action
|
return@action
|
||||||
}
|
}
|
||||||
this.respond {
|
this.respond {
|
||||||
this.embeds.add(
|
this.embed {
|
||||||
MessageUtil.getEmbed(
|
this.color = EmbedColor.INFO.color
|
||||||
EmbedColor.SUCCESS,
|
this.title = "200: Success"
|
||||||
"200: Success",
|
this.description = "Updating roles.\n" +
|
||||||
"Updating roles.\n" +
|
"This may take a while, please be patient."
|
||||||
"This may take a while, please be patient.",
|
this.footer {
|
||||||
user.asUser().username + "#" + user.asUser().discriminator
|
this.icon = user.asUser().avatar?.cdnUrl?.toUrl()
|
||||||
)
|
this.text = MessageUtil.getFooter(user)
|
||||||
)
|
}
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// -- below here is the code of the cronjob --
|
|
||||||
Logger.out("Starting to update roles...")
|
Logger.out("Starting to update roles...")
|
||||||
|
|
||||||
AvailabilityManager.updateInChannel(this.channel.id)
|
AvailabilityManager.updateInChannel(this.channel.id)
|
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.extensions.component
|
package net.moonleay.liljudd.extensions.component
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.commands.application.slash.converters.ChoiceEnum
|
import com.kotlindiscord.kord.extensions.commands.application.slash.converters.ChoiceEnum
|
||||||
|
|
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.extensions.component
|
package net.moonleay.liljudd.extensions.component
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.commands.application.slash.converters.ChoiceEnum
|
import com.kotlindiscord.kord.extensions.commands.application.slash.converters.ChoiceEnum
|
||||||
|
|
|
@ -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
|
||||||
|
@ -16,12 +16,15 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.data.api.type
|
package net.moonleay.liljudd.extensions.component
|
||||||
|
|
||||||
enum class ApiDataType {
|
import com.kotlindiscord.kord.extensions.commands.application.slash.converters.ChoiceEnum
|
||||||
SCHEDULES,
|
|
||||||
SPLATNETGEAR,
|
enum class SplatoonOnlineMode(override val readableName: String) : ChoiceEnum {
|
||||||
COOP,
|
ALL("All Modes"),
|
||||||
SPLATFESTS,
|
REGULAR("Regular Battle"),
|
||||||
ALL
|
SERIES("Ranked Battle (Series)"),
|
||||||
|
OPEN("Ranked Battle (Open)"),
|
||||||
|
X("X Battle"),
|
||||||
|
SALMON_RUN("Salmon Run"),
|
||||||
}
|
}
|
|
@ -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
|
||||||
|
@ -16,7 +16,7 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.features
|
package net.moonleay.liljudd.features
|
||||||
|
|
||||||
import com.kotlindiscord.kord.extensions.utils.isNullOrBot
|
import com.kotlindiscord.kord.extensions.utils.isNullOrBot
|
||||||
import dev.inmo.krontab.buildSchedule
|
import dev.inmo.krontab.buildSchedule
|
||||||
|
@ -29,22 +29,22 @@ import dev.kord.core.entity.channel.Channel
|
||||||
import dev.kord.core.entity.channel.MessageChannel
|
import dev.kord.core.entity.channel.MessageChannel
|
||||||
import dev.kord.gateway.PrivilegedIntent
|
import dev.kord.gateway.PrivilegedIntent
|
||||||
import dev.kord.rest.builder.message.EmbedBuilder
|
import dev.kord.rest.builder.message.EmbedBuilder
|
||||||
import net.moonleay.lilJudd.Bot
|
import net.moonleay.liljudd.Bot
|
||||||
import net.moonleay.lilJudd.data.database.entry.PlanningNotifierRolesData
|
import net.moonleay.liljudd.data.database.entry.PlanningNotifierRolesData
|
||||||
import net.moonleay.lilJudd.data.database.entry.TimePlanningMessagesData
|
import net.moonleay.liljudd.data.database.entry.TimePlanningMessagesData
|
||||||
import net.moonleay.lilJudd.data.database.repository.PlanningNotifierRolesRepository
|
import net.moonleay.liljudd.data.database.repository.PlanningNotifierRolesRepository
|
||||||
import net.moonleay.lilJudd.data.database.repository.TimePlanningMessagesRepository
|
import net.moonleay.liljudd.data.database.repository.TimePlanningMessagesRepository
|
||||||
import net.moonleay.lilJudd.extensions.FeatureManageExtension
|
import net.moonleay.liljudd.extensions.FeatureManageExtension
|
||||||
import net.moonleay.lilJudd.features.component.FeatureEnum
|
import net.moonleay.liljudd.features.component.FeatureEnum
|
||||||
import net.moonleay.lilJudd.features.component.IFeature
|
import net.moonleay.liljudd.features.component.IFeature
|
||||||
import net.moonleay.lilJudd.util.*
|
import net.moonleay.liljudd.util.*
|
||||||
import java.time.ZonedDateTime
|
import java.time.ZonedDateTime
|
||||||
|
|
||||||
object AvailabilityManager : IFeature {
|
object AvailabilityManager : IFeature {
|
||||||
|
|
||||||
// This runs during the cronjob.
|
// This runs during the cronjob.
|
||||||
suspend fun runThread() {
|
suspend fun runThread() {
|
||||||
Logger.out("Starting to update roles...")
|
Logger.out("Updating match roles")
|
||||||
|
|
||||||
// ChannelID, Data
|
// ChannelID, Data
|
||||||
val messages = TimePlanningMessagesRepository.getWeek(TimeUtil.getWeekStamp().toEpochSecond())
|
val messages = TimePlanningMessagesRepository.getWeek(TimeUtil.getWeekStamp().toEpochSecond())
|
||||||
|
@ -70,7 +70,7 @@ object AvailabilityManager : IFeature {
|
||||||
}
|
}
|
||||||
this.updateInChannel(snf, data, roleData)
|
this.updateInChannel(snf, data, roleData)
|
||||||
}
|
}
|
||||||
Logger.out("Done! Until tomorrow! <3 ")
|
Logger.out("Finished updating roles")
|
||||||
}
|
}
|
||||||
|
|
||||||
suspend fun updateInChannel(snf: Snowflake) {
|
suspend fun updateInChannel(snf: Snowflake) {
|
||||||
|
@ -162,7 +162,7 @@ object AvailabilityManager : IFeature {
|
||||||
|
|
||||||
// Register the cronjob to run at 1AM UTC every day
|
// Register the cronjob to run at 1AM UTC every day
|
||||||
override suspend fun registerThread() {
|
override suspend fun registerThread() {
|
||||||
Logger.out("Adding availability scheduler...")
|
Logger.out("Registering daily planning message role update coroutine")
|
||||||
val scheduler = buildSchedule("0 0 2 * * *") // 0 0 4 * * * 0o 1w // 0o is UTC
|
val scheduler = buildSchedule("0 0 2 * * *") // 0 0 4 * * * 0o 1w // 0o is UTC
|
||||||
scheduler.doInfinity {
|
scheduler.doInfinity {
|
||||||
this.runThread()
|
this.runThread()
|
||||||
|
@ -176,7 +176,7 @@ object AvailabilityManager : IFeature {
|
||||||
ch: Channel,
|
ch: Channel,
|
||||||
args: FeatureManageExtension.FeatureManagerArgs
|
args: FeatureManageExtension.FeatureManagerArgs
|
||||||
): EmbedBuilder {
|
): EmbedBuilder {
|
||||||
var alreadyExists = PlanningNotifierRolesRepository.existsInChannel(cID)
|
val alreadyExists = PlanningNotifierRolesRepository.existsInChannel(cID)
|
||||||
// Check if the channel and guild already exist in the db
|
// Check if the channel and guild already exist in the db
|
||||||
if (!alreadyExists) {
|
if (!alreadyExists) {
|
||||||
// Create the roles in Discord
|
// Create the roles in Discord
|
|
@ -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
|
||||||
|
@ -16,19 +16,19 @@
|
||||||
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
* along with this program. If not, see <https://www.gnu.org/licenses/>.
|
||||||
*/
|
*/
|
||||||
|
|
||||||
package net.moonleay.lilJudd.features
|
package net.moonleay.liljudd.features
|
||||||
|
|
||||||
import dev.kord.common.entity.Snowflake
|
import dev.kord.common.entity.Snowflake
|
||||||
import net.moonleay.lilJudd.Bot
|
import net.moonleay.liljudd.Bot
|
||||||
import net.moonleay.lilJudd.data.database.entry.MatchPlanningDataData
|
import net.moonleay.liljudd.data.database.entry.MatchPlanningDataData
|
||||||
import net.moonleay.lilJudd.data.database.repository.MatchPlanningDataRepository
|
import net.moonleay.liljudd.data.database.repository.MatchPlanningDataRepository
|
||||||
import net.moonleay.lilJudd.jobs.MatchJob
|
import net.moonleay.liljudd.jobs.MatchJob
|
||||||
import net.moonleay.lilJudd.jobs.component.JobManager
|
import net.moonleay.liljudd.jobs.component.JobManager
|
||||||
import net.moonleay.lilJudd.util.Logger
|
import net.moonleay.liljudd.util.Logger
|
||||||
|
|
||||||
object MatchManager {
|
object MatchManager {
|
||||||
suspend fun update() {
|
suspend fun update() {
|
||||||
Logger.out("Updating match roles...")
|
Logger.out("Updating matches")
|
||||||
val dataList = MatchPlanningDataRepository.getAll()
|
val dataList = MatchPlanningDataRepository.getAll()
|
||||||
|
|
||||||
for (data in dataList) {
|
for (data in dataList) {
|
||||||
|
@ -41,7 +41,7 @@ object MatchManager {
|
||||||
}
|
}
|
||||||
this.registerJob(data)
|
this.registerJob(data)
|
||||||
}
|
}
|
||||||
Logger.out("Done. Until next time! <3 ")
|
Logger.out("Finished updating matches")
|
||||||
}
|
}
|
||||||
|
|
||||||
private fun registerJob(data: MatchPlanningDataData) {
|
private fun registerJob(data: MatchPlanningDataData) {
|
Some files were not shown because too many files have changed in this diff Show more
Loading…
Reference in a new issue