Skip to content

Commit

Permalink
Merge remote-tracking branch 'origin/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
DxsSucuk committed Dec 7, 2023
2 parents c138cbe + a54d481 commit aab1de3
Show file tree
Hide file tree
Showing 79 changed files with 1,247 additions and 448 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/cli.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
steps:
- uses: actions/checkout@v4
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
java-version: '17'
distribution: 'temurin'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/codeql-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ jobs:
uses: actions/checkout@v4

- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/dockerPush.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ jobs:

- name: Extract metadata (tags, labels) for Docker
id: meta
uses: docker/metadata-action@v5.0.0
uses: docker/metadata-action@v5.2.0
with:
images: prestischmesti/ree6-bot

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/sonar-analytics.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
with:
fetch-depth: 0 # Shallow clones should be disabled for a better relevancy of analysis
- name: Set up JDK 17
uses: actions/setup-java@v3
uses: actions/setup-java@v4
with:
distribution: 'temurin'
java-version: '17'
Expand Down
4 changes: 2 additions & 2 deletions Ree6-Installer/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@

<groupId>de.presti</groupId>
<artifactId>Ree6-Installer</artifactId>
<version>2.0.0</version>
<version>2.1.0</version>

<properties>
<java.version>17</java.version>
Expand Down Expand Up @@ -90,7 +90,7 @@
</descriptorRefs>
<archive>
<manifest>
<mainClass>de.presti.ree6.Main</mainClass>
<mainClass>de.presti.ree6.installer.Main</mainClass>
</manifest>
</archive>
</configuration>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,11 +1,12 @@
package de.presti.ree6;
package de.presti.ree6.installer;

import org.simpleyaml.configuration.MemorySection;
import org.simpleyaml.configuration.file.YamlFile;

import java.io.File;
import java.nio.file.Files;
import java.nio.file.Path;
import java.util.List;
import java.util.Map;

/**
Expand All @@ -18,13 +19,15 @@ public class Config {
*/
private YamlFile yamlFile;

/**
* The config version.
*/
private final String version = "3.0.17";

