diff --git a/.gitignore b/.gitignore
index 19f55917..0c726ef1 100644
--- a/.gitignore
+++ b/.gitignore
@@ -2,7 +2,6 @@
/target/
.idea
.settings
-*.xml
!pom.xml
src/main/java/org.jointheleague.Launcher.java
.classpath
@@ -10,3 +9,6 @@ src/main/java/org.jointheleague.Launcher.java
.travis.yml
run.sh
appspec.yml
+/.gradle/
+.gradle/
+build/
diff --git a/.gradle/7.3.3/checksums/checksums.lock b/.gradle/7.3.3/checksums/checksums.lock
new file mode 100644
index 00000000..c73c23d9
Binary files /dev/null and b/.gradle/7.3.3/checksums/checksums.lock differ
diff --git a/.gradle/7.3.3/dependencies-accessors/dependencies-accessors.lock b/.gradle/7.3.3/dependencies-accessors/dependencies-accessors.lock
new file mode 100644
index 00000000..b76cddf9
Binary files /dev/null and b/.gradle/7.3.3/dependencies-accessors/dependencies-accessors.lock differ
diff --git a/.gradle/7.3.3/dependencies-accessors/gc.properties b/.gradle/7.3.3/dependencies-accessors/gc.properties
new file mode 100644
index 00000000..e69de29b
diff --git a/.gradle/7.3.3/executionHistory/executionHistory.bin b/.gradle/7.3.3/executionHistory/executionHistory.bin
new file mode 100644
index 00000000..6332d1d7
Binary files /dev/null and b/.gradle/7.3.3/executionHistory/executionHistory.bin differ
diff --git a/.gradle/7.3.3/executionHistory/executionHistory.lock b/.gradle/7.3.3/executionHistory/executionHistory.lock
new file mode 100644
index 00000000..134fb8d2
Binary files /dev/null and b/.gradle/7.3.3/executionHistory/executionHistory.lock differ
diff --git a/.gradle/7.3.3/fileChanges/last-build.bin b/.gradle/7.3.3/fileChanges/last-build.bin
new file mode 100644
index 00000000..f76dd238
Binary files /dev/null and b/.gradle/7.3.3/fileChanges/last-build.bin differ
diff --git a/.gradle/7.3.3/fileHashes/fileHashes.bin b/.gradle/7.3.3/fileHashes/fileHashes.bin
new file mode 100644
index 00000000..11afbec0
Binary files /dev/null and b/.gradle/7.3.3/fileHashes/fileHashes.bin differ
diff --git a/.gradle/7.3.3/fileHashes/fileHashes.lock b/.gradle/7.3.3/fileHashes/fileHashes.lock
new file mode 100644
index 00000000..43ac14ab
Binary files /dev/null and b/.gradle/7.3.3/fileHashes/fileHashes.lock differ
diff --git a/.gradle/7.3.3/fileHashes/resourceHashesCache.bin b/.gradle/7.3.3/fileHashes/resourceHashesCache.bin
new file mode 100644
index 00000000..bec851c3
Binary files /dev/null and b/.gradle/7.3.3/fileHashes/resourceHashesCache.bin differ
diff --git a/.gradle/7.3.3/gc.properties b/.gradle/7.3.3/gc.properties
new file mode 100644
index 00000000..e69de29b
diff --git a/.gradle/buildOutputCleanup/buildOutputCleanup.lock b/.gradle/buildOutputCleanup/buildOutputCleanup.lock
new file mode 100644
index 00000000..f0287f99
Binary files /dev/null and b/.gradle/buildOutputCleanup/buildOutputCleanup.lock differ
diff --git a/.gradle/buildOutputCleanup/cache.properties b/.gradle/buildOutputCleanup/cache.properties
new file mode 100644
index 00000000..630cd747
--- /dev/null
+++ b/.gradle/buildOutputCleanup/cache.properties
@@ -0,0 +1,2 @@
+#Thu May 16 18:40:18 PDT 2024
+gradle.version=7.3.3
diff --git a/.gradle/buildOutputCleanup/outputFiles.bin b/.gradle/buildOutputCleanup/outputFiles.bin
new file mode 100644
index 00000000..87ca7f42
Binary files /dev/null and b/.gradle/buildOutputCleanup/outputFiles.bin differ
diff --git a/.gradle/file-system.probe b/.gradle/file-system.probe
new file mode 100644
index 00000000..eb72c0c1
Binary files /dev/null and b/.gradle/file-system.probe differ
diff --git a/.gradle/vcs-1/gc.properties b/.gradle/vcs-1/gc.properties
new file mode 100644
index 00000000..e69de29b
diff --git a/bin/.gitignore b/bin/.gitignore
new file mode 100644
index 00000000..7eed456b
--- /dev/null
+++ b/bin/.gitignore
@@ -0,0 +1,2 @@
+/main/
+/test/
diff --git a/build.gradle b/build.gradle
index bb3a859e..0e6ca45b 100644
--- a/build.gradle
+++ b/build.gradle
@@ -1,13 +1,11 @@
-
plugins {
id 'java'
id 'application'
+ id 'com.github.johnrengelman.shadow' version '7.1.2'
}
repositories {
- repositories {
- mavenCentral()
- }
+ mavenCentral()
}
dependencies {
@@ -15,26 +13,44 @@ dependencies {
implementation 'net.aksingh:owm-japis:2.5.3.0'
implementation 'com.googlecode.json-simple:json-simple:1.1.1'
implementation 'javax.json:javax.json-api:1.1'
- implementation 'org.mockito:mockito-core:3.4.0'
+ testImplementation 'org.mockito:mockito-core:5.0.0'
implementation 'org.springframework.boot:spring-boot-starter-webflux:2.4.1'
implementation 'com.fasterxml.jackson.core:jackson-databind:2.11.3'
testImplementation 'org.junit.jupiter:junit-jupiter:5.7.0'
testImplementation 'org.junit.jupiter:junit-jupiter-engine:5.4.2'
testImplementation 'org.junit.jupiter:junit-jupiter-api:5.4.2'
+
+ implementation 'org.apache.logging.log4j:log4j-api:2.24.1'
+ implementation 'org.apache.logging.log4j:log4j-core:2.24.1'
}
group = 'org.jointheleague'
version = '2.0'
description = 'discordbot'
-sourceCompatibility = '1.8'
-
+sourceCompatibility = '11'
test {
useJUnitPlatform()
}
+run {
+ //environment 'CHANNEL_NAME', 'general'
+}
+
tasks.withType(JavaCompile) {
options.encoding = 'UTF-8'
}
mainClassName = 'org.jointheleague.Launcher'
+
+shadowJar {
+ archiveBaseName.set("discordbot")
+ archiveVersion.set(version)
+ archiveClassifier.set("") // No classifier
+ mergeServiceFiles() // Merges service files, if necessary
+ manifest {
+ attributes(
+ 'Main-Class': mainClassName // Ensures the manifest has the right entry
+ )
+ }
+}
diff --git a/build/distributions/discordbot-2.0.tar b/build/distributions/discordbot-2.0.tar
new file mode 100644
index 00000000..8b96c65b
Binary files /dev/null and b/build/distributions/discordbot-2.0.tar differ
diff --git a/build/distributions/discordbot-2.0.zip b/build/distributions/discordbot-2.0.zip
new file mode 100644
index 00000000..a4e80169
Binary files /dev/null and b/build/distributions/discordbot-2.0.zip differ
diff --git a/build/libs/discordbot-2.0.jar b/build/libs/discordbot-2.0.jar
new file mode 100644
index 00000000..f00a8839
Binary files /dev/null and b/build/libs/discordbot-2.0.jar differ
diff --git a/build/reports/tests/test/classes/org.jointheleague.features.examples.first_features.CurrentTimeTest.html b/build/reports/tests/test/classes/org.jointheleague.features.examples.first_features.CurrentTimeTest.html
new file mode 100644
index 00000000..322d2304
--- /dev/null
+++ b/build/reports/tests/test/classes/org.jointheleague.features.examples.first_features.CurrentTimeTest.html
@@ -0,0 +1,116 @@
+
+
+
+
+
Package org.jointheleague.features.examples.first_features
+
+
all > org.jointheleague.features.examples.first_features
+
+
+
+
+
+
+
+|
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
Classes
+
+
+
+| Class |
+Tests |
+Failures |
+Ignored |
+Duration |
+Success rate |
+
+
+
+|
+CurrentTimeTest
+ |
+5 |
+0 |
+0 |
+1.710s |
+100% |
+
+
+|
+RandomNumberTest
+ |
+5 |
+0 |
+0 |
+0.044s |
+100% |
+
+
+
+
+
+
+
+
diff --git a/build/reports/tests/test/packages/org.jointheleague.features.examples.second_features.html b/build/reports/tests/test/packages/org.jointheleague.features.examples.second_features.html
new file mode 100644
index 00000000..36255c37
--- /dev/null
+++ b/build/reports/tests/test/packages/org.jointheleague.features.examples.second_features.html
@@ -0,0 +1,103 @@
+
+
+
+
+
Package org.jointheleague.features.examples.second_features
+
+
all > org.jointheleague.features.examples.second_features
+
+
+
+
+
+
+
+|
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
Classes
+
+
+
+| Class |
+Tests |
+Failures |
+Ignored |
+Duration |
+Success rate |
+
+
+
+|
+HighLowGameTest
+ |
+10 |
+0 |
+0 |
+0.050s |
+100% |
+
+
+
+
+
+
+
+
diff --git a/build/reports/tests/test/packages/org.jointheleague.features.examples.third_features.html b/build/reports/tests/test/packages/org.jointheleague.features.examples.third_features.html
new file mode 100644
index 00000000..204de23a
--- /dev/null
+++ b/build/reports/tests/test/packages/org.jointheleague.features.examples.third_features.html
@@ -0,0 +1,113 @@
+
+
+
+
+
Package org.jointheleague.features.examples.third_features
+
+
all > org.jointheleague.features.examples.third_features
+
+
+
+
+
+
+
+|
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
Classes
+
+
+
+| Class |
+Tests |
+Failures |
+Ignored |
+Duration |
+Success rate |
+
+
+
+|
+CatFactsApiTest
+ |
+5 |
+0 |
+0 |
+1.783s |
+100% |
+
+
+|
+NewsApiTest
+ |
+6 |
+0 |
+0 |
+0.034s |
+100% |
+
+
+
+
+
+
+
+
diff --git a/build/reports/tests/test/packages/org.jointheleague.features.student.first_feature.html b/build/reports/tests/test/packages/org.jointheleague.features.student.first_feature.html
new file mode 100644
index 00000000..d8e57085
--- /dev/null
+++ b/build/reports/tests/test/packages/org.jointheleague.features.student.first_feature.html
@@ -0,0 +1,103 @@
+
+
+
+
+
Package org.jointheleague.features.student.first_feature
+
+
all > org.jointheleague.features.student.first_feature
+
+
+
+
+
+
+
+|
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
Classes
+
+
+
+| Class |
+Tests |
+Failures |
+Ignored |
+Duration |
+Success rate |
+
+
+
+|
+FeatureOneTest
+ |
+5 |
+0 |
+0 |
+0.014s |
+100% |
+
+
+
+
+
+
+
+
diff --git a/build/reports/tests/test/packages/org.jointheleague.features.templates.html b/build/reports/tests/test/packages/org.jointheleague.features.templates.html
new file mode 100644
index 00000000..59e2e3ab
--- /dev/null
+++ b/build/reports/tests/test/packages/org.jointheleague.features.templates.html
@@ -0,0 +1,103 @@
+
+
+
+
+
Package org.jointheleague.features.templates
+
+
all > org.jointheleague.features.templates
+
+
+
+
+
+
+
+|
+
+ |
+
+
+ |
+
+
+ |
+
+
+ |
+
+
+
+ |
+
+
+ |
+
+
+
+
+
+
+
Classes
+
+
+
+| Class |
+Tests |
+Failures |
+Ignored |
+Duration |
+Success rate |
+
+
+
+|
+FeatureTemplateTest
+ |
+5 |
+0 |
+0 |
+0.015s |
+100% |
+
+
+
+
+
+
+
+
diff --git a/build/scripts/discordbot b/build/scripts/discordbot
new file mode 100755
index 00000000..040ea605
--- /dev/null
+++ b/build/scripts/discordbot
@@ -0,0 +1,233 @@
+#!/bin/sh
+
+#
+# Copyright © 2015-2021 the original authors.
+#
+# Licensed under the Apache License, Version 2.0 (the "License");
+# you may not use this file except in compliance with the License.
+# You may obtain a copy of the License at
+#
+# https://www.apache.org/licenses/LICENSE-2.0
+#
+# Unless required by applicable law or agreed to in writing, software
+# distributed under the License is distributed on an "AS IS" BASIS,
+# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+# See the License for the specific language governing permissions and
+# limitations under the License.
+#
+
+##############################################################################
+#
+# discordbot start up script for POSIX generated by Gradle.
+#
+# Important for running:
+#
+# (1) You need a POSIX-compliant shell to run this script. If your /bin/sh is
+# noncompliant, but you have some other compliant shell such as ksh or
+# bash, then to run this script, type that shell name before the whole
+# command line, like:
+#
+# ksh discordbot
+#
+# Busybox and similar reduced shells will NOT work, because this script
+# requires all of these POSIX shell features:
+# * functions;
+# * expansions «$var», «${var}», «${var:-default}», «${var+SET}»,
+# «${var#prefix}», «${var%suffix}», and «$( cmd )»;
+# * compound commands having a testable exit status, especially «case»;
+# * various built-in commands including «command», «set», and «ulimit».
+#
+# Important for patching:
+#
+# (2) This script targets any POSIX shell, so it avoids extensions provided
+# by Bash, Ksh, etc; in particular arrays are avoided.
+#
+# The "traditional" practice of packing multiple parameters into a
+# space-separated string is a well documented source of bugs and security
+# problems, so this is (mostly) avoided, by progressively accumulating
+# options in "$@", and eventually passing that to Java.
+#
+# Where the inherited environment variables (DEFAULT_JVM_OPTS, JAVA_OPTS,
+# and DISCORDBOT_OPTS) rely on word-splitting, this is performed explicitly;
+# see the in-line comments for details.
+#
+# There are tweaks for specific operating systems such as AIX, CygWin,
+# Darwin, MinGW, and NonStop.
+#
+# (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
+# within the Gradle project.
+#
+# You can find Gradle at https://github.com/gradle/gradle/.
+#
+##############################################################################
+
+# Attempt to set APP_HOME
+
+# Resolve links: $0 may be a link
+app_path=$0
+
+# Need this for daisy-chained symlinks.
+while
+ APP_HOME=${app_path%"${app_path##*/}"} # leaves a trailing /; empty if no leading path
+ [ -h "$app_path" ]
+do
+ ls=$( ls -ld "$app_path" )
+ link=${ls#*' -> '}
+ case $link in #(
+ /*) app_path=$link ;; #(
+ *) app_path=$APP_HOME$link ;;
+ esac
+done
+
+APP_HOME=$( cd "${APP_HOME:-./}.." && pwd -P ) || exit
+
+APP_NAME="discordbot"
+APP_BASE_NAME=${0##*/}
+
+# Add default JVM options here. You can also use JAVA_OPTS and DISCORDBOT_OPTS to pass JVM options to this script.
+DEFAULT_JVM_OPTS=""
+
+# Use the maximum available, or set MAX_FD != -1 to use that value.
+MAX_FD=maximum
+
+warn () {
+ echo "$*"
+} >&2
+
+die () {
+ echo
+ echo "$*"
+ echo
+ exit 1
+} >&2
+
+# OS specific support (must be 'true' or 'false').
+cygwin=false
+msys=false
+darwin=false
+nonstop=false
+case "$( uname )" in #(
+ CYGWIN* ) cygwin=true ;; #(
+ Darwin* ) darwin=true ;; #(
+ MSYS* | MINGW* ) msys=true ;; #(
+ NONSTOP* ) nonstop=true ;;
+esac
+
+CLASSPATH=$APP_HOME/lib/discordbot-2.0.jar:$APP_HOME/lib/owm-japis-2.5.3.0.jar:$APP_HOME/lib/json-simple-1.1.1.jar:$APP_HOME/lib/javax.json-api-1.1.jar:$APP_HOME/lib/mockito-core-3.4.0.jar:$APP_HOME/lib/spring-boot-starter-webflux-2.4.1.jar:$APP_HOME/lib/javacord-core-3.8.0.jar:$APP_HOME/lib/spring-boot-starter-json-2.4.1.jar:$APP_HOME/lib/jackson-datatype-jsr310-2.12.7.jar:$APP_HOME/lib/jackson-annotations-2.12.7.jar:$APP_HOME/lib/jackson-datatype-jdk8-2.12.7.jar:$APP_HOME/lib/jackson-module-parameter-names-2.12.7.jar:$APP_HOME/lib/jackson-core-2.12.7.jar:$APP_HOME/lib/jackson-databind-2.12.7.1.jar:$APP_HOME/lib/javacord-api-3.8.0.jar:$APP_HOME/lib/converter-gson-2.5.0.jar:$APP_HOME/lib/gson-2.8.5.jar:$APP_HOME/lib/retrofit-2.5.0.jar:$APP_HOME/lib/logging-interceptor-4.9.3.jar:$APP_HOME/lib/okhttp-4.9.3.jar:$APP_HOME/lib/okio-jvm-2.8.0.jar:$APP_HOME/lib/kotlin-stdlib-jdk8-1.4.10.jar:$APP_HOME/lib/kotlin-stdlib-jdk7-1.4.10.jar:$APP_HOME/lib/kotlin-stdlib-1.4.10.jar:$APP_HOME/lib/junit-4.13.1.jar:$APP_HOME/lib/byte-buddy-1.10.10.jar:$APP_HOME/lib/byte-buddy-agent-1.10.10.jar:$APP_HOME/lib/objenesis-2.6.jar:$APP_HOME/lib/spring-boot-starter-2.4.1.jar:$APP_HOME/lib/spring-boot-starter-reactor-netty-2.4.1.jar:$APP_HOME/lib/spring-webflux-5.3.2.jar:$APP_HOME/lib/spring-web-5.3.2.jar:$APP_HOME/lib/nv-websocket-client-2.14.jar:$APP_HOME/lib/xsalsa20poly1305-0.11.0.jar:$APP_HOME/lib/spring-boot-starter-logging-2.4.1.jar:$APP_HOME/lib/log4j-to-slf4j-2.13.3.jar:$APP_HOME/lib/log4j-api-2.17.2.jar:$APP_HOME/lib/vavr-0.10.4.jar:$APP_HOME/lib/kotlin-stdlib-common-1.4.10.jar:$APP_HOME/lib/annotations-13.0.jar:$APP_HOME/lib/hamcrest-core-1.3.jar:$APP_HOME/lib/spring-boot-autoconfigure-2.4.1.jar:$APP_HOME/lib/spring-boot-2.4.1.jar:$APP_HOME/lib/jakarta.annotation-api-1.3.5.jar:$APP_HOME/lib/spring-context-5.3.2.jar:$APP_HOME/lib/spring-aop-5.3.2.jar:$APP_HOME/lib/spring-beans-5.3.2.jar:$APP_HOME/lib/spring-expression-5.3.2.jar:$APP_HOME/lib/spring-core-5.3.2.jar:$APP_HOME/lib/snakeyaml-1.27.jar:$APP_HOME/lib/reactor-netty-http-1.0.2.jar:$APP_HOME/lib/reactor-netty-core-1.0.2.jar:$APP_HOME/lib/reactor-core-3.4.1.jar:$APP_HOME/lib/bcprov-jdk15on-1.60.jar:$APP_HOME/lib/vavr-match-0.10.4.jar:$APP_HOME/lib/logback-classic-1.2.3.jar:$APP_HOME/lib/jul-to-slf4j-1.7.30.jar:$APP_HOME/lib/spring-jcl-5.3.2.jar:$APP_HOME/lib/netty-codec-http2-4.1.54.Final.jar:$APP_HOME/lib/netty-handler-proxy-4.1.54.Final.jar:$APP_HOME/lib/netty-codec-http-4.1.54.Final.jar:$APP_HOME/lib/netty-resolver-dns-4.1.54.Final.jar:$APP_HOME/lib/netty-transport-native-epoll-4.1.54.Final-linux-x86_64.jar:$APP_HOME/lib/reactive-streams-1.0.3.jar:$APP_HOME/lib/logback-core-1.2.3.jar:$APP_HOME/lib/slf4j-api-1.7.30.jar:$APP_HOME/lib/netty-handler-4.1.54.Final.jar:$APP_HOME/lib/netty-codec-dns-4.1.54.Final.jar:$APP_HOME/lib/netty-codec-socks-4.1.54.Final.jar:$APP_HOME/lib/netty-codec-4.1.54.Final.jar:$APP_HOME/lib/netty-transport-native-unix-common-4.1.54.Final.jar:$APP_HOME/lib/netty-transport-4.1.54.Final.jar:$APP_HOME/lib/netty-buffer-4.1.54.Final.jar:$APP_HOME/lib/netty-resolver-4.1.54.Final.jar:$APP_HOME/lib/netty-common-4.1.54.Final.jar
+
+
+# Determine the Java command to use to start the JVM.
+if [ -n "$JAVA_HOME" ] ; then
+ if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
+ # IBM's JDK on AIX uses strange locations for the executables
+ JAVACMD=$JAVA_HOME/jre/sh/java
+ else
+ JAVACMD=$JAVA_HOME/bin/java
+ fi
+ if [ ! -x "$JAVACMD" ] ; then
+ die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+ fi
+else
+ 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.
+
+Please set the JAVA_HOME variable in your environment to match the
+location of your Java installation."
+fi
+
+# Increase the maximum file descriptors if we can.
+if ! "$cygwin" && ! "$darwin" && ! "$nonstop" ; then
+ case $MAX_FD in #(
+ max*)
+ MAX_FD=$( ulimit -H -n ) ||
+ warn "Could not query maximum file descriptor limit"
+ esac
+ case $MAX_FD in #(
+ '' | soft) :;; #(
+ *)
+ ulimit -n "$MAX_FD" ||
+ warn "Could not set maximum file descriptor limit to $MAX_FD"
+ esac
+fi
+
+# Collect all arguments for the java command, stacking in reverse order:
+# * args from the command line
+# * the main class name
+# * -classpath
+# * -D...appname settings
+# * --module-path (only if needed)
+# * DEFAULT_JVM_OPTS, JAVA_OPTS, and DISCORDBOT_OPTS environment variables.
+
+# For Cygwin or MSYS, switch paths to Windows format before running java
+if "$cygwin" || "$msys" ; then
+ APP_HOME=$( cygpath --path --mixed "$APP_HOME" )
+ CLASSPATH=$( cygpath --path --mixed "$CLASSPATH" )
+
+ JAVACMD=$( cygpath --unix "$JAVACMD" )
+
+ # Now convert the arguments - kludge to limit ourselves to /bin/sh
+ for arg do
+ if
+ case $arg in #(
+ -*) false ;; # don't mess with options #(
+ /?*) t=${arg#/} t=/${t%%/*} # looks like a POSIX filepath
+ [ -e "$t" ] ;; #(
+ *) false ;;
+ esac
+ then
+ arg=$( cygpath --path --ignore --mixed "$arg" )
+ fi
+ # Roll the args list around exactly as many times as the number of
+ # args, so each arg winds up back in the position where it started, but
+ # possibly modified.
+ #
+ # NB: a `for` loop captures its iteration list before it begins, so
+ # changing the positional parameters here affects neither the number of
+ # iterations, nor the values presented in `arg`.
+ shift # remove old arg
+ set -- "$@" "$arg" # push replacement arg
+ done
+fi
+
+# Collect all arguments for the java command;
+# * $DEFAULT_JVM_OPTS, $JAVA_OPTS, and $DISCORDBOT_OPTS can contain fragments of
+# shell script including quotes and variable substitutions, so put them in
+# double quotes to make sure that they get re-expanded; and
+# * put everything else in single quotes, so that it's not re-expanded.
+
+set -- \
+ -classpath "$CLASSPATH" \
+ org.jointheleague.Launcher \
+ "$@"
+
+# Use "xargs" to parse quoted args.
+#
+# With -n1 it outputs one arg per line, with the quotes and backslashes removed.
+#
+# In Bash we could simply go:
+#
+# readarray ARGS < <( xargs -n1 <<<"$var" ) &&
+# set -- "${ARGS[@]}" "$@"
+#
+# but POSIX shell has neither arrays nor command substitution, so instead we
+# post-process each arg (as a line of input to sed) to backslash-escape any
+# character that might be a shell metacharacter, then use eval to reverse
+# that process (while maintaining the separation between arguments), and wrap
+# the whole thing up as a single "set" statement.
+#
+# This will of course break if any of these variables contains a newline or
+# an unmatched quote.
+#
+
+eval "set -- $(
+ printf '%s\n' "$DEFAULT_JVM_OPTS $JAVA_OPTS $DISCORDBOT_OPTS" |
+ xargs -n1 |
+ sed ' s~[^-[:alnum:]+,./:=@_]~\\&~g; ' |
+ tr '\n' ' '
+ )" '"$@"'
+
+exec "$JAVACMD" "$@"
diff --git a/build/scripts/discordbot.bat b/build/scripts/discordbot.bat
new file mode 100644
index 00000000..4544c9cf
--- /dev/null
+++ b/build/scripts/discordbot.bat
@@ -0,0 +1,89 @@
+@rem
+@rem Copyright 2015 the original author or authors.
+@rem
+@rem Licensed under the Apache License, Version 2.0 (the "License");
+@rem you may not use this file except in compliance with the License.
+@rem You may obtain a copy of the License at
+@rem
+@rem https://www.apache.org/licenses/LICENSE-2.0
+@rem
+@rem Unless required by applicable law or agreed to in writing, software
+@rem distributed under the License is distributed on an "AS IS" BASIS,
+@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+@rem See the License for the specific language governing permissions and
+@rem limitations under the License.
+@rem
+
+@if "%DEBUG%" == "" @echo off
+@rem ##########################################################################
+@rem
+@rem discordbot startup script for Windows
+@rem
+@rem ##########################################################################
+
+@rem Set local scope for the variables with windows NT shell
+if "%OS%"=="Windows_NT" setlocal
+
+set DIRNAME=%~dp0
+if "%DIRNAME%" == "" set DIRNAME=.
+set APP_BASE_NAME=%~n0
+set APP_HOME=%DIRNAME%..
+
+@rem Resolve any "." and ".." in APP_HOME to make it shorter.
+for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
+
+@rem Add default JVM options here. You can also use JAVA_OPTS and DISCORDBOT_OPTS to pass JVM options to this script.
+set DEFAULT_JVM_OPTS=
+
+@rem Find java.exe
+if defined JAVA_HOME goto findJavaFromJavaHome
+
+set JAVA_EXE=java.exe
+%JAVA_EXE% -version >NUL 2>&1
+if "%ERRORLEVEL%" == "0" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:findJavaFromJavaHome
+set JAVA_HOME=%JAVA_HOME:"=%
+set JAVA_EXE=%JAVA_HOME%/bin/java.exe
+
+if exist "%JAVA_EXE%" goto execute
+
+echo.
+echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
+echo.
+echo Please set the JAVA_HOME variable in your environment to match the
+echo location of your Java installation.
+
+goto fail
+
+:execute
+@rem Setup the command line
+
+set CLASSPATH=%APP_HOME%\lib\discordbot-2.0.jar;%APP_HOME%\lib\owm-japis-2.5.3.0.jar;%APP_HOME%\lib\json-simple-1.1.1.jar;%APP_HOME%\lib\javax.json-api-1.1.jar;%APP_HOME%\lib\mockito-core-3.4.0.jar;%APP_HOME%\lib\spring-boot-starter-webflux-2.4.1.jar;%APP_HOME%\lib\javacord-core-3.8.0.jar;%APP_HOME%\lib\spring-boot-starter-json-2.4.1.jar;%APP_HOME%\lib\jackson-datatype-jsr310-2.12.7.jar;%APP_HOME%\lib\jackson-annotations-2.12.7.jar;%APP_HOME%\lib\jackson-datatype-jdk8-2.12.7.jar;%APP_HOME%\lib\jackson-module-parameter-names-2.12.7.jar;%APP_HOME%\lib\jackson-core-2.12.7.jar;%APP_HOME%\lib\jackson-databind-2.12.7.1.jar;%APP_HOME%\lib\javacord-api-3.8.0.jar;%APP_HOME%\lib\converter-gson-2.5.0.jar;%APP_HOME%\lib\gson-2.8.5.jar;%APP_HOME%\lib\retrofit-2.5.0.jar;%APP_HOME%\lib\logging-interceptor-4.9.3.jar;%APP_HOME%\lib\okhttp-4.9.3.jar;%APP_HOME%\lib\okio-jvm-2.8.0.jar;%APP_HOME%\lib\kotlin-stdlib-jdk8-1.4.10.jar;%APP_HOME%\lib\kotlin-stdlib-jdk7-1.4.10.jar;%APP_HOME%\lib\kotlin-stdlib-1.4.10.jar;%APP_HOME%\lib\junit-4.13.1.jar;%APP_HOME%\lib\byte-buddy-1.10.10.jar;%APP_HOME%\lib\byte-buddy-agent-1.10.10.jar;%APP_HOME%\lib\objenesis-2.6.jar;%APP_HOME%\lib\spring-boot-starter-2.4.1.jar;%APP_HOME%\lib\spring-boot-starter-reactor-netty-2.4.1.jar;%APP_HOME%\lib\spring-webflux-5.3.2.jar;%APP_HOME%\lib\spring-web-5.3.2.jar;%APP_HOME%\lib\nv-websocket-client-2.14.jar;%APP_HOME%\lib\xsalsa20poly1305-0.11.0.jar;%APP_HOME%\lib\spring-boot-starter-logging-2.4.1.jar;%APP_HOME%\lib\log4j-to-slf4j-2.13.3.jar;%APP_HOME%\lib\log4j-api-2.17.2.jar;%APP_HOME%\lib\vavr-0.10.4.jar;%APP_HOME%\lib\kotlin-stdlib-common-1.4.10.jar;%APP_HOME%\lib\annotations-13.0.jar;%APP_HOME%\lib\hamcrest-core-1.3.jar;%APP_HOME%\lib\spring-boot-autoconfigure-2.4.1.jar;%APP_HOME%\lib\spring-boot-2.4.1.jar;%APP_HOME%\lib\jakarta.annotation-api-1.3.5.jar;%APP_HOME%\lib\spring-context-5.3.2.jar;%APP_HOME%\lib\spring-aop-5.3.2.jar;%APP_HOME%\lib\spring-beans-5.3.2.jar;%APP_HOME%\lib\spring-expression-5.3.2.jar;%APP_HOME%\lib\spring-core-5.3.2.jar;%APP_HOME%\lib\snakeyaml-1.27.jar;%APP_HOME%\lib\reactor-netty-http-1.0.2.jar;%APP_HOME%\lib\reactor-netty-core-1.0.2.jar;%APP_HOME%\lib\reactor-core-3.4.1.jar;%APP_HOME%\lib\bcprov-jdk15on-1.60.jar;%APP_HOME%\lib\vavr-match-0.10.4.jar;%APP_HOME%\lib\logback-classic-1.2.3.jar;%APP_HOME%\lib\jul-to-slf4j-1.7.30.jar;%APP_HOME%\lib\spring-jcl-5.3.2.jar;%APP_HOME%\lib\netty-codec-http2-4.1.54.Final.jar;%APP_HOME%\lib\netty-handler-proxy-4.1.54.Final.jar;%APP_HOME%\lib\netty-codec-http-4.1.54.Final.jar;%APP_HOME%\lib\netty-resolver-dns-4.1.54.Final.jar;%APP_HOME%\lib\netty-transport-native-epoll-4.1.54.Final-linux-x86_64.jar;%APP_HOME%\lib\reactive-streams-1.0.3.jar;%APP_HOME%\lib\logback-core-1.2.3.jar;%APP_HOME%\lib\slf4j-api-1.7.30.jar;%APP_HOME%\lib\netty-handler-4.1.54.Final.jar;%APP_HOME%\lib\netty-codec-dns-4.1.54.Final.jar;%APP_HOME%\lib\netty-codec-socks-4.1.54.Final.jar;%APP_HOME%\lib\netty-codec-4.1.54.Final.jar;%APP_HOME%\lib\netty-transport-native-unix-common-4.1.54.Final.jar;%APP_HOME%\lib\netty-transport-4.1.54.Final.jar;%APP_HOME%\lib\netty-buffer-4.1.54.Final.jar;%APP_HOME%\lib\netty-resolver-4.1.54.Final.jar;%APP_HOME%\lib\netty-common-4.1.54.Final.jar
+
+
+@rem Execute discordbot
+"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %DISCORDBOT_OPTS% -classpath "%CLASSPATH%" org.jointheleague.Launcher %*
+
+:end
+@rem End local scope for the variables with windows NT shell
+if "%ERRORLEVEL%"=="0" goto mainEnd
+
+:fail
+rem Set variable DISCORDBOT_EXIT_CONSOLE if you need the _script_ return code instead of
+rem the _cmd.exe /c_ return code!
+if not "" == "%DISCORDBOT_EXIT_CONSOLE%" exit 1
+exit /b 1
+
+:mainEnd
+if "%OS%"=="Windows_NT" endlocal
+
+:omega
diff --git a/build/test-results/test/binary/output.bin b/build/test-results/test/binary/output.bin
new file mode 100644
index 00000000..e69de29b
diff --git a/build/test-results/test/binary/output.bin.idx b/build/test-results/test/binary/output.bin.idx
new file mode 100644
index 00000000..f76dd238
Binary files /dev/null and b/build/test-results/test/binary/output.bin.idx differ
diff --git a/build/test-results/test/binary/results.bin b/build/test-results/test/binary/results.bin
new file mode 100644
index 00000000..7aae94f7
Binary files /dev/null and b/build/test-results/test/binary/results.bin differ
diff --git a/build/tmp/compileJava/previous-compilation-data.bin b/build/tmp/compileJava/previous-compilation-data.bin
new file mode 100644
index 00000000..ed714d82
Binary files /dev/null and b/build/tmp/compileJava/previous-compilation-data.bin differ
diff --git a/build/tmp/compileTestJava/previous-compilation-data.bin b/build/tmp/compileTestJava/previous-compilation-data.bin
new file mode 100644
index 00000000..5066b99f
Binary files /dev/null and b/build/tmp/compileTestJava/previous-compilation-data.bin differ
diff --git a/build/tmp/jar/MANIFEST.MF b/build/tmp/jar/MANIFEST.MF
new file mode 100644
index 00000000..58630c02
--- /dev/null
+++ b/build/tmp/jar/MANIFEST.MF
@@ -0,0 +1,2 @@
+Manifest-Version: 1.0
+
diff --git a/src/main/java/org/jointheleague/Launcher.java b/src/main/java/org/jointheleague/Launcher.java
index 629e352c..c0788e57 100644
--- a/src/main/java/org/jointheleague/Launcher.java
+++ b/src/main/java/org/jointheleague/Launcher.java
@@ -6,8 +6,10 @@ public class Launcher {
public static void main(String[] args) {
//Initialize variables
- String channelName = System.getenv("CHANNEL_NAME");
- String discordToken = System.getenv("DISCORD_TOKEN");
+ //String channelName = System.getenv("CHANNEL_NAME");
+ String channelName = "general";
+ // String discordToken = System.getenv("DISCORD_TOKEN");
+ String discordToken = "not sigma";
boolean printDiscordInvite = true;
//Instantiate DiscordBot and connect
diff --git a/src/main/java/org/jointheleague/discord_bot/DiscordBot.java b/src/main/java/org/jointheleague/discord_bot/DiscordBot.java
index ae863505..de059ea6 100644
--- a/src/main/java/org/jointheleague/discord_bot/DiscordBot.java
+++ b/src/main/java/org/jointheleague/discord_bot/DiscordBot.java
@@ -11,6 +11,8 @@
import org.jointheleague.features.examples.first_features.RandomNumber;
import org.jointheleague.features.help_embed.HelpListener;
import org.jointheleague.features.student.first_feature.FeatureOne;
+import org.jointheleague.features.whale.ApiGetter;
+import org.jointheleague.features.whale.Schedule;
public class DiscordBot {
@@ -30,7 +32,9 @@ public DiscordBot(String token, String channelName) {
public void connect(boolean printInvite) {
- api = new DiscordApiBuilder().setToken(token).addIntents(Intent.MESSAGE_CONTENT).login().join();
+ api = new DiscordApiBuilder().setToken(token).setAllIntents().login().join();
+ //api = new DiscordApiBuilder().setToken(token).addAllIntents(Intent.MESSAGE_CONTENT).login().join();
+
//Print the URL to invite the bot
if (printInvite) {
@@ -39,21 +43,25 @@ public void connect(boolean printInvite) {
}
//Send bot connected message in channel
- api.getServerTextChannelsByName(channelName).forEach(e -> e.sendMessage(api.getYourself().getName() + " has connected"));
+ api.getServerTextChannelsByName(channelName).forEach(e -> e.sendMessage(api.getYourself().getName() + " has connected, \nDo !help for all commands"));
+
//add help listener to bot
api.addMessageCreateListener(helpListener);
//add features
- addFeature(new FeatureOne(channelName));
- addFeature(new CurrentTime(channelName));
- addFeature(new HighLowGame(channelName));
- addFeature(new NewsApi(channelName));
- addFeature(new CatFactsApi(channelName));
+// addFeature(new FeatureOne(channelName));
+// addFeature(new CurrentTime(channelName));
+// addFeature(new HighLowGame(channelName));
+// addFeature(new NewsApi(channelName));
+// addFeature(new CatFactsApi(channelName));
+// addFeature(new RandomNumber(channelName));
+ addFeature(new Schedule(channelName, new ApiGetter(api)));
}
private void addFeature(Feature feature){
api.addMessageCreateListener(feature);
helpListener.addHelpEmbed(feature.getHelpEmbed());
+
}
}
diff --git a/src/main/java/org/jointheleague/features/help_embed/plain_old_java_objects/help_embed/HelpEmbed.java b/src/main/java/org/jointheleague/features/help_embed/plain_old_java_objects/help_embed/HelpEmbed.java
index 50e902ac..5ed2d0fd 100644
--- a/src/main/java/org/jointheleague/features/help_embed/plain_old_java_objects/help_embed/HelpEmbed.java
+++ b/src/main/java/org/jointheleague/features/help_embed/plain_old_java_objects/help_embed/HelpEmbed.java
@@ -5,7 +5,7 @@
public class HelpEmbed {
- private final Color color = Color.green;
+ private final Color color = Color.getHSBColor((float) 0.48878205, (float)1.0, (float)0.40784314);
private final String command;
diff --git a/src/main/java/org/jointheleague/features/whale/ApiGetter.java b/src/main/java/org/jointheleague/features/whale/ApiGetter.java
new file mode 100644
index 00000000..d3b4724a
--- /dev/null
+++ b/src/main/java/org/jointheleague/features/whale/ApiGetter.java
@@ -0,0 +1,14 @@
+package org.jointheleague.features.whale;
+
+import org.javacord.api.DiscordApi;
+
+public class ApiGetter {
+
+ private DiscordApi api;
+ public ApiGetter(DiscordApi api) {
+ this.api = api;
+ }
+ DiscordApi getApi() {
+ return api;
+ }
+}
diff --git a/src/main/java/org/jointheleague/features/whale/BetterEmbedBuilder.java b/src/main/java/org/jointheleague/features/whale/BetterEmbedBuilder.java
new file mode 100644
index 00000000..ef539518
--- /dev/null
+++ b/src/main/java/org/jointheleague/features/whale/BetterEmbedBuilder.java
@@ -0,0 +1,14 @@
+package org.jointheleague.features.whale;
+
+import org.javacord.api.entity.message.embed.EmbedBuilder;
+
+public class BetterEmbedBuilder extends EmbedBuilder{
+ public String title;
+@Override
+public EmbedBuilder setTitle(String title) {
+ // TODO Auto-generated method stub
+ this.title = title;
+ return super.setTitle(title);
+}
+
+}
diff --git a/src/main/java/org/jointheleague/features/whale/Event.java b/src/main/java/org/jointheleague/features/whale/Event.java
new file mode 100644
index 00000000..2bb47a28
--- /dev/null
+++ b/src/main/java/org/jointheleague/features/whale/Event.java
@@ -0,0 +1,88 @@
+package org.jointheleague.features.whale;
+
+import java.util.ArrayList;
+
+import org.javacord.api.entity.user.User;
+
+public class Event {
+ private String name;
+ private Time time;
+ private Time endTime;
+ private String date;
+ private ArrayList