/**
* Initialize the Configuration.
*/
public void init() {

yamlFile = createConfiguration();

try {
Path storage = Path.of("storage");
Path storageTemp = Path.of("storage/tmp");
Expand All @@ -35,9 +38,19 @@ public void init() {
if (!Files.exists(storageTemp))
Files.createDirectory(storageTemp);
} catch (Exception exception) {
exception.printStackTrace();
System.err.println("Could not create Storage folder!");
System.err.println(exception.getMessage());
}

createConfigFile();
}

/**
* Create a new Config File.
*/
public void createConfigFile() {
yamlFile = createConfiguration();

if (!getFile().exists()) {
yamlFile.options().copyHeader();
yamlFile.options().copyDefaults();
Expand All @@ -51,7 +64,7 @@ public void init() {
""");
yamlFile.path("config")
.comment("Do not change this!")
.path("version").addDefault("3.0.8")
.path("version").addDefault(version)
.parent().path("creation").addDefault(System.currentTimeMillis());

yamlFile.path("hikari")
Expand All @@ -69,7 +82,7 @@ public void init() {
.parent().path("poolSize").addDefault(10);

yamlFile.path("bot")
.comment("Discord Application and overall Bot Configuration, used for OAuth, Bot Authentication and customization.").blankLine()
.comment("Discord Application and overall Bot Configuration, used for OAuth, Bot Authentication, and customization.").blankLine()
.path("tokens").path("release").addDefault("ReleaseTokenhere").commentSide("Token used when set to release build.")
.parent().path("beta").addDefault("BetaTokenhere").commentSide("Token used when set to beta build.")
.parent().path("dev").addDefault("DevTokenhere").commentSide("Token used when set to dev build.")
Expand All @@ -80,19 +93,33 @@ public void init() {
.parent().path("predefineInformation").addDefault("""
You are Ree6 a Discord bot.
""").commentSide("Predefined Information for the AI.")
.parent().path("invite").addDefault("https://invite.ree6.de").commentSide("The Invite Link of the Bot.")
.parent().path("support").addDefault("https://support.ree6.de").commentSide("The Support Server Link of the Bot.")
.parent().path("github").addDefault("https://github.ree6.de").commentSide("The GitHub Link of the Bot.")
.parent().path("website").addDefault("https://ree6.de").commentSide("The Website Link of the Bot.")
.parent().path("webinterface").addDefault("https://cp.ree6.de").commentSide("The Webinterface Link of the Bot.")
.parent().path("invite").addDefault("https://invite.ree6.de").commentSide("The Invite Link of the Bot. (Can not be empty)")
.parent().path("support").addDefault("https://support.ree6.de").commentSide("The Support Server Link of the Bot. (Can not be empty)")
.parent().path("github").addDefault("https://github.ree6.de").commentSide("The GitHub Link of the Bot. (Can not be empty)")
.parent().path("website").addDefault("https://ree6.de").commentSide("The Website Link of the Bot. (Can not be empty)")
.parent().path("webinterface").addDefault("https://cp.ree6.de").commentSide("The Webinterface Link of the Bot. (Can not be empty)")
.parent().path("recording").addDefault("https://cp.ree6.de/external/recording").commentSide("The Recording Link of the Bot.")
.parent().path("twitchAuth").addDefault("https://cp.ree6.de/external/twitch").commentSide("The Twitch Authentication Link of the Bot.")
.parent().path("advertisement").addDefault("powered by Tube-hosting").commentSide("The Advertisement in Embed Footers and the rest.")
.parent().path("name").addDefault("Ree6").commentSide("The Name of the Bot.")
.parent().path("shards").addDefault(1).commentSide("The shard amount of the Bot. Check out https://anidiots.guide/understanding/sharding/#sharding for more information.")
.parent().path("defaultLanguage").addDefault("en-GB").commentSide("The default Language of the Bot. Based on https://discord.com/developers/docs/reference#locales")
.parent().path("allowRecordingInChat").addDefault(false).commentSide("If you want to allow users to let the Bot send their recording into the chat.")
.parent().path("hideModuleNotification").addDefault(false).commentSide("Should the Notification for disabled Modules be hidden?")
.parent().path("debug").addDefault(false).commentSide("Should the Bot be in Debug Mode? This will enable more logging.")
.parent().path("modules").comment("Customize the active modules in Ree6.").blankLine()
.parent().path("defaultPrefix").addDefault("ree!").commentSide("The default Prefix of the Bot.")
.parent().path("textFont").addDefault("Verdana").commentSide("The Font that is being used in Images for the Text.")
.parent().path("leveling").comment("Customize the leveling module in Ree6.").blankLine()
.path("resets").comment("""
When should Ree6 stop the current progress of the user?
This means if someone mutes themselves, for example, they receive all the XP they would have gotten when they left that instant.
And when they unmute, again the XP gather restarts from 0. So they don't lose their progress, but don't get XP from being mute.""").blankLine()
.path("mute").addDefault(true).commentSide("Should an XP reset be triggered when a user mutes themselves?")
.parent().path("muteGlobal").addDefault(true).commentSide("Should an XP reset be triggered when a user gets muted on the Server?")
.parent().path("deafen").addDefault(true).commentSide("Should an XP reset be triggered when a user deafens themselves?")
.parent().path("deafenGlobal").addDefault(true).commentSide("Should an XP reset be triggered when a user gets deafened on the Server?")
.parent()
.parent().parent().path("modules").comment("Customize the active modules in Ree6.").blankLine()
.path("moderation").addDefault(true).commentSide("Enable the moderation module.")
.parent().path("music").addDefault(true).commentSide("Enable the music module.")
.parent().path("fun").addDefault(true).commentSide("Enable the fun commands.")
Expand All @@ -118,6 +145,13 @@ public void init() {
.parent().path("slashcommands").addDefault(true).commentSide("Enable the slash-commands support.")
.parent().path("messagecommands").addDefault(true).commentSide("Enable the message-commands support.");

yamlFile.path("lavalink")
.comment("Lavalink Configuration, for lavalink support.").blankLine()
.path("enable").addDefault(false).commentSide("If you want to use Lavalink.")
.parent().path("nodes")
.addDefault(List.of(Map.of("name", "Node Name", "host", "node.mylava.link", "port", 0, "secure", false, "password", "none")))
.comment("Lavalink Nodes Configuration.").blankLine();

yamlFile.path("heartbeat")
.comment("Heartbeat Configuration, for status reporting").blankLine()
.path("url").addDefault("none").commentSide("The URL to the Heartbeat-Server")
Expand Down Expand Up @@ -172,14 +206,16 @@ public void init() {
try {
yamlFile.save(getFile());
} catch (Exception exception) {
exception.printStackTrace();
System.err.println("Could not save config file!");
System.err.println(exception.getMessage());
}
} else {
try {
yamlFile.load();
migrateOldConfig();
} catch (Exception exception) {
exception.printStackTrace();
System.err.println("Could not load the config.!");
System.err.println(exception.getMessage());
}
}
}
Expand All @@ -190,7 +226,8 @@ public void init() {
public void migrateOldConfig() {
String configVersion = yamlFile.getString("config.version", "1.9.0");

if (compareVersion(configVersion, "3.0.8") || configVersion.equals("3.0.8"))
if (compareVersion(configVersion, version) ||
configVersion.equals(version))
return;

Map<String, Object> resources = yamlFile.getValues(true);
Expand Down Expand Up @@ -264,7 +301,7 @@ public void migrateOldConfig() {
}

/**
* Compare two version that are based on the x.y.z format.
* Compare two versions that are based on the x.y.z format.
*
* @param versionA the base version.
* @param versionB the version that should be tested against versionA.
Expand Down Expand Up @@ -324,5 +361,4 @@ public YamlFile getConfiguration() {
public File getFile() {
return new File("config.yml");
}

}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.presti.ree6;
package de.presti.ree6.installer;

import org.json.JSONArray;
import org.json.JSONObject;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package de.presti.ree6;
package de.presti.ree6.installer;

import java.net.URI;
import java.net.http.HttpClient;
Expand Down
Loading

0 comments on commit aab1de3

Please sign in to comment.