From 19ea745fa5a17f14b2b096c1fb4385740ce09c81 Mon Sep 17 00:00:00 2001 From: Presti Date: Tue, 28 Nov 2023 10:29:19 +0100 Subject: [PATCH 01/23] Cleaning up the installer. --- Ree6-Installer/pom.xml | 2 +- .../presti/ree6/{ => installer}/Config.java | 41 ++++++++++++++----- .../de/presti/ree6/{ => installer}/Main.java | 2 +- .../ree6/{ => installer}/RequestUtility.java | 2 +- 4 files changed, 34 insertions(+), 13 deletions(-) rename Ree6-Installer/src/main/java/de/presti/ree6/{ => installer}/Config.java (89%) rename Ree6-Installer/src/main/java/de/presti/ree6/{ => installer}/Main.java (99%) rename Ree6-Installer/src/main/java/de/presti/ree6/{ => installer}/RequestUtility.java (97%) diff --git a/Ree6-Installer/pom.xml b/Ree6-Installer/pom.xml index 4eb7fb91c..eae670b57 100644 --- a/Ree6-Installer/pom.xml +++ b/Ree6-Installer/pom.xml @@ -90,7 +90,7 @@ - de.presti.ree6.Main + de.presti.ree6.installer.Main diff --git a/Ree6-Installer/src/main/java/de/presti/ree6/Config.java b/Ree6-Installer/src/main/java/de/presti/ree6/installer/Config.java similarity index 89% rename from Ree6-Installer/src/main/java/de/presti/ree6/Config.java rename to Ree6-Installer/src/main/java/de/presti/ree6/installer/Config.java index d538fedb1..330896151 100644 --- a/Ree6-Installer/src/main/java/de/presti/ree6/Config.java +++ b/Ree6-Installer/src/main/java/de/presti/ree6/installer/Config.java @@ -1,4 +1,4 @@ -package de.presti.ree6; +package de.presti.ree6.installer; import org.simpleyaml.configuration.MemorySection; import org.simpleyaml.configuration.file.YamlFile; @@ -6,6 +6,7 @@ import java.io.File; import java.nio.file.Files; import java.nio.file.Path; +import java.util.List; import java.util.Map; /** @@ -22,9 +23,6 @@ public class Config { * Initialize the Configuration. */ public void init() { - - yamlFile = createConfiguration(); - try { Path storage = Path.of("storage"); Path storageTemp = Path.of("storage/tmp"); @@ -35,9 +33,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(); @@ -51,7 +59,7 @@ public void init() { """); yamlFile.path("config") .comment("Do not change this!") - .path("version").addDefault("3.0.8") + .path("version").addDefault("3.0.15") .parent().path("creation").addDefault(System.currentTimeMillis()); yamlFile.path("hikari") @@ -90,8 +98,12 @@ public void init() { .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 wanna 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("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("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.") @@ -118,6 +130,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") @@ -172,14 +191,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()); } } } @@ -190,7 +211,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, "3.0.15") || + configVersion.equals("3.0.15")) return; Map resources = yamlFile.getValues(true); @@ -324,5 +346,4 @@ public YamlFile getConfiguration() { public File getFile() { return new File("config.yml"); } - } diff --git a/Ree6-Installer/src/main/java/de/presti/ree6/Main.java b/Ree6-Installer/src/main/java/de/presti/ree6/installer/Main.java similarity index 99% rename from Ree6-Installer/src/main/java/de/presti/ree6/Main.java rename to Ree6-Installer/src/main/java/de/presti/ree6/installer/Main.java index 0787f6065..46be3a44f 100644 --- a/Ree6-Installer/src/main/java/de/presti/ree6/Main.java +++ b/Ree6-Installer/src/main/java/de/presti/ree6/installer/Main.java @@ -1,4 +1,4 @@ -package de.presti.ree6; +package de.presti.ree6.installer; import org.json.JSONArray; import org.json.JSONObject; diff --git a/Ree6-Installer/src/main/java/de/presti/ree6/RequestUtility.java b/Ree6-Installer/src/main/java/de/presti/ree6/installer/RequestUtility.java similarity index 97% rename from Ree6-Installer/src/main/java/de/presti/ree6/RequestUtility.java rename to Ree6-Installer/src/main/java/de/presti/ree6/installer/RequestUtility.java index 730834fff..32988545c 100644 --- a/Ree6-Installer/src/main/java/de/presti/ree6/RequestUtility.java +++ b/Ree6-Installer/src/main/java/de/presti/ree6/installer/RequestUtility.java @@ -1,4 +1,4 @@ -package de.presti.ree6; +package de.presti.ree6.installer; import java.net.URI; import java.net.http.HttpClient; From ccd8ce2535cce75d787b1290cb63cc71ccc0b249 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 28 Nov 2023 14:35:54 +0100 Subject: [PATCH 02/23] Update dependency ch.qos.logback:logback-classic to v1.4.12 (#478) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 2858e827b..e997340dc 100644 --- a/pom.xml +++ b/pom.xml @@ -174,7 +174,7 @@ ch.qos.logback logback-classic - 1.4.11 + 1.4.12 From b00cf37e1056d2101c30c3e6b3c97b1c0f785a3b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Tue, 28 Nov 2023 19:39:58 +0000 Subject: [PATCH 03/23] Update dependency ch.qos.logback:logback-classic to v1.4.13 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e997340dc..c4a233643 100644 --- a/pom.xml +++ b/pom.xml @@ -174,7 +174,7 @@ ch.qos.logback logback-classic - 1.4.12 + 1.4.13 From 107dff58b9c12e8325c06b4beb48a92f1b5d769e Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 29 Nov 2023 18:25:46 +0000 Subject: [PATCH 04/23] Update actions/setup-java action to v4 --- .github/workflows/cli.yml | 2 +- .github/workflows/codeql-analysis.yml | 2 +- .github/workflows/sonar-analytics.yml | 2 +- 3 files changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/cli.yml b/.github/workflows/cli.yml index 1171323e7..1a53e3816 100644 --- a/.github/workflows/cli.yml +++ b/.github/workflows/cli.yml @@ -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' diff --git a/.github/workflows/codeql-analysis.yml b/.github/workflows/codeql-analysis.yml index 55930ec53..8b2152333 100644 --- a/.github/workflows/codeql-analysis.yml +++ b/.github/workflows/codeql-analysis.yml @@ -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' diff --git a/.github/workflows/sonar-analytics.yml b/.github/workflows/sonar-analytics.yml index 25d90a7ba..ac18dccab 100644 --- a/.github/workflows/sonar-analytics.yml +++ b/.github/workflows/sonar-analytics.yml @@ -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' From df6024bf8f9630ec4774892d253c1bcb567f4e16 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Wed, 29 Nov 2023 22:00:02 +0000 Subject: [PATCH 05/23] Update dependency commons-io:commons-io to v2.15.1 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e997340dc..43880ebb8 100644 --- a/pom.xml +++ b/pom.xml @@ -205,7 +205,7 @@ commons-io commons-io - 2.15.0 + 2.15.1 commons-codec From 62cbecedeaebf16729bcbaa30e39b58ae0d02ac9 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 30 Nov 2023 10:44:28 +0000 Subject: [PATCH 06/23] Update docker/metadata-action action to v5.1.0 --- .github/workflows/dockerPush.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dockerPush.yml b/.github/workflows/dockerPush.yml index 3ebbc3134..63a5d48b8 100644 --- a/.github/workflows/dockerPush.yml +++ b/.github/workflows/dockerPush.yml @@ -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.1.0 with: images: prestischmesti/ree6-bot From e6b22e3a5e010327895eb20b89c3330905ce709b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Thu, 30 Nov 2023 14:39:36 +0000 Subject: [PATCH 07/23] Update dependency io.sentry:sentry to v7 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index e997340dc..2a4344ba2 100644 --- a/pom.xml +++ b/pom.xml @@ -69,7 +69,7 @@ io.sentry sentry - 6.34.0 + 7.0.0 com.github.Carleslc.Simple-YAML From 7fa8f89736fb2493fa5618d8d22ac71193948229 Mon Sep 17 00:00:00 2001 From: Presti Date: Thu, 30 Nov 2023 16:53:08 +0100 Subject: [PATCH 08/23] Bumping SQL. --- pom.xml | 2 +- src/main/java/de/presti/ree6/main/Main.java | 3 +-- 2 files changed, 2 insertions(+), 3 deletions(-) diff --git a/pom.xml b/pom.xml index d493e97a1..9ed28d845 100644 --- a/pom.xml +++ b/pom.xml @@ -162,7 +162,7 @@ de.ree6 Ree6-SQL - 2.1.4 + 2.1.5 diff --git a/src/main/java/de/presti/ree6/main/Main.java b/src/main/java/de/presti/ree6/main/Main.java index 25441701e..1f51ba6e7 100644 --- a/src/main/java/de/presti/ree6/main/Main.java +++ b/src/main/java/de/presti/ree6/main/Main.java @@ -59,7 +59,6 @@ import java.io.IOException; import java.io.InputStream; import java.net.URI; -import java.net.URL; import java.nio.file.Files; import java.nio.file.Path; import java.sql.Timestamp; @@ -817,7 +816,7 @@ public void createHeartbeatThread() { ThreadUtil.createThread(x -> { String formattedUrl = heartbeatUrl.replace("%ping%", String.valueOf(BotWorker.getShardManager().getAverageGatewayPing())); - try (InputStream inputStream = RequestUtility.request(RequestUtility.Request.builder().url(formattedUrl).GET().build())) { + try (InputStream ignored = RequestUtility.request(RequestUtility.Request.builder().url(formattedUrl).GET().build())) { Main.getInstance().logAnalytic("Heartbeat sent!"); } catch (Exception exception) { log.warn("Heartbeat failed! Reporting to Sentry..."); From 28a3d70e61dff642802fcfd909c1527df5fb64dc Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 1 Dec 2023 09:34:53 +0100 Subject: [PATCH 09/23] Update docker/metadata-action action to v5.2.0 (#485) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- .github/workflows/dockerPush.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/dockerPush.yml b/.github/workflows/dockerPush.yml index 63a5d48b8..f343c6ee3 100644 --- a/.github/workflows/dockerPush.yml +++ b/.github/workflows/dockerPush.yml @@ -30,7 +30,7 @@ jobs: - name: Extract metadata (tags, labels) for Docker id: meta - uses: docker/metadata-action@v5.1.0 + uses: docker/metadata-action@v5.2.0 with: images: prestischmesti/ree6-bot From 18c31bacfd80f3e113206d568f6e02c83d75c5e3 Mon Sep 17 00:00:00 2001 From: Presti Date: Fri, 1 Dec 2023 12:24:27 +0100 Subject: [PATCH 10/23] Renaming Data into BotConfig. Improving configuration for leveling System. --- pom.xml | 2 +- .../ree6/audio/AudioPlayerReceiveHandler.java | 12 +-- .../ree6/audio/music/GuildMusicManager.java | 6 +- .../presti/ree6/audio/music/MusicWorker.java | 54 ++++++------ .../ree6/audio/music/TrackScheduler.java | 40 ++++----- .../data/Data.java => bot/BotConfig.java} | 38 +++++++- .../java/de/presti/ree6/bot/BotWorker.java | 7 +- .../presti/ree6/commands/CommandManager.java | 34 +++---- .../impl/community/InstagramNotifier.java | 4 +- .../commands/impl/community/RSSNotifier.java | 4 +- .../impl/community/RedditNotifier.java | 4 +- .../commands/impl/community/Schedule.java | 4 +- .../impl/community/StreamActionCommand.java | 6 +- .../ree6/commands/impl/community/Ticket.java | 4 +- .../impl/community/TikTokNotifier.java | 4 +- .../impl/community/TwitchNotifier.java | 4 +- .../impl/community/TwitterNotifier.java | 4 +- .../impl/community/YouTubeNotifier.java | 4 +- .../presti/ree6/commands/impl/fun/Anime.java | 4 +- .../ree6/commands/impl/fun/CatImage.java | 4 +- .../ree6/commands/impl/fun/DogImage.java | 4 +- .../presti/ree6/commands/impl/fun/Manga.java | 4 +- .../ree6/commands/impl/fun/MemeImage.java | 4 +- .../presti/ree6/commands/impl/fun/Monkey.java | 4 +- .../ree6/commands/impl/fun/PickUpLine.java | 4 +- .../ree6/commands/impl/fun/ShibaImage.java | 4 +- .../presti/ree6/commands/impl/fun/Waifu.java | 6 +- .../ree6/commands/impl/hidden/Addon.java | 4 +- .../commands/impl/hidden/Announcement.java | 4 +- .../ree6/commands/impl/hidden/Test.java | 7 +- .../presti/ree6/commands/impl/info/Help.java | 10 +-- .../presti/ree6/commands/impl/info/Info.java | 4 +- .../ree6/commands/impl/info/Invite.java | 4 +- .../ree6/commands/impl/info/Server.java | 4 +- .../presti/ree6/commands/impl/info/Stats.java | 6 +- .../ree6/commands/impl/info/Support.java | 4 +- .../commands/impl/level/Leaderboards.java | 6 +- .../presti/ree6/commands/impl/mod/Setup.java | 4 +- .../ree6/commands/impl/mod/Suggestion.java | 6 +- .../ree6/commands/impl/mod/Webinterface.java | 4 +- .../ree6/commands/impl/music/Clearqueue.java | 6 +- .../ree6/commands/impl/music/Disconnect.java | 6 +- .../presti/ree6/commands/impl/music/Loop.java | 6 +- .../ree6/commands/impl/music/Lyrics.java | 8 +- .../ree6/commands/impl/music/MusicPanel.java | 5 +- .../ree6/commands/impl/music/Pause.java | 6 +- .../presti/ree6/commands/impl/music/Play.java | 10 +-- .../ree6/commands/impl/music/Resume.java | 6 +- .../ree6/commands/impl/music/Shuffle.java | 6 +- .../ree6/commands/impl/music/SongInfo.java | 6 +- .../ree6/commands/impl/music/SongList.java | 6 +- .../presti/ree6/commands/impl/music/Stop.java | 4 +- .../ree6/commands/impl/music/Volume.java | 12 +-- .../presti/ree6/commands/impl/nsfw/NSFW.java | 4 +- .../ree6/commands/impl/nsfw/Rule34.java | 4 +- .../ree6/commands/interfaces/ICommand.java | 6 +- .../de/presti/ree6/events/LoggingEvents.java | 88 +++++++++---------- .../de/presti/ree6/events/MenuEvents.java | 80 ++++++++--------- .../de/presti/ree6/events/OtherEvents.java | 88 ++++++++++--------- .../presti/ree6/language/LanguageService.java | 4 +- .../ree6/logger/events/LoggerQueue.java | 6 +- src/main/java/de/presti/ree6/main/Main.java | 45 +++++----- .../presti/ree6/news/AnnouncementManager.java | 6 +- .../de/presti/ree6/utils/apis/ChatGPTAPI.java | 6 +- .../de/presti/ree6/utils/apis/Notifier.java | 36 ++++---- .../de/presti/ree6/utils/data/Config.java | 25 ++++-- .../ree6/utils/data/ImageCreationUtility.java | 3 +- .../ree6/utils/others/ModerationUtil.java | 4 +- 68 files changed, 446 insertions(+), 386 deletions(-) rename src/main/java/de/presti/ree6/{utils/data/Data.java => bot/BotConfig.java} (81%) diff --git a/pom.xml b/pom.xml index 9ed28d845..06d13adbd 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ de.presti Ree6 - 3.0.16 + 3.0.17 jar diff --git a/src/main/java/de/presti/ree6/audio/AudioPlayerReceiveHandler.java b/src/main/java/de/presti/ree6/audio/AudioPlayerReceiveHandler.java index 34308d905..6ee9eadd8 100644 --- a/src/main/java/de/presti/ree6/audio/AudioPlayerReceiveHandler.java +++ b/src/main/java/de/presti/ree6/audio/AudioPlayerReceiveHandler.java @@ -6,7 +6,7 @@ import de.presti.ree6.sql.SQLSession; import de.presti.ree6.sql.entities.Recording; import de.presti.ree6.utils.data.AudioUtil; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import lombok.extern.slf4j.Slf4j; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.Permission; @@ -87,7 +87,7 @@ public AudioPlayerReceiveHandler(Member member, VoiceChannel voiceChannel) { message = voiceChannel.sendMessageEmbeds(new EmbedBuilder() .setDescription(LanguageService.getByGuild(member.getGuild(), "message.recording.started")) .setColor(Color.YELLOW) - .setFooter("Requested by " + member.getEffectiveName() + " - " + Data.getAdvertisement(), member.getEffectiveAvatarUrl()) + .setFooter("Requested by " + member.getEffectiveName() + " - " + BotConfig.getAdvertisement(), member.getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuild(member.getGuild(), "label.recording.start")) .build()).complete(); } @@ -184,14 +184,14 @@ public void endReceiving() { message.editMessageEmbeds(new EmbedBuilder() .setDescription(LanguageService.getByGuild(voiceChannel.getGuild(), "message.recording.stopped")) .setColor(Color.GREEN) - .setFooter(Data.getAdvertisement(), voiceChannel.getGuild().getIconUrl()) + .setFooter(BotConfig.getAdvertisement(), voiceChannel.getGuild().getIconUrl()) .setTitle(LanguageService.getByGuild(voiceChannel.getGuild(), "label.recording.finished")) .build()) .setActionRow( new ButtonImpl("ree6RedirectButton", LanguageService.getByGuild(voiceChannel.getGuild(), "label.download"), ButtonStyle.LINK, - Data.getRecordingUrl() + "?id=" + recording.getIdentifier(), failedToUpload, Emoji.fromCustom("shiba", 941219375535509504L, true)), + BotConfig.getRecordingUrl() + "?id=" + recording.getIdentifier(), failedToUpload, Emoji.fromCustom("shiba", 941219375535509504L, true)), Button.primary("r_recordingDownload:" + recording.getIdentifier(), Emoji.fromCustom("sip", 1011956355810209852L, false)) - .withLabel(LanguageService.getByGuild(voiceChannel.getGuild(), "label.sendToChat")).withDisabled(!Data.allowRecordingInChat() || failedToUpload)).complete(); + .withLabel(LanguageService.getByGuild(voiceChannel.getGuild(), "label.sendToChat")).withDisabled(!BotConfig.allowRecordingInChat() || failedToUpload)).complete(); if (failedToUpload) { voiceChannel.sendMessage(LanguageService.getByGuild(voiceChannel.getGuild(), "message.recording.error", "Upload failed")).setFiles(FileUpload.fromData(recording.getRecording(), "recording.wav")); @@ -203,7 +203,7 @@ public void endReceiving() { message.editMessageEmbeds(new EmbedBuilder() .setDescription(LanguageService.getByGuild(voiceChannel.getGuild(), "message.recording.error", ex.getMessage())) .setColor(Color.RED) - .setFooter(Data.getAdvertisement(), voiceChannel.getGuild().getIconUrl()) + .setFooter(BotConfig.getAdvertisement(), voiceChannel.getGuild().getIconUrl()) .setTitle(LanguageService.getByGuild(voiceChannel.getGuild(), "label.error")) .build()).complete(); } diff --git a/src/main/java/de/presti/ree6/audio/music/GuildMusicManager.java b/src/main/java/de/presti/ree6/audio/music/GuildMusicManager.java index 1014a3590..8f3b0e856 100644 --- a/src/main/java/de/presti/ree6/audio/music/GuildMusicManager.java +++ b/src/main/java/de/presti/ree6/audio/music/GuildMusicManager.java @@ -3,7 +3,7 @@ import com.sedmelluq.discord.lavaplayer.player.AudioPlayerManager; import de.presti.ree6.audio.AudioPlayerSendHandler; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import lavalink.client.player.IPlayer; import lavalink.client.player.LavaplayerPlayerWrapper; import lombok.Getter; @@ -42,7 +42,7 @@ public class GuildMusicManager { */ public GuildMusicManager(Guild guild, AudioPlayerManager manager) { this.guild = guild; - player = Data.shouldUseLavaLink() ? Main.getInstance().getLavalink().getLink(guild).getPlayer() : new LavaplayerPlayerWrapper(manager.createPlayer()); + player = BotConfig.shouldUseLavaLink() ? Main.getInstance().getLavalink().getLink(guild).getPlayer() : new LavaplayerPlayerWrapper(manager.createPlayer()); scheduler = new TrackScheduler(this, player); player.addListener(scheduler); } @@ -60,7 +60,7 @@ public boolean isMusicPlaying() { * @return Wrapper around AudioPlayer to use it as an AudioSendHandler. */ public AudioPlayerSendHandler getSendHandler() { - if (Data.shouldUseLavaLink()) return null; + if (BotConfig.shouldUseLavaLink()) return null; if (audioPlayerSendHandler != null) return audioPlayerSendHandler; diff --git a/src/main/java/de/presti/ree6/audio/music/MusicWorker.java b/src/main/java/de/presti/ree6/audio/music/MusicWorker.java index 3a9965f65..328d18dd0 100644 --- a/src/main/java/de/presti/ree6/audio/music/MusicWorker.java +++ b/src/main/java/de/presti/ree6/audio/music/MusicWorker.java @@ -18,7 +18,7 @@ import de.presti.ree6.main.Main; import de.presti.ree6.utils.apis.SpotifyAPIHandler; import de.presti.ree6.utils.apis.YouTubeAPIHandler; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.others.FormatUtil; import io.sentry.Sentry; import lavalink.client.io.Link; @@ -65,10 +65,10 @@ public class MusicWorker { */ public MusicWorker() { musicManagers = new HashMap<>(); - playerManager = Data.shouldUseLavaLink() ? Main.getInstance().getLavalink().getAudioPlayerManager() : new DefaultAudioPlayerManager(); + playerManager = BotConfig.shouldUseLavaLink() ? Main.getInstance().getLavalink().getAudioPlayerManager() : new DefaultAudioPlayerManager(); // Register AudioSources, if music module is active. If not, then don't register them. This will cause a failed resolve when ever a command is being executed. - if (Data.isModuleActive("music") && !Data.shouldUseLavaLink()) { + if (BotConfig.isModuleActive("music") && !BotConfig.shouldUseLavaLink()) { playerManager.registerSourceManager(SoundCloudAudioSourceManager.createDefault()); playerManager.registerSourceManager(new BandcampAudioSourceManager()); playerManager.registerSourceManager(new VimeoAudioSourceManager()); @@ -91,7 +91,7 @@ public synchronized GuildMusicManager getGuildAudioPlayer(Guild guild) { GuildMusicManager musicManager = musicManagers.get(guildId); - if (!Data.shouldUseLavaLink()) { + if (!BotConfig.shouldUseLavaLink()) { guild.getAudioManager().setSendingHandler(musicManager.getSendHandler()); } @@ -173,13 +173,13 @@ public void loadAndPlay(final Guild guild, MessageChannelUnion channel, AudioCha if (silent) return; Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder() - .setAuthor(guild.getJDA().getSelfUser().getName(), Data.getWebsite(), + .setAuthor(guild.getJDA().getSelfUser().getName(), BotConfig.getWebsite(), guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuild(guild, "label.musicPlayer")) .setThumbnail(guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) .setColor(Color.RED) .setDescription(LanguageService.getByGuild(guild, "message.music.notPlaying")) - .setFooter(guild.getName() + " - " + Data.getAdvertisement(), guild.getIconUrl()) + .setFooter(guild.getName() + " - " + BotConfig.getAdvertisement(), guild.getIconUrl()) , channel, interactionHook); return; } @@ -198,12 +198,12 @@ public void loadAndPlay(final Guild guild, MessageChannelUnion channel, AudioCha public void trackLoaded(AudioTrack track) { if (!silent) Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder() - .setAuthor(guild.getJDA().getSelfUser().getName(), Data.getWebsite(), guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) + .setAuthor(guild.getJDA().getSelfUser().getName(), BotConfig.getWebsite(), guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuild(guild, "label.musicPlayer")) .setImage((track.getInfo().artworkUrl != null && track.getInfo().artworkUrl.isBlank()) ? guild.getJDA().getSelfUser().getEffectiveAvatarUrl() : track.getInfo().artworkUrl) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(guild, "message.music.queueAdded.default", FormatUtil.filter(track.getInfo().title))) - .setFooter(guild.getName() + " - " + Data.getAdvertisement(), guild.getIconUrl()), 5, messageChannel, interactionHook); + .setFooter(guild.getName() + " - " + BotConfig.getAdvertisement(), guild.getIconUrl()), 5, messageChannel, interactionHook); play(finalAudioChannel, musicManager, track, force); } @@ -223,12 +223,12 @@ public void playlistLoaded(AudioPlaylist playlist) { if (!silent) Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder() - .setAuthor(guild.getJDA().getSelfUser().getName(), Data.getWebsite(), guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) + .setAuthor(guild.getJDA().getSelfUser().getName(), BotConfig.getWebsite(), guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuild(guild, "label.musicPlayer")) .setThumbnail(guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(guild, "message.music.queueAdded.firstOfList", FormatUtil.filter(firstTrack.getInfo().title), FormatUtil.filter(playlist.getName()))) - .setFooter(guild.getName() + " - " + Data.getAdvertisement(), guild.getIconUrl()), 5, messageChannel, interactionHook); + .setFooter(guild.getName() + " - " + BotConfig.getAdvertisement(), guild.getIconUrl()), 5, messageChannel, interactionHook); play(finalAudioChannel, musicManager, firstTrack, force); @@ -248,12 +248,12 @@ public void noMatches() { if (!silent) Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder() - .setAuthor(guild.getJDA().getSelfUser().getName(), Data.getWebsite(), guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) + .setAuthor(guild.getJDA().getSelfUser().getName(), BotConfig.getWebsite(), guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuild(guild, "label.musicPlayer")) .setThumbnail(guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(guild, "message.music.searchUrlFailed", FormatUtil.filter(trackUrl))) - .setFooter(guild.getName() + " - " + Data.getAdvertisement(), guild.getIconUrl()), 5, messageChannel, interactionHook); + .setFooter(guild.getName() + " - " + BotConfig.getAdvertisement(), guild.getIconUrl()), 5, messageChannel, interactionHook); } /** @@ -265,12 +265,12 @@ public void loadFailed(FriendlyException exception) { if (!silent) Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder() - .setAuthor(guild.getJDA().getSelfUser().getName(), Data.getWebsite(), guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) + .setAuthor(guild.getJDA().getSelfUser().getName(), BotConfig.getWebsite(), guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuild(guild, "label.musicPlayer")) .setThumbnail(guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(guild, "message.music.failedLoading", exception.getMessage())) - .setFooter(guild.getName() + " - " + Data.getAdvertisement(), guild.getIconUrl()), 5, messageChannel, interactionHook); + .setFooter(guild.getName() + " - " + BotConfig.getAdvertisement(), guild.getIconUrl()), 5, messageChannel, interactionHook); } }); } @@ -358,12 +358,12 @@ public void playSong(String value, Guild guild, Member member, MessageChannelUni if (spotiftrackinfos.isEmpty()) { EmbedBuilder em = new EmbedBuilder() .setAuthor(guild.getJDA().getSelfUser().getName(), - Data.getWebsite(), guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) + BotConfig.getWebsite(), guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuildOrInteraction(guild, interaction, "label.musicPlayer")) .setThumbnail(guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuildOrInteraction(guild, interaction, "message.music.notFound", value)) - .setFooter(guild.getName() + " - " + Data.getAdvertisement(), guild.getIconUrl()); + .setFooter(guild.getName() + " - " + BotConfig.getAdvertisement(), guild.getIconUrl()); Main.getInstance().getCommandManager().sendMessage(em, 5, channel, interactionHook); return; } @@ -395,12 +395,12 @@ public void playSong(String value, Guild guild, Member member, MessageChannelUni if (!loadFailed.isEmpty()) { EmbedBuilder em = new EmbedBuilder() .setAuthor(guild.getJDA().getSelfUser().getName(), - Data.getWebsite(), guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) + BotConfig.getWebsite(), guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuildOrInteraction(guild, interaction, "label.musicPlayer")) .setThumbnail(guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuildOrInteraction(guild, interaction, "message.music.notFoundMultiple", loadFailed.size())) - .setFooter(guild.getName() + " - " + Data.getAdvertisement(), guild.getIconUrl()); + .setFooter(guild.getName() + " - " + BotConfig.getAdvertisement(), guild.getIconUrl()); Main.getInstance().getCommandManager().sendMessage(em, 5, channel, interactionHook); } } @@ -411,12 +411,12 @@ public void playSong(String value, Guild guild, Member member, MessageChannelUni ytResult = YouTubeAPIHandler.getInstance().searchYoutube(value); } catch (Exception exception) { EmbedBuilder em = new EmbedBuilder() - .setAuthor(guild.getJDA().getSelfUser().getName(), Data.getWebsite(), guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) + .setAuthor(guild.getJDA().getSelfUser().getName(), BotConfig.getWebsite(), guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuildOrInteraction(guild, interaction, "label.musicPlayer")) .setThumbnail(guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) .setColor(Color.RED) .setDescription(LanguageService.getByGuildOrInteraction(guild, interaction, "message.music.searchFailed")) - .setFooter(guild.getName() + " - " + Data.getAdvertisement(), guild.getIconUrl()); + .setFooter(guild.getName() + " - " + BotConfig.getAdvertisement(), guild.getIconUrl()); Main.getInstance().getCommandManager().sendMessage(em, 5, channel, interactionHook); log.error("Error while searching for " + value + " on YouTube", exception); return; @@ -424,12 +424,12 @@ public void playSong(String value, Guild guild, Member member, MessageChannelUni if (ytResult == null) { EmbedBuilder em = new EmbedBuilder() - .setAuthor(guild.getJDA().getSelfUser().getName(), Data.getWebsite(), guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) + .setAuthor(guild.getJDA().getSelfUser().getName(), BotConfig.getWebsite(), guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuildOrInteraction(guild, interaction, "label.musicPlayer")) .setThumbnail(guild.getJDA().getSelfUser().getEffectiveAvatarUrl()) .setColor(Color.YELLOW) .setDescription(LanguageService.getByGuildOrInteraction(guild, interaction, "message.music.notFound", FormatUtil.filter(value))) - .setFooter(guild.getName() + " - " + Data.getAdvertisement(), guild.getIconUrl()); + .setFooter(guild.getName() + " - " + BotConfig.getAdvertisement(), guild.getIconUrl()); Main.getInstance().getCommandManager().sendMessage(em, 5, channel, interactionHook); } else { loadAndPlay(channel, Objects.requireNonNull(member.getVoiceState()).getChannel(), ytResult, interactionHook, false); @@ -458,12 +458,12 @@ public void skipTrack(MessageChannelUnion channel, InteractionHook interactionHo */ public void skipTrack(MessageChannelUnion channel, InteractionHook interactionHook, int skipAmount, boolean silent) { if (!silent) { - Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder().setAuthor(channel.getJDA().getSelfUser().getName(), Data.getWebsite(), channel.getJDA().getSelfUser().getAvatarUrl()) + Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder().setAuthor(channel.getJDA().getSelfUser().getName(), BotConfig.getWebsite(), channel.getJDA().getSelfUser().getAvatarUrl()) .setTitle(LanguageService.getByGuild(channel.asGuildMessageChannel().getGuild(), "label.musicPlayer")) .setThumbnail(channel.getJDA().getSelfUser().getAvatarUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(channel.asGuildMessageChannel().getGuild(), "message.music.skip")) - .setFooter(channel.asGuildMessageChannel().getGuild().getName() + " - " + Data.getAdvertisement(), channel.asGuildMessageChannel().getGuild().getIconUrl()), 5, channel, interactionHook); + .setFooter(channel.asGuildMessageChannel().getGuild().getName() + " - " + BotConfig.getAdvertisement(), channel.asGuildMessageChannel().getGuild().getIconUrl()), 5, channel, interactionHook); } getGuildAudioPlayer(channel.asGuildMessageChannel().getGuild()).getScheduler().nextTrack(channel, skipAmount, silent); @@ -496,7 +496,7 @@ public boolean isAttemptingToConnect(ConnectionStatus connectionStatus) { * @param audioChannel the Audio-Channel the Bot should join. */ public void connectToAudioChannel(AudioManager audioManager, AudioChannel audioChannel) { - if (Data.shouldUseLavaLink()) { + if (BotConfig.shouldUseLavaLink()) { JdaLink link = Main.getInstance().getLavalink().getLink(audioManager.getGuild()); if (link.getState() == Link.State.NOT_CONNECTED) { @@ -522,7 +522,7 @@ public void connectToAudioChannel(AudioManager audioManager, AudioChannel audioC public boolean isConnected(Guild guild) { if (guild == null) return false; - if (Data.shouldUseLavaLink()) { + if (BotConfig.shouldUseLavaLink()) { return Main.getInstance().getLavalink().getLink(guild).getState() == Link.State.CONNECTED; } else { return guild.getAudioManager().isConnected() || isConnectedMember(guild.getSelfMember()); @@ -535,7 +535,7 @@ public boolean isConnected(Guild guild) { * @param guild the Guild. */ public void disconnect(Guild guild) { - if (Data.shouldUseLavaLink()) { + if (BotConfig.shouldUseLavaLink()) { Main.getInstance().getLavalink().getLink(guild).destroy(); } else { guild.getAudioManager().closeAudioConnection(); diff --git a/src/main/java/de/presti/ree6/audio/music/TrackScheduler.java b/src/main/java/de/presti/ree6/audio/music/TrackScheduler.java index 48ac47b1c..ecd9832c2 100644 --- a/src/main/java/de/presti/ree6/audio/music/TrackScheduler.java +++ b/src/main/java/de/presti/ree6/audio/music/TrackScheduler.java @@ -7,7 +7,7 @@ import de.presti.ree6.api.events.MusicPlayerStateChangeEvent; import de.presti.ree6.language.LanguageService; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.others.FormatUtil; import lavalink.client.player.IPlayer; import lavalink.client.player.event.AudioEventAdapterWrapped; @@ -175,24 +175,24 @@ public void nextTrack(MessageChannelUnion textChannel, int position, boolean sil // TODO:: Really stupid workaround for https://github.com/Ree6-Applications/Ree6/issues/299! This should be rechecked later if it even worked. if (!silent) Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder() - .setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), Data.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) + .setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), BotConfig.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuild(guildMusicManager.getGuild(), "label.musicPlayer")) .setThumbnail(guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(guildMusicManager.getGuild(), "message.music.songNext", FormatUtil.filter(track.getInfo().title))) - .setFooter(guildMusicManager.getGuild().getName() + " - " + Data.getAdvertisement(), guildMusicManager.getGuild().getIconUrl()), 5, getChannel()); + .setFooter(guildMusicManager.getGuild().getName() + " - " + BotConfig.getAdvertisement(), guildMusicManager.getGuild().getIconUrl()), 5, getChannel()); Main.getInstance().getEventBus().post(new MusicPlayerStateChangeEvent(textChannel.asGuildMessageChannel().getGuild(), MusicPlayerStateChangeEvent.State.PLAYING, track)); player.playTrack(track.makeClone(), false); } else { if (!silent) Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder() - .setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), Data.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) + .setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), BotConfig.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuild(guildMusicManager.getGuild(), "label.musicPlayer")) .setThumbnail(guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) .setColor(Color.RED) .setDescription(LanguageService.getByGuild(guildMusicManager.getGuild(), "message.music.songQueueReachedEnd")) - .setFooter(guildMusicManager.getGuild().getName() + " - " + Data.getAdvertisement(), guildMusicManager.getGuild().getIconUrl()), 5, getChannel()); + .setFooter(guildMusicManager.getGuild().getName() + " - " + BotConfig.getAdvertisement(), guildMusicManager.getGuild().getIconUrl()), 5, getChannel()); Main.getInstance().getEventBus().post(new MusicPlayerStateChangeEvent(textChannel.asGuildMessageChannel().getGuild(), MusicPlayerStateChangeEvent.State.QUEUE_EMPTY, null)); } @@ -207,23 +207,23 @@ public void nextTrack(MessageChannelUnion textChannel, int position, boolean sil public void seekPosition(MessageChannelUnion channel, int seekAmountInSeconds) { if (player.getPlayingTrack() == null) { Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder() - .setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), Data.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) + .setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), BotConfig.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuild(guildMusicManager.getGuild(), "label.musicPlayer")) .setThumbnail(guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) .setColor(Color.RED) .setDescription(LanguageService.getByGuild(guildMusicManager.getGuild(), "message.music.notPlaying")) - .setFooter(guildMusicManager.getGuild().getName() + " - " + Data.getAdvertisement(), guildMusicManager.getGuild().getIconUrl()), 5, getChannel()); + .setFooter(guildMusicManager.getGuild().getName() + " - " + BotConfig.getAdvertisement(), guildMusicManager.getGuild().getIconUrl()), 5, getChannel()); return; } if (player.getPlayingTrack().getPosition() / 1000 + seekAmountInSeconds > player.getPlayingTrack().getDuration() / 1000) { Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder() - .setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), Data.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) + .setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), BotConfig.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuild(guildMusicManager.getGuild(), "label.musicPlayer")) .setThumbnail(guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) .setColor(Color.RED) .setDescription(LanguageService.getByGuild(guildMusicManager.getGuild(), "message.music.seek.failed")) - .setFooter(guildMusicManager.getGuild().getName() + " - " + Data.getAdvertisement(), guildMusicManager.getGuild().getIconUrl()), 5, getChannel()); + .setFooter(guildMusicManager.getGuild().getName() + " - " + BotConfig.getAdvertisement(), guildMusicManager.getGuild().getIconUrl()), 5, getChannel()); return; } @@ -235,12 +235,12 @@ public void seekPosition(MessageChannelUnion channel, int seekAmountInSeconds) { } Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder() - .setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), Data.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) + .setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), BotConfig.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuild(guildMusicManager.getGuild(), "label.musicPlayer")) .setThumbnail(guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(guildMusicManager.getGuild(), "message.music.seek.success", FormatUtil.formatTime(player.getPlayingTrack().getPosition()))) - .setFooter(guildMusicManager.getGuild().getName() + " - " + Data.getAdvertisement(), guildMusicManager.getGuild().getIconUrl()), 5, getChannel()); + .setFooter(guildMusicManager.getGuild().getName() + " - " + BotConfig.getAdvertisement(), guildMusicManager.getGuild().getIconUrl()), 5, getChannel()); } @Override @@ -274,12 +274,12 @@ public void onTrackEnd(IPlayer player, AudioTrack track, AudioTrackEndReason end if (getChannel() != null) { Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder() - .setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), Data.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) + .setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), BotConfig.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuild(guildMusicManager.getGuild(), "label.musicPlayer")) .setThumbnail(guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) .setColor(Color.RED) .setDescription(LanguageService.getByGuild(guildMusicManager.getGuild(), "message.music.failedPlaying", FormatUtil.filter(track.getInfo().title), "Track does not exist (Internally?)")) - .setFooter(guildMusicManager.getGuild().getName() + " - " + Data.getAdvertisement(), guildMusicManager.getGuild().getIconUrl()), 5, getChannel()); + .setFooter(guildMusicManager.getGuild().getName() + " - " + BotConfig.getAdvertisement(), guildMusicManager.getGuild().getIconUrl()), 5, getChannel()); } nextTrack(getChannel(), track.getSourceManager() instanceof LocalAudioSourceManager); @@ -290,12 +290,12 @@ public void onTrackEnd(IPlayer player, AudioTrack track, AudioTrackEndReason end if (getChannel() != null) { Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder() - .setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), Data.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) + .setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), BotConfig.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuild(guildMusicManager.getGuild(), "label.musicPlayer")) .setThumbnail(guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) .setColor(Color.RED) .setDescription(LanguageService.getByGuild(guildMusicManager.getGuild(), "message.music.failedPlaying", FormatUtil.filter(track.getInfo().title), endReason.name())) - .setFooter(guildMusicManager.getGuild().getName() + " - " + Data.getAdvertisement(), guildMusicManager.getGuild().getIconUrl()), 5, getChannel()); + .setFooter(guildMusicManager.getGuild().getName() + " - " + BotConfig.getAdvertisement(), guildMusicManager.getGuild().getIconUrl()), 5, getChannel()); } nextTrack(getChannel(), track.getSourceManager() instanceof LocalAudioSourceManager); @@ -311,12 +311,12 @@ public void onTrackEnd(IPlayer player, AudioTrack track, AudioTrackEndReason end if (endReason == AudioTrackEndReason.LOAD_FAILED && getChannel() != null) { Main.getInstance().getEventBus().post(new MusicPlayerStateChangeEvent(guildMusicManager.getGuild(), MusicPlayerStateChangeEvent.State.ERROR, null)); Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder() - .setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), Data.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) + .setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), BotConfig.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuild(guildMusicManager.getGuild(), "label.musicPlayer")) .setThumbnail(guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()) .setColor(Color.RED) .setDescription(LanguageService.getByGuild(guildMusicManager.getGuild(), "message.music.failedPlaying", FormatUtil.filter(track.getInfo().title), endReason.name())) - .setFooter(guildMusicManager.getGuild().getName() + " - " + Data.getAdvertisement(), guildMusicManager.getGuild().getIconUrl()), 5, getChannel()); + .setFooter(guildMusicManager.getGuild().getName() + " - " + BotConfig.getAdvertisement(), guildMusicManager.getGuild().getIconUrl()), 5, getChannel()); } nextTrack(getChannel(), track.getSourceManager() instanceof LocalAudioSourceManager); } @@ -339,20 +339,20 @@ public void stopAll(InteractionHook interactionHook) { guildMusicManager.getScheduler().clearQueue(); Main.getInstance().getMusicWorker().disconnect(guildMusicManager.getGuild()); - em.setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), Data.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()); + em.setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), BotConfig.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()); em.setTitle(LanguageService.getByGuild(guildMusicManager.getGuild(), "label.musicPlayer")); em.setThumbnail(guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()); em.setColor(Color.GREEN); em.setDescription(LanguageService.getByGuild(guildMusicManager.getGuild(), "message.music.stop")); } else { - em.setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), Data.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()); + em.setAuthor(guildMusicManager.getGuild().getSelfMember().getEffectiveName(), BotConfig.getWebsite(), guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()); em.setTitle(LanguageService.getByGuild(guildMusicManager.getGuild(), "label.musicPlayer")); em.setThumbnail(guildMusicManager.getGuild().getSelfMember().getEffectiveAvatarUrl()); em.setColor(Color.RED); em.setDescription(LanguageService.getByGuild(guildMusicManager.getGuild(), "message.music.notPlaying")); } - em.setFooter(Data.getAdvertisement()); + em.setFooter(BotConfig.getAdvertisement()); Main.getInstance().getCommandManager().sendMessage(em, 5, getChannel(), interactionHook); } } \ No newline at end of file diff --git a/src/main/java/de/presti/ree6/utils/data/Data.java b/src/main/java/de/presti/ree6/bot/BotConfig.java similarity index 81% rename from src/main/java/de/presti/ree6/utils/data/Data.java rename to src/main/java/de/presti/ree6/bot/BotConfig.java index 5b97bab19..7197157a0 100644 --- a/src/main/java/de/presti/ree6/utils/data/Data.java +++ b/src/main/java/de/presti/ree6/bot/BotConfig.java @@ -1,16 +1,16 @@ -package de.presti.ree6.utils.data; +package de.presti.ree6.bot; import de.presti.ree6.main.Main; /** * Utility class to save long term used Data. */ -public class Data { +public class BotConfig { /** * Constructor for the Data Utility class. */ - private Data() { + private BotConfig() { throw new IllegalStateException("Utility class"); } @@ -174,5 +174,37 @@ public static boolean isDebug() { public static boolean shouldUseLavaLink() { return Main.getInstance().getConfig().getConfiguration().getBoolean("lavalink.enable", false); } + + /** + * Check if the leveling progress should be reset on mute. + * @return if the leveling progress should be reset on mute. + */ + public static boolean shouldResetOnMute() { + return Main.getInstance().getConfig().getConfiguration().getBoolean("bot.misc.leveling.resets.mute", true); + } + + /** + * Check if the leveling progress should be reset on global mute. + * @return if the leveling progress should be reset on global mute. + */ + public static boolean shouldResetOnMuteGlobal() { + return Main.getInstance().getConfig().getConfiguration().getBoolean("bot.misc.leveling.resets.muteGlobal", true); + } + + /** + * Check if the leveling progress should be reset on deafen. + * @return if the leveling progress should be reset on deafen. + */ + public static boolean shouldResetOnDeafen() { + return Main.getInstance().getConfig().getConfiguration().getBoolean("bot.misc.leveling.resets.deafen", true); + } + + /** + * Check if the leveling progress should be reset on global deafen. + * @return if the leveling progress should be reset on global deafen. + */ + public static boolean shouldResetOnDeafenGlobal() { + return Main.getInstance().getConfig().getConfiguration().getBoolean("bot.misc.leveling.resets.deafenGlobal", true); + } } diff --git a/src/main/java/de/presti/ree6/bot/BotWorker.java b/src/main/java/de/presti/ree6/bot/BotWorker.java index e471b9467..49920911e 100644 --- a/src/main/java/de/presti/ree6/bot/BotWorker.java +++ b/src/main/java/de/presti/ree6/bot/BotWorker.java @@ -3,7 +3,6 @@ import de.presti.ree6.bot.version.BotState; import de.presti.ree6.bot.version.BotVersion; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; import lombok.Getter; import lombok.Setter; import lombok.extern.slf4j.Slf4j; @@ -92,14 +91,14 @@ public static void createBot(BotVersion version1, int shardAmount) { .setMemberCachePolicy(MemberCachePolicy.ALL) .disableCache(CacheFlag.EMOJI, CacheFlag.ACTIVITY); - if (Data.shouldUseLavaLink()) { + if (BotConfig.shouldUseLavaLink()) { defaultShardManagerBuilder.addEventListeners(Main.getInstance().getLavalink()); defaultShardManagerBuilder.setVoiceDispatchInterceptor(Main.getInstance().getLavalink().getVoiceInterceptor()); } shardManager = defaultShardManagerBuilder.build(); - if (Data.shouldUseLavaLink() && Main.getInstance().getLavalink().getNodes().isEmpty()) { + if (BotConfig.shouldUseLavaLink() && Main.getInstance().getLavalink().getNodes().isEmpty()) { Main.getInstance().getLavalink().setUserId(shardManager.getShardById(0).getSelfUser().getId()); } } @@ -185,7 +184,7 @@ public static BotVersion getVersion() { */ public static String getBuild() { if (build == null) { - build = Objects.requireNonNullElse(Main.class.getPackage().getImplementationVersion(), "3.0.15"); + build = Objects.requireNonNullElse(Main.class.getPackage().getImplementationVersion(), "3.0.17"); } return build; } diff --git a/src/main/java/de/presti/ree6/commands/CommandManager.java b/src/main/java/de/presti/ree6/commands/CommandManager.java index 6a37307e0..6c07f5cb0 100644 --- a/src/main/java/de/presti/ree6/commands/CommandManager.java +++ b/src/main/java/de/presti/ree6/commands/CommandManager.java @@ -6,9 +6,10 @@ import de.presti.ree6.language.LanguageService; import de.presti.ree6.main.Main; import de.presti.ree6.sql.SQLSession; +import de.presti.ree6.sql.entities.Setting; import de.presti.ree6.sql.entities.custom.CustomCommand; import de.presti.ree6.utils.data.ArrayUtil; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.others.ThreadUtil; import lombok.AccessLevel; import lombok.Getter; @@ -73,14 +74,14 @@ public CommandManager() throws CommandInitializerException, InstantiationExcepti for (Class aClass : classes) { Command commandAnnotation = aClass.getAnnotation(Command.class); - if (!Data.isModuleActive(commandAnnotation.category().getDescription().substring(9).toLowerCase())) continue; + if (!BotConfig.isModuleActive(commandAnnotation.category().getDescription().substring(9).toLowerCase())) continue; log.info("Loading Command {}", aClass.getSimpleName()); addCommand(aClass.getDeclaredConstructor().newInstance()); } - if (!Data.isModuleActive("ai")) return; + if (!BotConfig.isModuleActive("ai")) return; StringBuilder stringBuilder = new StringBuilder(); @@ -183,7 +184,7 @@ private String convertOptionsToString(List list) { * @param jda Instance of the Bot. */ public void addSlashCommand(JDA jda) { - if (!Data.isModuleActive("slashcommands")) return; + if (!BotConfig.isModuleActive("slashcommands")) return; CommandListUpdateAction listUpdateAction = jda.updateCommands(); @@ -326,24 +327,24 @@ public boolean perform(Member member, Guild guild, String messageContent, Messag // Check if it is a Slash Command. if (slashCommandInteractionEvent != null) { - if (!Data.isModuleActive("slashcommands")) return false; + if (!BotConfig.isModuleActive("slashcommands")) return false; if (!performSlashCommand(textChannel, slashCommandInteractionEvent)) { return false; } } else { - if (!Data.isModuleActive("messagecommands")) return false; + if (!BotConfig.isModuleActive("messagecommands")) return false; if (!performMessageCommand(member, guild, messageContent, message, textChannel)) { return false; } } // Check if this is a Developer build, if not then cooldown the User. - if (!Data.isDebug()) { + if (!BotConfig.isDebug()) { ThreadUtil.createThread(x -> ArrayUtil.commandCooldown.remove(member.getUser().getId()), null, Duration.ofSeconds(5), false, false); } // Add them to the Cooldown. - if (!ArrayUtil.commandCooldown.contains(member.getUser().getId()) && !Data.isDebug()) { + if (!ArrayUtil.commandCooldown.contains(member.getUser().getId()) && !BotConfig.isDebug()) { ArrayUtil.commandCooldown.add(member.getUser().getId()); } @@ -389,7 +390,7 @@ private boolean performMessageCommand(Member member, Guild guild, String message ICommand command = getCommandByName(arguments[0]); // Check if there is even a Command with that name. - if (command == null && Data.isModuleActive("customcommands")) { + if (command == null && BotConfig.isModuleActive("customcommands")) { CustomCommand customCommand = SQLSession.getSqlConnector().getSqlWorker().getEntity(new CustomCommand(), "FROM CustomCommand WHERE guildId=:gid AND name=:command", Map.of("gid", guild.getId(), "command", arguments[0].toLowerCase())); if (customCommand != null) { MessageChannelUnion messageChannelUnion = textChannel; @@ -417,11 +418,14 @@ private boolean performMessageCommand(Member member, Guild guild, String message return false; } - // Check if the Command is blacklisted. - if (!SQLSession.getSqlConnector().getSqlWorker().getSetting(guild.getId(), "command_" + command.getClass().getAnnotation(Command.class).name().toLowerCase()).getBooleanValue() && - command.getClass().getAnnotation(Command.class).category() != Category.HIDDEN) { - sendMessage(LanguageService.getByGuild(guild, "command.perform.blocked"), 5, textChannel, null); - return false; + if (command.getClass().getAnnotation(Command.class).category() != Category.HIDDEN) { + Setting blacklistSetting = SQLSession.getSqlConnector().getSqlWorker().getSetting(guild.getId(), "command_" + command.getClass().getAnnotation(Command.class).name().toLowerCase()); + + // Check if the Command is blacklisted. + if (blacklistSetting != null && !blacklistSetting.getBooleanValue()) { + sendMessage(LanguageService.getByGuild(guild, "command.perform.blocked"), 5, textChannel, null); + return false; + } } // Parse the arguments. @@ -469,7 +473,7 @@ private boolean performSlashCommand(MessageChannelUnion textChannel, SlashComman * @return true, if yes | false, if not. */ public boolean isTimeout(User user) { - return ArrayUtil.commandCooldown.contains(user.getId()) && !Data.isDebug(); + return ArrayUtil.commandCooldown.contains(user.getId()) && !BotConfig.isDebug(); } /** diff --git a/src/main/java/de/presti/ree6/commands/impl/community/InstagramNotifier.java b/src/main/java/de/presti/ree6/commands/impl/community/InstagramNotifier.java index 98e538993..174c70682 100644 --- a/src/main/java/de/presti/ree6/commands/impl/community/InstagramNotifier.java +++ b/src/main/java/de/presti/ree6/commands/impl/community/InstagramNotifier.java @@ -6,7 +6,7 @@ import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; import de.presti.ree6.sql.SQLSession; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.channel.ChannelType; import net.dv8tion.jda.api.entities.channel.middleman.StandardGuildMessageChannel; @@ -77,7 +77,7 @@ public void onPerform(CommandEvent commandEvent) { String name = nameMapping.getAsString(); StandardGuildMessageChannel channel = channelMapping.getAsChannel().asStandardGuildMessageChannel(); - channel.createWebhook(Data.getBotName() + "-InstagramNotifier-" + name).queue(w -> { + channel.createWebhook(BotConfig.getBotName() + "-InstagramNotifier-" + name).queue(w -> { if (messageMapping != null) { SQLSession.getSqlConnector().getSqlWorker().addInstagramWebhook(commandEvent.getGuild().getId(), channel.getIdLong(), w.getId(), w.getToken(), name.toLowerCase(), messageMapping.getAsString()); } else { diff --git a/src/main/java/de/presti/ree6/commands/impl/community/RSSNotifier.java b/src/main/java/de/presti/ree6/commands/impl/community/RSSNotifier.java index ea6b56c7d..66a13e6c4 100644 --- a/src/main/java/de/presti/ree6/commands/impl/community/RSSNotifier.java +++ b/src/main/java/de/presti/ree6/commands/impl/community/RSSNotifier.java @@ -6,7 +6,7 @@ import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; import de.presti.ree6.sql.SQLSession; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.data.RegExUtil; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.channel.ChannelType; @@ -84,7 +84,7 @@ public void onPerform(CommandEvent commandEvent) { } StandardGuildMessageChannel channel = channelMapping.getAsChannel().asStandardGuildMessageChannel(); - channel.createWebhook(Data.getBotName() + "-RSSNotifier-" + name).queue(w -> + channel.createWebhook(BotConfig.getBotName() + "-RSSNotifier-" + name).queue(w -> SQLSession.getSqlConnector().getSqlWorker().addRSSWebhook(commandEvent.getGuild().getId(), channel.getIdLong(), w.getId(), w.getToken(), name.toLowerCase())); commandEvent.reply(commandEvent.getResource("message.rssNotifier.added", name), 5); diff --git a/src/main/java/de/presti/ree6/commands/impl/community/RedditNotifier.java b/src/main/java/de/presti/ree6/commands/impl/community/RedditNotifier.java index 28480beb2..2adcc6331 100644 --- a/src/main/java/de/presti/ree6/commands/impl/community/RedditNotifier.java +++ b/src/main/java/de/presti/ree6/commands/impl/community/RedditNotifier.java @@ -6,7 +6,7 @@ import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; import de.presti.ree6.sql.SQLSession; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.channel.ChannelType; import net.dv8tion.jda.api.entities.channel.middleman.StandardGuildMessageChannel; @@ -71,7 +71,7 @@ public void onPerform(CommandEvent commandEvent) { String name = nameMapping.getAsString(); StandardGuildMessageChannel channel = channelMapping.getAsChannel().asStandardGuildMessageChannel(); - channel.createWebhook(Data.getBotName() + "-RedditNotifier-" + name).queue(w -> { + channel.createWebhook(BotConfig.getBotName() + "-RedditNotifier-" + name).queue(w -> { if (messageMapping != null) { SQLSession.getSqlConnector().getSqlWorker().addRedditWebhook(commandEvent.getGuild().getId(), channel.getIdLong(), w.getId(), w.getToken(), name.toLowerCase(), messageMapping.getAsString()); } else { diff --git a/src/main/java/de/presti/ree6/commands/impl/community/Schedule.java b/src/main/java/de/presti/ree6/commands/impl/community/Schedule.java index 60a0ba314..2cf8e8d13 100644 --- a/src/main/java/de/presti/ree6/commands/impl/community/Schedule.java +++ b/src/main/java/de/presti/ree6/commands/impl/community/Schedule.java @@ -7,7 +7,7 @@ import de.presti.ree6.sql.SQLSession; import de.presti.ree6.sql.entities.ScheduledMessage; import de.presti.ree6.sql.entities.webhook.WebhookScheduledMessage; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.Webhook; import net.dv8tion.jda.api.entities.channel.ChannelType; @@ -115,7 +115,7 @@ public void onPerform(CommandEvent commandEvent) { Map.of("gid", commandEvent.getGuild().getId(),"channel", guildChannel.getIdLong())); if (webhookScheduledMessage == null) { - Webhook webhook = guildChannel.asStandardGuildMessageChannel().createWebhook(Data.getBotName() + "-Schedule").complete(); + Webhook webhook = guildChannel.asStandardGuildMessageChannel().createWebhook(BotConfig.getBotName() + "-Schedule").complete(); webhookScheduledMessage = SQLSession.getSqlConnector().getSqlWorker() .updateEntity(new WebhookScheduledMessage(commandEvent.getGuild().getId(), guildChannel.getIdLong(), webhook.getId(), webhook.getToken())); diff --git a/src/main/java/de/presti/ree6/commands/impl/community/StreamActionCommand.java b/src/main/java/de/presti/ree6/commands/impl/community/StreamActionCommand.java index 624b00fe1..c4b8f3d91 100644 --- a/src/main/java/de/presti/ree6/commands/impl/community/StreamActionCommand.java +++ b/src/main/java/de/presti/ree6/commands/impl/community/StreamActionCommand.java @@ -13,7 +13,7 @@ import de.presti.ree6.sql.entities.TwitchIntegration; import de.presti.ree6.actions.streamtools.container.StreamActionContainer; import de.presti.ree6.actions.ActionInfo; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.interactions.commands.OptionMapping; import net.dv8tion.jda.api.interactions.commands.OptionType; @@ -179,7 +179,7 @@ public void onPerform(CommandEvent commandEvent) { SQLSession.getSqlConnector().getSqlWorker().updateEntity(streamAction); commandEvent.reply(commandEvent.getResource("message.stream-action.added", name.getAsString())); } else { - commandEvent.reply(commandEvent.getResource("message.stream-action.noTwitch", Data.getTwitchAuth())); + commandEvent.reply(commandEvent.getResource("message.stream-action.noTwitch", BotConfig.getTwitchAuth())); } } else { commandEvent.reply(commandEvent.getResource("message.stream-action.alreadyExisting", name.getAsString())); @@ -220,7 +220,7 @@ public void onPerform(CommandEvent commandEvent) { messageCreateBuilder.addFiles(FileUpload.fromData(stringBuilder.toString().getBytes(StandardCharsets.UTF_8), "points.txt")); commandEvent.reply(messageCreateBuilder.build()); } else { - commandEvent.reply(commandEvent.getResource("message.stream-action.noTwitch", Data.getTwitchAuth())); + commandEvent.reply(commandEvent.getResource("message.stream-action.noTwitch", BotConfig.getTwitchAuth())); } } diff --git a/src/main/java/de/presti/ree6/commands/impl/community/Ticket.java b/src/main/java/de/presti/ree6/commands/impl/community/Ticket.java index 90cf8a20d..914676a39 100644 --- a/src/main/java/de/presti/ree6/commands/impl/community/Ticket.java +++ b/src/main/java/de/presti/ree6/commands/impl/community/Ticket.java @@ -8,7 +8,7 @@ import de.presti.ree6.main.Main; import de.presti.ree6.sql.SQLSession; import de.presti.ree6.sql.entities.Tickets; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.channel.ChannelType; @@ -86,7 +86,7 @@ public void onPerform(CommandEvent commandEvent) { .setDescription(SQLSession.getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "message_ticket_menu").getStringValue()) .setColor(0x55ff00) .setThumbnail(commandEvent.getGuild().getIconUrl()) - .setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()) + .setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()) .build()); messageCreateBuilder.setActionRow(Button.of(ButtonStyle.PRIMARY, "re_ticket_open", LanguageService.getByGuild(commandEvent.getGuild(), "label.openTicket"), Emoji.fromUnicode("U+1F4E9"))); Main.getInstance().getCommandManager().sendMessage(messageCreateBuilder.build(), ticketChannel.getAsChannel().asTextChannel()); diff --git a/src/main/java/de/presti/ree6/commands/impl/community/TikTokNotifier.java b/src/main/java/de/presti/ree6/commands/impl/community/TikTokNotifier.java index 3b32fc096..cad002b10 100644 --- a/src/main/java/de/presti/ree6/commands/impl/community/TikTokNotifier.java +++ b/src/main/java/de/presti/ree6/commands/impl/community/TikTokNotifier.java @@ -6,7 +6,7 @@ import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; import de.presti.ree6.sql.SQLSession; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.wrapper.tiktok.TikTokWrapper; import de.presti.wrapper.tiktok.entities.TikTokUser; import net.dv8tion.jda.api.Permission; @@ -87,7 +87,7 @@ public void onPerform(CommandEvent commandEvent) { StandardGuildMessageChannel channel = channelMapping.getAsChannel().asStandardGuildMessageChannel(); - channel.createWebhook(Data.getBotName() + "-TikTokNotifier-" + name).queue(w -> { + channel.createWebhook(BotConfig.getBotName() + "-TikTokNotifier-" + name).queue(w -> { if (messageMapping != null) { SQLSession.getSqlConnector().getSqlWorker().addTikTokWebhook(commandEvent.getGuild().getId(), channel.getIdLong(), w.getId(), w.getToken(), tikTokUser.getId(), messageMapping.getAsString()); } else { diff --git a/src/main/java/de/presti/ree6/commands/impl/community/TwitchNotifier.java b/src/main/java/de/presti/ree6/commands/impl/community/TwitchNotifier.java index a95882869..c7c74d4c6 100644 --- a/src/main/java/de/presti/ree6/commands/impl/community/TwitchNotifier.java +++ b/src/main/java/de/presti/ree6/commands/impl/community/TwitchNotifier.java @@ -6,7 +6,7 @@ import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; import de.presti.ree6.sql.SQLSession; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.channel.ChannelType; import net.dv8tion.jda.api.entities.channel.middleman.StandardGuildMessageChannel; @@ -71,7 +71,7 @@ public void onPerform(CommandEvent commandEvent) { String name = nameMapping.getAsString(); StandardGuildMessageChannel channel = channelMapping.getAsChannel().asStandardGuildMessageChannel(); - channel.createWebhook(Data.getBotName() + "-TwitchNotifier-" + name).queue(w -> { + channel.createWebhook(BotConfig.getBotName() + "-TwitchNotifier-" + name).queue(w -> { if (messageMapping != null) { SQLSession.getSqlConnector().getSqlWorker().addTwitchWebhook(commandEvent.getGuild().getId(), channel.getIdLong(), w.getId(), w.getToken(), name.toLowerCase(), messageMapping.getAsString()); } else { diff --git a/src/main/java/de/presti/ree6/commands/impl/community/TwitterNotifier.java b/src/main/java/de/presti/ree6/commands/impl/community/TwitterNotifier.java index fc74fe4f9..83a7f5f2b 100644 --- a/src/main/java/de/presti/ree6/commands/impl/community/TwitterNotifier.java +++ b/src/main/java/de/presti/ree6/commands/impl/community/TwitterNotifier.java @@ -6,7 +6,7 @@ import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; import de.presti.ree6.sql.SQLSession; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.channel.ChannelType; import net.dv8tion.jda.api.entities.channel.middleman.StandardGuildMessageChannel; @@ -71,7 +71,7 @@ public void onPerform(CommandEvent commandEvent) { String name = nameMapping.getAsString(); StandardGuildMessageChannel channel = channelMapping.getAsChannel().asStandardGuildMessageChannel(); - channel.createWebhook(Data.getBotName() + "-TwitterNotifier-" + name).queue(w -> { + channel.createWebhook(BotConfig.getBotName() + "-TwitterNotifier-" + name).queue(w -> { if (messageMapping != null) { SQLSession.getSqlConnector().getSqlWorker().addTwitterWebhook(commandEvent.getGuild().getId(), channel.getIdLong(), w.getId(), w.getToken(), name.toLowerCase(), messageMapping.getAsString()); } else { diff --git a/src/main/java/de/presti/ree6/commands/impl/community/YouTubeNotifier.java b/src/main/java/de/presti/ree6/commands/impl/community/YouTubeNotifier.java index c440ef280..10fa15eba 100644 --- a/src/main/java/de/presti/ree6/commands/impl/community/YouTubeNotifier.java +++ b/src/main/java/de/presti/ree6/commands/impl/community/YouTubeNotifier.java @@ -7,7 +7,7 @@ import de.presti.ree6.main.Main; import de.presti.ree6.sql.SQLSession; import de.presti.ree6.utils.apis.YouTubeAPIHandler; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.wrapper.entities.channel.ChannelResult; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.channel.ChannelType; @@ -115,7 +115,7 @@ public void onPerform(CommandEvent commandEvent) { name = channelResult.getTitle(); StandardGuildMessageChannel channel = channelMapping.getAsChannel().asStandardGuildMessageChannel(); - channel.createWebhook(Data.getBotName() + "-YoutubeNotifier-" + name).queue(w -> { + channel.createWebhook(BotConfig.getBotName() + "-YoutubeNotifier-" + name).queue(w -> { if (messageMapping != null) { SQLSession.getSqlConnector().getSqlWorker().addYouTubeWebhook(commandEvent.getGuild().getId(), channel.getIdLong(), w.getId(), w.getToken(), channelResult.getId(), messageMapping.getAsString()); } else { diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/Anime.java b/src/main/java/de/presti/ree6/commands/impl/fun/Anime.java index bacf1fcb5..905126dd1 100644 --- a/src/main/java/de/presti/ree6/commands/impl/fun/Anime.java +++ b/src/main/java/de/presti/ree6/commands/impl/fun/Anime.java @@ -9,7 +9,7 @@ import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.language.LanguageService; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.external.RequestUtility; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Message; @@ -139,7 +139,7 @@ public void sendAnime(CommandEvent commandEvent, Message message, String query) em.addField(":stopwatch: **" + commandEvent.getResource("label.duration") + "**", duration, true); em.addField(":star: **" + commandEvent.getResource("label.averageRating") + "**", " **" + rating + "/100**", true); em.addField(":trophy: **" + commandEvent.getResource("label.rank") + "**", "**TOP " + rank + "**", true); - em.setFooter(commandEvent.getMember().getEffectiveName() + " - " + Data.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); + em.setFooter(commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); if (commandEvent.isSlashCommand()) { message.editMessage(commandEvent.getResource("message.anime.found")).queue(); diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/CatImage.java b/src/main/java/de/presti/ree6/commands/impl/fun/CatImage.java index 4c655269d..6763ecf14 100644 --- a/src/main/java/de/presti/ree6/commands/impl/fun/CatImage.java +++ b/src/main/java/de/presti/ree6/commands/impl/fun/CatImage.java @@ -6,7 +6,7 @@ import de.presti.ree6.commands.CommandEvent; import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.external.RequestUtility; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.build.CommandData; @@ -30,7 +30,7 @@ public void onPerform(CommandEvent commandEvent) { em.setTitle(commandEvent.getResource("label.randomCatImage")); em.setColor(BotWorker.randomEmbedColor()); em.setImage(js.get(0).getAsJsonObject().get("url").getAsString()); - em.setFooter("Requested by " + commandEvent.getMember().getEffectiveName() + " - " + Data.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); + em.setFooter("Requested by " + commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); commandEvent.reply(em.build()); } diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/DogImage.java b/src/main/java/de/presti/ree6/commands/impl/fun/DogImage.java index 3c5cf3b16..1afc0917b 100644 --- a/src/main/java/de/presti/ree6/commands/impl/fun/DogImage.java +++ b/src/main/java/de/presti/ree6/commands/impl/fun/DogImage.java @@ -6,7 +6,7 @@ import de.presti.ree6.commands.CommandEvent; import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.external.RequestUtility; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.build.CommandData; @@ -29,7 +29,7 @@ public void onPerform(CommandEvent commandEvent) { em.setTitle(commandEvent.getResource("label.randomDogImage")); em.setColor(BotWorker.randomEmbedColor()); em.setImage(js.get("message").getAsString()); - em.setFooter("Requested by " + commandEvent.getMember().getEffectiveName() + " - " + Data.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); + em.setFooter("Requested by " + commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); commandEvent.reply(em.build()); } diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/Manga.java b/src/main/java/de/presti/ree6/commands/impl/fun/Manga.java index 65b2ab968..e62390981 100644 --- a/src/main/java/de/presti/ree6/commands/impl/fun/Manga.java +++ b/src/main/java/de/presti/ree6/commands/impl/fun/Manga.java @@ -9,7 +9,7 @@ import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.language.LanguageService; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.external.RequestUtility; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Message; @@ -139,7 +139,7 @@ public void sendManga(CommandEvent commandEvent, Message message, String query) em.addField(":books: **" + commandEvent.getResource("label.volumes") + "**", volumes + "", true); em.addField(":star: **" + commandEvent.getResource("label.averageRating") + "**", " **" + rating + "/100**", true); em.addField(":trophy: **" + commandEvent.getResource("label.rank") + "**", "**TOP " + rank + "**", true); - em.setFooter(commandEvent.getMember().getEffectiveName() + " - " + Data.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); + em.setFooter(commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); if (commandEvent.isSlashCommand()) { message.editMessage(commandEvent.getResource("message.manga.found")).queue(); diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/MemeImage.java b/src/main/java/de/presti/ree6/commands/impl/fun/MemeImage.java index 91f668df5..f615fc279 100644 --- a/src/main/java/de/presti/ree6/commands/impl/fun/MemeImage.java +++ b/src/main/java/de/presti/ree6/commands/impl/fun/MemeImage.java @@ -6,7 +6,7 @@ import de.presti.ree6.commands.CommandEvent; import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.external.RequestUtility; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.build.CommandData; @@ -36,7 +36,7 @@ public void onPerform(CommandEvent commandEvent) { em.setDescription(commandEvent.getResource("message.default.retrievalError")); } - em.setFooter("Requested by " + commandEvent.getMember().getEffectiveName() + " - " + Data.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); + em.setFooter("Requested by " + commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); commandEvent.reply(em.build()); } diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/Monkey.java b/src/main/java/de/presti/ree6/commands/impl/fun/Monkey.java index 1320147d7..5c540366c 100644 --- a/src/main/java/de/presti/ree6/commands/impl/fun/Monkey.java +++ b/src/main/java/de/presti/ree6/commands/impl/fun/Monkey.java @@ -5,7 +5,7 @@ import de.presti.ree6.commands.CommandEvent; import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.build.CommandData; @@ -25,7 +25,7 @@ public void onPerform(CommandEvent commandEvent) { em.setTitle(commandEvent.getResource("label.monkey")); em.setColor(BotWorker.randomEmbedColor()); em.setImage("https://c.tenor.com/Y89PE1f7exQAAAAd/reject-modernity-return-to-monke.gif"); - em.setFooter("Requested by " + commandEvent.getMember().getEffectiveName() + " - " + Data.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); + em.setFooter("Requested by " + commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); commandEvent.reply(em.build()); } diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/PickUpLine.java b/src/main/java/de/presti/ree6/commands/impl/fun/PickUpLine.java index 5ba070c7f..979ec0a4b 100644 --- a/src/main/java/de/presti/ree6/commands/impl/fun/PickUpLine.java +++ b/src/main/java/de/presti/ree6/commands/impl/fun/PickUpLine.java @@ -6,7 +6,7 @@ import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.external.RequestUtility; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.build.CommandData; @@ -35,7 +35,7 @@ public void onPerform(CommandEvent commandEvent) { em.setTitle("Error!"); em.setColor(Color.RED); em.setDescription(commandEvent.getResource("message.default.retrievalError")); - em.setFooter(commandEvent.getMember().getEffectiveName() + " - " + Data.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); + em.setFooter(commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); commandEvent.reply(em.build()); return; } diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/ShibaImage.java b/src/main/java/de/presti/ree6/commands/impl/fun/ShibaImage.java index 24f7d103f..9ae1d1d78 100644 --- a/src/main/java/de/presti/ree6/commands/impl/fun/ShibaImage.java +++ b/src/main/java/de/presti/ree6/commands/impl/fun/ShibaImage.java @@ -7,7 +7,7 @@ import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.external.RequestUtility; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.build.CommandData; @@ -30,7 +30,7 @@ public void onPerform(CommandEvent commandEvent) { em.setTitle(commandEvent.getResource("label.randomShibaImage")); em.setColor(BotWorker.randomEmbedColor()); em.setImage(js.get(0).getAsString()); - em.setFooter("Requested by " + commandEvent.getMember().getEffectiveName() + " - " + Data.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); + em.setFooter("Requested by " + commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); Main.getInstance().getCommandManager().sendMessage(em, commandEvent.getChannel(), commandEvent.getInteractionHook()); } diff --git a/src/main/java/de/presti/ree6/commands/impl/fun/Waifu.java b/src/main/java/de/presti/ree6/commands/impl/fun/Waifu.java index c66bf1ac6..cbf91a18f 100644 --- a/src/main/java/de/presti/ree6/commands/impl/fun/Waifu.java +++ b/src/main/java/de/presti/ree6/commands/impl/fun/Waifu.java @@ -6,7 +6,7 @@ import de.presti.ree6.commands.CommandEvent; import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.external.RequestUtility; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.build.CommandData; @@ -34,7 +34,7 @@ public void onPerform(CommandEvent commandEvent) { em.setTitle(commandEvent.getResource("label.error")); em.setColor(Color.RED); em.setDescription(commandEvent.getResource("message.default.retrievalError")); - em.setFooter(commandEvent.getMember().getEffectiveName() + " - " + Data.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); + em.setFooter(commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); commandEvent.reply(em.build()); return; } @@ -88,7 +88,7 @@ public void onPerform(CommandEvent commandEvent) { em.addField("**" + commandEvent.getResource("label.from") + "**", "``" + from + "``", true); - em.setFooter(commandEvent.getMember().getEffectiveName() + " - " + Data.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); + em.setFooter(commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); commandEvent.reply(em.build()); } diff --git a/src/main/java/de/presti/ree6/commands/impl/hidden/Addon.java b/src/main/java/de/presti/ree6/commands/impl/hidden/Addon.java index 0ce1d558b..caf997154 100644 --- a/src/main/java/de/presti/ree6/commands/impl/hidden/Addon.java +++ b/src/main/java/de/presti/ree6/commands/impl/hidden/Addon.java @@ -6,7 +6,7 @@ import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import io.sentry.Sentry; import net.dv8tion.jda.api.interactions.commands.OptionType; import net.dv8tion.jda.api.interactions.commands.build.CommandData; @@ -26,7 +26,7 @@ public class Addon implements ICommand { */ @Override public void onPerform(CommandEvent commandEvent) { - if (!commandEvent.getMember().getUser().getId().equalsIgnoreCase(Data.getBotOwner())) { + if (!commandEvent.getMember().getUser().getId().equalsIgnoreCase(BotConfig.getBotOwner())) { commandEvent.reply(commandEvent.getResource("message.default.insufficientPermission", "BE DEVELOPER"), 5); return; } diff --git a/src/main/java/de/presti/ree6/commands/impl/hidden/Announcement.java b/src/main/java/de/presti/ree6/commands/impl/hidden/Announcement.java index 282001e8b..fe6dd6d0e 100644 --- a/src/main/java/de/presti/ree6/commands/impl/hidden/Announcement.java +++ b/src/main/java/de/presti/ree6/commands/impl/hidden/Announcement.java @@ -6,7 +6,7 @@ import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.language.LanguageService; import de.presti.ree6.news.AnnouncementManager; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.others.RandomUtils; import net.dv8tion.jda.api.interactions.commands.OptionMapping; import net.dv8tion.jda.api.interactions.commands.OptionType; @@ -26,7 +26,7 @@ public class Announcement implements ICommand { @Override public void onPerform(CommandEvent commandEvent) { - if (!commandEvent.getMember().getUser().getId().equalsIgnoreCase(Data.getBotOwner())) { + if (!commandEvent.getMember().getUser().getId().equalsIgnoreCase(BotConfig.getBotOwner())) { commandEvent.reply(commandEvent.getResource("message.default.insufficientPermission", "BE DEVELOPER"), 5); return; } diff --git a/src/main/java/de/presti/ree6/commands/impl/hidden/Test.java b/src/main/java/de/presti/ree6/commands/impl/hidden/Test.java index 41e8589ce..f00405560 100644 --- a/src/main/java/de/presti/ree6/commands/impl/hidden/Test.java +++ b/src/main/java/de/presti/ree6/commands/impl/hidden/Test.java @@ -4,7 +4,8 @@ import de.presti.ree6.commands.CommandEvent; import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.utils.data.ArrayUtil; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.interactions.commands.build.CommandData; /** @@ -18,12 +19,12 @@ public class Test implements ICommand { */ @Override public void onPerform(CommandEvent commandEvent) { - if (!commandEvent.getMember().getUser().getId().equalsIgnoreCase(Data.getBotOwner())) { + if (!commandEvent.getMember().getUser().getId().equalsIgnoreCase(BotConfig.getBotOwner())) { commandEvent.reply(commandEvent.getResource("message.default.insufficientPermission", "BE DEVELOPER"), 5); return; } - commandEvent.reply("Nothing to test rn."); + commandEvent.reply("Contains: " + ArrayUtil.voiceJoined.containsKey(commandEvent.getMember()) + " - " + ArrayUtil.voiceJoined.size() + " - " + ArrayUtil.voiceJoined); } /** diff --git a/src/main/java/de/presti/ree6/commands/impl/info/Help.java b/src/main/java/de/presti/ree6/commands/impl/info/Help.java index c08d8c76e..1e209bbe7 100644 --- a/src/main/java/de/presti/ree6/commands/impl/info/Help.java +++ b/src/main/java/de/presti/ree6/commands/impl/info/Help.java @@ -8,7 +8,7 @@ import de.presti.ree6.language.LanguageService; import de.presti.ree6.main.Main; import de.presti.ree6.sql.SQLSession; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.emoji.Emoji; import net.dv8tion.jda.api.interactions.commands.OptionMapping; @@ -64,7 +64,7 @@ public void sendHelpInformation(String categoryString, CommandEvent commandEvent em.setColor(BotWorker.randomEmbedColor()); em.setTitle("Help Center"); em.setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); - em.setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()); + em.setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()); if (categoryString == null) { String prefix = SQLSession.getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "chatprefix").getStringValue(); for (Category cat : Category.values()) { @@ -99,11 +99,11 @@ public void sendHelpInformation(String categoryString, CommandEvent commandEvent messageCreateBuilder .addActionRow( - Button.of(ButtonStyle.LINK, Data.getInvite(), commandEvent.getResource("label.invite"), + Button.of(ButtonStyle.LINK, BotConfig.getInvite(), commandEvent.getResource("label.invite"), Emoji.fromCustom("re_icon_invite", 1019234807844175945L, false)), - Button.of(ButtonStyle.LINK, Data.getSupport(), commandEvent.getResource("label.support"), + Button.of(ButtonStyle.LINK, BotConfig.getSupport(), commandEvent.getResource("label.support"), Emoji.fromCustom("re_icon_help", 1019234684745564170L, false)), - Button.of(ButtonStyle.LINK, Data.getGithub(), commandEvent.getResource("label.github"), + Button.of(ButtonStyle.LINK, BotConfig.getGithub(), commandEvent.getResource("label.github"), Emoji.fromCustom("re_icon_github", 492259724079792138L, false)), Button.of(ButtonStyle.SECONDARY, "re_feedback", commandEvent.getResource("label.feedback"), Emoji.fromCustom("kiss", 1012765976951009361L, true)) diff --git a/src/main/java/de/presti/ree6/commands/impl/info/Info.java b/src/main/java/de/presti/ree6/commands/impl/info/Info.java index 8e3a64c1c..a6dd4c092 100644 --- a/src/main/java/de/presti/ree6/commands/impl/info/Info.java +++ b/src/main/java/de/presti/ree6/commands/impl/info/Info.java @@ -5,7 +5,7 @@ import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.language.LanguageService; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.others.UserUtil; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Member; @@ -89,7 +89,7 @@ public void sendInfo(Member member, CommandEvent commandEvent) { em.addField("**Created Date**", member.getTimeCreated().toLocalDate().format(DateTimeFormatter.ofPattern("dd.MM.yyyy")), true); em.addField("**Joined Date**", member.getTimeJoined().toLocalDate().format(DateTimeFormatter.ofPattern("dd.MM.yyyy")), true); - em.setFooter("Requested by " + commandEvent.getMember().getEffectiveName() + " - " + Data.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); + em.setFooter("Requested by " + commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); commandEvent.reply(em.build()); } diff --git a/src/main/java/de/presti/ree6/commands/impl/info/Invite.java b/src/main/java/de/presti/ree6/commands/impl/info/Invite.java index f57084168..87cbc1336 100644 --- a/src/main/java/de/presti/ree6/commands/impl/info/Invite.java +++ b/src/main/java/de/presti/ree6/commands/impl/info/Invite.java @@ -4,7 +4,7 @@ import de.presti.ree6.commands.CommandEvent; import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.entities.emoji.Emoji; import net.dv8tion.jda.api.interactions.commands.build.CommandData; import net.dv8tion.jda.api.interactions.components.buttons.Button; @@ -23,7 +23,7 @@ public class Invite implements ICommand { @Override public void onPerform(CommandEvent commandEvent) { MessageCreateBuilder messageCreateBuilder = new MessageCreateBuilder(); - messageCreateBuilder.addActionRow(Button.of(ButtonStyle.LINK, Data.getInvite(), commandEvent.getResource("label.invite"), + messageCreateBuilder.addActionRow(Button.of(ButtonStyle.LINK, BotConfig.getInvite(), commandEvent.getResource("label.invite"), Emoji.fromCustom("re_icon_invite", 1019234807844175945L, false))); commandEvent.reply(messageCreateBuilder.build()); } diff --git a/src/main/java/de/presti/ree6/commands/impl/info/Server.java b/src/main/java/de/presti/ree6/commands/impl/info/Server.java index b9ff1beae..fabb78e89 100644 --- a/src/main/java/de/presti/ree6/commands/impl/info/Server.java +++ b/src/main/java/de/presti/ree6/commands/impl/info/Server.java @@ -5,7 +5,7 @@ import de.presti.ree6.commands.CommandEvent; import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.others.UserUtil; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.Permission; @@ -48,7 +48,7 @@ public void onPerform(CommandEvent commandEvent) { em.addField(":busts_in_silhouette: **" + commandEvent.getResource("label.members") + " (" + commandEvent.getGuild().getMemberCount() + ")**", "**" + (commandEvent.getGuild().getMemberCount() - (commandEvent.getGuild().getMembers().stream().filter(member -> !member.getUser().isBot())).count()) + "** User\n**" + commandEvent.getGuild().getBoostCount() + "** Boosts :sparkles:", true); em.addField(":speech_balloon: **" + commandEvent.getResource("label.channels") + " (" + (commandEvent.getGuild().getChannels().stream().filter(channel -> channel.getType().equals(ChannelType.TEXT)).count() + commandEvent.getGuild().getChannels().stream().filter(channel -> channel.getType().equals(ChannelType.VOICE)).count()) + ")**", "**" + commandEvent.getGuild().getChannels().stream().filter(channel -> channel.getType().equals(ChannelType.TEXT)).count() + "** Text | **" + commandEvent.getGuild().getChannels().stream().filter(channel -> channel.getType().equals(ChannelType.VOICE)).count() + "** Voicechannel", true); em.addField(":earth_africa: **" + commandEvent.getResource("label.other") + "**", "**" + commandEvent.getResource("label.verificationLevel") + ":** " + commandEvent.getGuild().getVerificationLevel().getKey(), true); - em.setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()); + em.setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()); commandEvent.reply(em.build()); } else diff --git a/src/main/java/de/presti/ree6/commands/impl/info/Stats.java b/src/main/java/de/presti/ree6/commands/impl/info/Stats.java index f3b1af19b..770b53851 100644 --- a/src/main/java/de/presti/ree6/commands/impl/info/Stats.java +++ b/src/main/java/de/presti/ree6/commands/impl/info/Stats.java @@ -9,7 +9,7 @@ import de.presti.ree6.sql.SQLSession; import de.presti.ree6.sql.entities.stats.CommandStats; import de.presti.ree6.sql.entities.stats.GuildCommandStats; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.others.TimeUtil; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.entities.Message; @@ -48,7 +48,7 @@ public void onPerform(CommandEvent commandEvent) { EmbedBuilder em = new EmbedBuilder(); - em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setTitle(commandEvent.getResource("label.statistics")); em.setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); @@ -89,7 +89,7 @@ public void onPerform(CommandEvent commandEvent) { em.addField("**" + commandEvent.getResource("label.topCommands") + "**", end.toString(), true); em.addField("**" + commandEvent.getResource("label.overallTopCommands") + "**", end2.toString(), true); - em.setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()); + em.setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()); MessageEditBuilder messageEditBuilder = new MessageEditBuilder(); diff --git a/src/main/java/de/presti/ree6/commands/impl/info/Support.java b/src/main/java/de/presti/ree6/commands/impl/info/Support.java index 996a17bb1..ee8490846 100644 --- a/src/main/java/de/presti/ree6/commands/impl/info/Support.java +++ b/src/main/java/de/presti/ree6/commands/impl/info/Support.java @@ -4,7 +4,7 @@ import de.presti.ree6.commands.CommandEvent; import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.entities.emoji.Emoji; import net.dv8tion.jda.api.interactions.commands.build.CommandData; import net.dv8tion.jda.api.interactions.components.buttons.Button; @@ -23,7 +23,7 @@ public class Support implements ICommand { @Override public void onPerform(CommandEvent commandEvent) { MessageCreateBuilder messageCreateBuilder = new MessageCreateBuilder(); - messageCreateBuilder.addActionRow(Button.of(ButtonStyle.LINK, Data.getSupport(), commandEvent.getResource("label.support"), + messageCreateBuilder.addActionRow(Button.of(ButtonStyle.LINK, BotConfig.getSupport(), commandEvent.getResource("label.support"), Emoji.fromCustom("re_icon_help", 1019234684745564170L, false))); commandEvent.reply(messageCreateBuilder.build()); } diff --git a/src/main/java/de/presti/ree6/commands/impl/level/Leaderboards.java b/src/main/java/de/presti/ree6/commands/impl/level/Leaderboards.java index 15b3c639e..a58822653 100644 --- a/src/main/java/de/presti/ree6/commands/impl/level/Leaderboards.java +++ b/src/main/java/de/presti/ree6/commands/impl/level/Leaderboards.java @@ -4,7 +4,7 @@ import de.presti.ree6.commands.CommandEvent; import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.interactions.commands.build.CommandData; import net.dv8tion.jda.api.interactions.components.buttons.Button; import net.dv8tion.jda.api.utils.messages.MessageCreateBuilder; @@ -24,8 +24,8 @@ public void onPerform(CommandEvent commandEvent) { messageCreateBuilder.setContent(commandEvent.getResource("message.leaderboards")); messageCreateBuilder.addActionRow( Button.link("https://support-dev.discord.com/hc/de/articles/360043053492-Statistics-Bot-Policy", commandEvent.getResource("label.discordGuidelines")), - Button.link(Data.getWebinterface() + "/dash/" + commandEvent.getGuild().getId() + "/leaderboards", commandEvent.getResource("label.chatLeaderboard")), - Button.link(Data.getWebinterface() + "/dash/" + commandEvent.getGuild().getId() + "/leaderboards", commandEvent.getResource("label.voiceLeaderboard")) + Button.link(BotConfig.getWebinterface() + "/dash/" + commandEvent.getGuild().getId() + "/leaderboards", commandEvent.getResource("label.chatLeaderboard")), + Button.link(BotConfig.getWebinterface() + "/dash/" + commandEvent.getGuild().getId() + "/leaderboards", commandEvent.getResource("label.voiceLeaderboard")) ); commandEvent.reply(messageCreateBuilder.build()); } diff --git a/src/main/java/de/presti/ree6/commands/impl/mod/Setup.java b/src/main/java/de/presti/ree6/commands/impl/mod/Setup.java index ce8f0b7d0..1ead13b00 100644 --- a/src/main/java/de/presti/ree6/commands/impl/mod/Setup.java +++ b/src/main/java/de/presti/ree6/commands/impl/mod/Setup.java @@ -7,7 +7,7 @@ import de.presti.ree6.main.Main; import de.presti.ree6.sql.SQLSession; import de.presti.ree6.sql.entities.Setting; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.Message; @@ -69,7 +69,7 @@ public void onPerform(CommandEvent commandEvent) { EmbedBuilder embedBuilder = new EmbedBuilder() .setTitle(commandEvent.getResource("label.setup")) - .setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()) + .setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()) .setColor(Color.cyan) .setDescription(commandEvent.getResource("message.setup.setupMenu")); diff --git a/src/main/java/de/presti/ree6/commands/impl/mod/Suggestion.java b/src/main/java/de/presti/ree6/commands/impl/mod/Suggestion.java index dfa8bc643..edf1e532b 100644 --- a/src/main/java/de/presti/ree6/commands/impl/mod/Suggestion.java +++ b/src/main/java/de/presti/ree6/commands/impl/mod/Suggestion.java @@ -8,7 +8,7 @@ import de.presti.ree6.main.Main; import de.presti.ree6.sql.SQLSession; import de.presti.ree6.sql.entities.Suggestions; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.entities.channel.ChannelType; @@ -36,7 +36,7 @@ public class Suggestion implements ICommand { */ @Override public void onPerform(CommandEvent commandEvent) { - if (!Data.isModuleActive("suggestions")) { + if (!BotConfig.isModuleActive("suggestions")) { commandEvent.reply("Suggestions module disabled!", 5); return; } @@ -78,7 +78,7 @@ public void createSuggestions(CommandEvent commandEvent, MessageChannel channel, embedBuilder.setTitle(commandEvent.getResource("label.suggestionMenu")); embedBuilder.setColor(Color.ORANGE); embedBuilder.setDescription(SQLSession.getSqlConnector().getSqlWorker().getSetting(commandEvent.getGuild().getId(), "message_suggestion_menu").getStringValue()); - embedBuilder.setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()); + embedBuilder.setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()); messageCreateBuilder.setEmbeds(embedBuilder.build()); messageCreateBuilder.setActionRow(Button.primary("re_suggestion", commandEvent.getResource("message.suggestion.suggestionMenuPlaceholder"))); diff --git a/src/main/java/de/presti/ree6/commands/impl/mod/Webinterface.java b/src/main/java/de/presti/ree6/commands/impl/mod/Webinterface.java index 9ff0a1841..81efc9f7b 100644 --- a/src/main/java/de/presti/ree6/commands/impl/mod/Webinterface.java +++ b/src/main/java/de/presti/ree6/commands/impl/mod/Webinterface.java @@ -4,7 +4,7 @@ import de.presti.ree6.commands.CommandEvent; import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.interactions.commands.build.CommandData; import net.dv8tion.jda.api.interactions.components.buttons.Button; import net.dv8tion.jda.api.utils.messages.MessageCreateBuilder; @@ -21,7 +21,7 @@ public class Webinterface implements ICommand { @Override public void onPerform(CommandEvent commandEvent) { MessageCreateBuilder messageCreateBuilder = new MessageCreateBuilder(); - messageCreateBuilder.addActionRow(Button.link(Data.getWebinterface(), commandEvent.getResource("label.webinterface"))); + messageCreateBuilder.addActionRow(Button.link(BotConfig.getWebinterface(), commandEvent.getResource("label.webinterface"))); commandEvent.reply(messageCreateBuilder.build()); } diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Clearqueue.java b/src/main/java/de/presti/ree6/commands/impl/music/Clearqueue.java index fe32e99b6..689fdc630 100644 --- a/src/main/java/de/presti/ree6/commands/impl/music/Clearqueue.java +++ b/src/main/java/de/presti/ree6/commands/impl/music/Clearqueue.java @@ -5,7 +5,7 @@ import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.build.CommandData; @@ -29,13 +29,13 @@ public void onPerform(CommandEvent commandEvent) { EmbedBuilder em = new EmbedBuilder(); - em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setTitle(commandEvent.getResource("label.musicPlayer")); em.setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setColor(Color.GREEN); em.setDescription(commandEvent.getResource("message.music.clearQueue")); - em.setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()); + em.setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()); commandEvent.reply(em.build(), 5); Main.getInstance().getMusicWorker().getGuildAudioPlayer(commandEvent.getGuild()).getScheduler().clearQueue(); diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Disconnect.java b/src/main/java/de/presti/ree6/commands/impl/music/Disconnect.java index 674d553f0..06d3093a9 100644 --- a/src/main/java/de/presti/ree6/commands/impl/music/Disconnect.java +++ b/src/main/java/de/presti/ree6/commands/impl/music/Disconnect.java @@ -5,7 +5,7 @@ import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.build.CommandData; @@ -32,13 +32,13 @@ public void onPerform(CommandEvent commandEvent) { } else { EmbedBuilder em = new EmbedBuilder(); - em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setTitle(commandEvent.getResource("label.musicPlayer")); em.setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setColor(Color.RED); em.setDescription(commandEvent.getResource("message.music.notPlaying")); - em.setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()); + em.setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()); commandEvent.reply(em.build(), 5); } diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Loop.java b/src/main/java/de/presti/ree6/commands/impl/music/Loop.java index 32b6ffec9..0f9e2ea32 100644 --- a/src/main/java/de/presti/ree6/commands/impl/music/Loop.java +++ b/src/main/java/de/presti/ree6/commands/impl/music/Loop.java @@ -5,7 +5,7 @@ import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.build.CommandData; @@ -33,7 +33,7 @@ public void onPerform(CommandEvent commandEvent) { EmbedBuilder em = new EmbedBuilder(); - em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setTitle(commandEvent.getResource("label.musicPlayer")); em.setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); @@ -41,7 +41,7 @@ public void onPerform(CommandEvent commandEvent) { em.setDescription(Main.getInstance().getMusicWorker().getGuildAudioPlayer(commandEvent.getGuild()).getScheduler().loop() ? commandEvent.getResource("message.music.loop.enabled") : commandEvent.getResource("message.music.loop.disabled")); - em.setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()); + em.setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()); commandEvent.reply(em.build(), 5); } diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Lyrics.java b/src/main/java/de/presti/ree6/commands/impl/music/Lyrics.java index b35f638b3..cfd10f4b8 100644 --- a/src/main/java/de/presti/ree6/commands/impl/music/Lyrics.java +++ b/src/main/java/de/presti/ree6/commands/impl/music/Lyrics.java @@ -7,7 +7,7 @@ import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.others.FormatUtil; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.build.CommandData; @@ -46,11 +46,11 @@ public void onPerform(CommandEvent commandEvent) { client.getLyrics(title).thenAccept(lyrics -> { if (lyrics == null) { - commandEvent.reply(new EmbedBuilder().setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + commandEvent.reply(new EmbedBuilder().setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()).setTitle(commandEvent.getResource("label.musicPlayer")) .setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()).setColor(Color.RED) .setDescription(commandEvent.getResource("message.music.lyrics.notFound", "``" + FormatUtil.filter(title) + "``")) - .setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()).build(), 5); + .setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()).build(), 5); return; } @@ -72,7 +72,7 @@ public void onPerform(CommandEvent commandEvent) { commandEvent.reply(eb.setDescription(content.substring(0, index).trim()).build()); content = content.substring(index).trim(); eb.setAuthor(null).setTitle(null, null); - eb.setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()); + eb.setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()); } commandEvent.reply(eb.setDescription(content).build()); diff --git a/src/main/java/de/presti/ree6/commands/impl/music/MusicPanel.java b/src/main/java/de/presti/ree6/commands/impl/music/MusicPanel.java index e5f4d260e..4bd20d8cd 100644 --- a/src/main/java/de/presti/ree6/commands/impl/music/MusicPanel.java +++ b/src/main/java/de/presti/ree6/commands/impl/music/MusicPanel.java @@ -1,7 +1,6 @@ package de.presti.ree6.commands.impl.music; import best.azura.eventbus.handler.EventHandler; -import best.azura.eventbus.handler.ListenerHandler; import com.sedmelluq.discord.lavaplayer.track.AudioTrackInfo; import de.presti.ree6.api.events.MusicPlayerStateChangeEvent; import de.presti.ree6.audio.music.GuildMusicManager; @@ -12,7 +11,7 @@ import de.presti.ree6.language.LanguageService; import de.presti.ree6.main.Main; import de.presti.ree6.utils.data.ArrayUtil; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.others.FormatUtil; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.Permission; @@ -100,7 +99,7 @@ public void onPerform(CommandEvent commandEvent) { .setImage(audioTrackInfo != null && (audioTrackInfo.artworkUrl != null && !audioTrackInfo.artworkUrl.isBlank()) ? audioTrackInfo.artworkUrl : "https://images.unsplash.com/photo-1546977463-943d58b78c19") .setTitle("**" + (audioTrackInfo != null ? commandEvent.getResource("message.music.songInfoSlim", audioTrackInfo.title, audioTrackInfo.author) : commandEvent.getResource("message.music.notPlaying")) + "**") - .setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()); + .setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()); messageCreateBuilder.setEmbeds(embedBuilder.build()); diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Pause.java b/src/main/java/de/presti/ree6/commands/impl/music/Pause.java index 7a385e978..b29f2d54b 100644 --- a/src/main/java/de/presti/ree6/commands/impl/music/Pause.java +++ b/src/main/java/de/presti/ree6/commands/impl/music/Pause.java @@ -5,7 +5,7 @@ import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.build.CommandData; @@ -36,13 +36,13 @@ public void onPerform(CommandEvent commandEvent) { Main.getInstance().getMusicWorker().getGuildAudioPlayer(commandEvent.getGuild()).getPlayer().setPaused(true); - em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setTitle(commandEvent.getResource("label.musicPlayer")); em.setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setColor(Color.GREEN); em.setDescription(commandEvent.getResource("message.music.pause")); - em.setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()); + em.setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()); commandEvent.reply(em.build(), 5); } diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Play.java b/src/main/java/de/presti/ree6/commands/impl/music/Play.java index 0e4e6b0ea..ede205481 100644 --- a/src/main/java/de/presti/ree6/commands/impl/music/Play.java +++ b/src/main/java/de/presti/ree6/commands/impl/music/Play.java @@ -6,7 +6,7 @@ import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.language.LanguageService; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.OptionMapping; import net.dv8tion.jda.api.interactions.commands.OptionType; @@ -40,26 +40,26 @@ public void onPerform(CommandEvent commandEvent) { Main.getInstance().getMusicWorker().playSong(valueOption.getAsString(), commandEvent); } else { EmbedBuilder em = new EmbedBuilder(); - em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setTitle(commandEvent.getResource("label.musicPlayer")); em.setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setColor(Color.GREEN); em.setDescription(commandEvent.getResource("message.default.usage","play (Url)")); - em.setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()); + em.setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()); commandEvent.reply(em.build(), 5); } } else { if (commandEvent.getArguments().length < 1) { EmbedBuilder em = new EmbedBuilder(); - em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setTitle(commandEvent.getResource("label.musicPlayer")); em.setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setColor(Color.GREEN); em.setDescription(commandEvent.getResource("message.default.usage","play (Url)")); - em.setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()); + em.setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()); commandEvent.reply(em.build(), 5); } else { Main.getInstance().getMusicWorker().playSong(commandEvent.getArguments()[0], commandEvent); diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Resume.java b/src/main/java/de/presti/ree6/commands/impl/music/Resume.java index 635b932dd..9296e5756 100644 --- a/src/main/java/de/presti/ree6/commands/impl/music/Resume.java +++ b/src/main/java/de/presti/ree6/commands/impl/music/Resume.java @@ -5,7 +5,7 @@ import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.build.CommandData; @@ -35,13 +35,13 @@ public void onPerform(CommandEvent commandEvent) { Main.getInstance().getMusicWorker().getGuildAudioPlayer(commandEvent.getGuild()).getPlayer().setPaused(false); - em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setTitle(commandEvent.getResource("label.musicPlayer")); em.setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setColor(Color.GREEN); em.setDescription(commandEvent.getResource("message.music.resume")); - em.setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()); + em.setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()); commandEvent.reply(em.build(), 5); } diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Shuffle.java b/src/main/java/de/presti/ree6/commands/impl/music/Shuffle.java index 2d0af292d..312b1365a 100644 --- a/src/main/java/de/presti/ree6/commands/impl/music/Shuffle.java +++ b/src/main/java/de/presti/ree6/commands/impl/music/Shuffle.java @@ -5,7 +5,7 @@ import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.build.CommandData; @@ -36,13 +36,13 @@ public void onPerform(CommandEvent commandEvent) { Main.getInstance().getMusicWorker().getGuildAudioPlayer( commandEvent.getGuild()).getScheduler().shuffle(); - em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setTitle(commandEvent.getResource("label.musicPlayer")); em.setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setColor(Color.GREEN); em.setDescription(commandEvent.getResource("message.music.shuffle")); - em.setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()); + em.setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()); commandEvent.reply(em.build(), 5); } diff --git a/src/main/java/de/presti/ree6/commands/impl/music/SongInfo.java b/src/main/java/de/presti/ree6/commands/impl/music/SongInfo.java index 56555a959..4c2989400 100644 --- a/src/main/java/de/presti/ree6/commands/impl/music/SongInfo.java +++ b/src/main/java/de/presti/ree6/commands/impl/music/SongInfo.java @@ -7,7 +7,7 @@ import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.others.FormatUtil; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.build.CommandData; @@ -35,7 +35,7 @@ public void onPerform(CommandEvent commandEvent) { GuildMusicManager guildMusicManager = Main.getInstance().getMusicWorker().getGuildAudioPlayer(commandEvent.getGuild()); AudioTrack audioTrack = guildMusicManager != null ? guildMusicManager.getPlayer().getPlayingTrack() : null; - em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setTitle(commandEvent.getResource("label.musicPlayer")); em.setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); @@ -44,7 +44,7 @@ public void onPerform(CommandEvent commandEvent) { commandEvent.getResource("message.music.songInfo", audioTrack.getInfo().title, audioTrack.getInfo().author, FormatUtil.getStatusEmoji(guildMusicManager.getPlayer()) + FormatUtil.progressBar((double)audioTrack.getPosition() / audioTrack.getDuration()), FormatUtil.formatTime(audioTrack.getPosition()), FormatUtil.formatTime(audioTrack.getDuration()), FormatUtil.volumeIcon(guildMusicManager.getPlayer().getVolume()))); - em.setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()); + em.setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()); commandEvent.reply(em.build(), 5); } diff --git a/src/main/java/de/presti/ree6/commands/impl/music/SongList.java b/src/main/java/de/presti/ree6/commands/impl/music/SongList.java index 04de98a11..26794e4a4 100644 --- a/src/main/java/de/presti/ree6/commands/impl/music/SongList.java +++ b/src/main/java/de/presti/ree6/commands/impl/music/SongList.java @@ -6,7 +6,7 @@ import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.others.FormatUtil; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.build.CommandData; @@ -34,7 +34,7 @@ public void onPerform(CommandEvent commandEvent) { end.append("```"); - em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); + em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setTitle(commandEvent.getResource("label.musicPlayer")); em.setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setColor(Color.GREEN); @@ -42,7 +42,7 @@ public void onPerform(CommandEvent commandEvent) { commandEvent.getResource("message.music.songQueueEmpty") : (end.length() > 4096 ? commandEvent.getResource("command.perform.errorWithException","Error (M-SL-01)") : commandEvent.getResource("message.music.songQueue", end))); - em.setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()); + em.setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()); commandEvent.reply(em.build(), 5); } diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Stop.java b/src/main/java/de/presti/ree6/commands/impl/music/Stop.java index c17a45852..4a31608ca 100644 --- a/src/main/java/de/presti/ree6/commands/impl/music/Stop.java +++ b/src/main/java/de/presti/ree6/commands/impl/music/Stop.java @@ -5,7 +5,7 @@ import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.build.CommandData; @@ -25,7 +25,7 @@ public void onPerform(CommandEvent commandEvent) { } Main.getInstance().getMusicWorker().getGuildAudioPlayer(commandEvent.getGuild()).getScheduler().stopAll(commandEvent.getInteractionHook()); } else { - commandEvent.reply(new EmbedBuilder().setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + commandEvent.reply(new EmbedBuilder().setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()).setTitle(commandEvent.getResource("label.musicPlayer")) .setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()) .setColor(Color.RED) diff --git a/src/main/java/de/presti/ree6/commands/impl/music/Volume.java b/src/main/java/de/presti/ree6/commands/impl/music/Volume.java index c5770430b..501b6c5e0 100644 --- a/src/main/java/de/presti/ree6/commands/impl/music/Volume.java +++ b/src/main/java/de/presti/ree6/commands/impl/music/Volume.java @@ -6,7 +6,7 @@ import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.language.LanguageService; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import lavalink.client.player.IPlayer; import net.dv8tion.jda.api.EmbedBuilder; import net.dv8tion.jda.api.interactions.commands.OptionMapping; @@ -51,14 +51,14 @@ public void onPerform(CommandEvent commandEvent) { player.setVolume(volume); - em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setTitle(commandEvent.getResource("label.musicPlayer")); em.setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setColor(Color.GREEN); em.setDescription(commandEvent.getResource("message.music.volume.success", volume)); } else { - em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setTitle(commandEvent.getResource("label.musicPlayer")); em.setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); @@ -79,14 +79,14 @@ public void onPerform(CommandEvent commandEvent) { player.setVolume(vol); - em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setTitle(commandEvent.getResource("label.musicPlayer")); em.setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setColor(Color.GREEN); em.setDescription(commandEvent.getResource("message.music.volume.success", vol)); } else { - em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + em.setAuthor(commandEvent.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setTitle(commandEvent.getResource("label.musicPlayer")); em.setThumbnail(commandEvent.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); @@ -95,7 +95,7 @@ public void onPerform(CommandEvent commandEvent) { } } - em.setFooter(commandEvent.getGuild().getName() + " - " + Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()); + em.setFooter(commandEvent.getGuild().getName() + " - " + BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()); commandEvent.reply(em.build(), 5); } diff --git a/src/main/java/de/presti/ree6/commands/impl/nsfw/NSFW.java b/src/main/java/de/presti/ree6/commands/impl/nsfw/NSFW.java index 1e6db33df..4dde87344 100644 --- a/src/main/java/de/presti/ree6/commands/impl/nsfw/NSFW.java +++ b/src/main/java/de/presti/ree6/commands/impl/nsfw/NSFW.java @@ -8,7 +8,7 @@ import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.main.Main; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.external.RequestUtility; import de.presti.ree6.utils.others.RandomUtils; import net.dv8tion.jda.api.EmbedBuilder; @@ -88,7 +88,7 @@ public void sendImage(CommandEvent commandEvent) { EmbedBuilder em = new EmbedBuilder(); em.setImage(randomUrl); - em.setFooter(commandEvent.getMember().getEffectiveName() + " - " + Data.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); + em.setFooter(commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); if (commandEvent.isSlashCommand()) { message.editMessage(commandEvent.getResource("message.default.checkBelow")).queue(); diff --git a/src/main/java/de/presti/ree6/commands/impl/nsfw/Rule34.java b/src/main/java/de/presti/ree6/commands/impl/nsfw/Rule34.java index 088908dab..5f76318c6 100644 --- a/src/main/java/de/presti/ree6/commands/impl/nsfw/Rule34.java +++ b/src/main/java/de/presti/ree6/commands/impl/nsfw/Rule34.java @@ -8,7 +8,7 @@ import de.presti.ree6.commands.interfaces.Command; import de.presti.ree6.commands.interfaces.ICommand; import de.presti.ree6.language.LanguageService; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.external.RequestUtility; import de.presti.ree6.utils.others.RandomUtils; import net.dv8tion.jda.api.EmbedBuilder; @@ -104,7 +104,7 @@ public void sendImage(CommandEvent commandEvent, Message message, String tags) { if (object.has("sample_url")) { EmbedBuilder em = new EmbedBuilder(); em.setImage(object.get("sample_url").getAsString()); - em.setFooter(commandEvent.getMember().getEffectiveName() + " - " + Data.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); + em.setFooter(commandEvent.getMember().getEffectiveName() + " - " + BotConfig.getAdvertisement(), commandEvent.getMember().getEffectiveAvatarUrl()); if (commandEvent.isSlashCommand()) { message.editMessage(commandEvent.getResource("message.default.checkBelow")).queue(); diff --git a/src/main/java/de/presti/ree6/commands/interfaces/ICommand.java b/src/main/java/de/presti/ree6/commands/interfaces/ICommand.java index e71dd1f48..a6474fad7 100644 --- a/src/main/java/de/presti/ree6/commands/interfaces/ICommand.java +++ b/src/main/java/de/presti/ree6/commands/interfaces/ICommand.java @@ -6,7 +6,7 @@ import de.presti.ree6.main.Main; import de.presti.ree6.news.AnnouncementManager; import de.presti.ree6.sql.SQLSession; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.others.ThreadUtil; import io.sentry.Sentry; import net.dv8tion.jda.api.EmbedBuilder; @@ -47,9 +47,9 @@ default void onASyncPerform(CommandEvent commandEvent) { AnnouncementManager.getAnnouncementList().forEach(a -> { if (!AnnouncementManager.hasReceivedAnnouncement(commandEvent.getGuild().getIdLong(), a.id())) { Main.getInstance().getCommandManager().sendMessage(new EmbedBuilder().setTitle(a.title()) - .setAuthor(Data.getBotName() + "-Info") + .setAuthor(BotConfig.getBotName() + "-Info") .setDescription(a.content().replace("\\n", "\n") + "\n\n" + LanguageService.getByGuild(commandEvent.getGuild(), "message.news.notice")) - .setFooter(Data.getAdvertisement(), commandEvent.getGuild().getIconUrl()) + .setFooter(BotConfig.getAdvertisement(), commandEvent.getGuild().getIconUrl()) .setColor(BotWorker.randomEmbedColor()), 15, commandEvent.getChannel()); AnnouncementManager.addReceivedAnnouncement(commandEvent.getGuild().getIdLong(), a.id()); diff --git a/src/main/java/de/presti/ree6/events/LoggingEvents.java b/src/main/java/de/presti/ree6/events/LoggingEvents.java index a560ccfa6..ccc067fb5 100644 --- a/src/main/java/de/presti/ree6/events/LoggingEvents.java +++ b/src/main/java/de/presti/ree6/events/LoggingEvents.java @@ -17,7 +17,7 @@ import de.presti.ree6.sql.entities.Invite; import de.presti.ree6.sql.entities.webhook.Webhook; import de.presti.ree6.utils.data.ArrayUtil; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import net.dv8tion.jda.api.Permission; import net.dv8tion.jda.api.audit.ActionType; import net.dv8tion.jda.api.audit.AuditLogEntry; @@ -100,13 +100,13 @@ public void onGuildBan(@Nonnull GuildBanEvent event) { WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setThumbnailUrl(event.getUser().getEffectiveAvatarUrl()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getUser().getEffectiveName(), event.getUser().getEffectiveAvatarUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); we.setDescription(LanguageService.getByEvent(event, "logging.banned", event.getUser().getAsMention())); @@ -134,13 +134,13 @@ public void onGuildUnban(@Nonnull GuildUnbanEvent event) { WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setThumbnailUrl(event.getUser().getEffectiveAvatarUrl()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getUser().getEffectiveName(), event.getUser().getEffectiveAvatarUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); we.setDescription(LanguageService.getByEvent(event, "logging.unbanned", event.getUser().getAsMention())); @@ -174,13 +174,13 @@ public void onGuildMemberJoin(GuildMemberJoinEvent event) { WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setThumbnailUrl(event.getUser().getEffectiveAvatarUrl()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getUser().getEffectiveName(), event.getUser().getEffectiveAvatarUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); we.setDescription(LanguageService.getByEvent(event, "logging.joined.default", event.getUser().getAsMention(), TimeFormat.DATE_TIME_SHORT.format(event.getUser().getTimeCreated()), TimeFormat.RELATIVE.format(event.getUser().getTimeCreated()))); @@ -193,7 +193,7 @@ public void onGuildMemberJoin(GuildMemberJoinEvent event) { WebhookMessageBuilder wm2 = new WebhookMessageBuilder(); wm2.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - wm2.setUsername(Data.getBotName() + "-InviteLogs"); + wm2.setUsername(BotConfig.getBotName() + "-InviteLogs"); if (event.getUser().isBot()) { event.getGuild().retrieveAuditLogs().type(ActionType.BOT_ADD).limit(1).queue(auditLogEntries -> { @@ -246,13 +246,13 @@ public void onGuildMemberRemove(@Nonnull GuildMemberRemoveEvent event) { WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setThumbnailUrl(event.getUser().getEffectiveAvatarUrl()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getUser().getEffectiveName(), event.getUser().getEffectiveAvatarUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); if (event.getMember() != null) { @@ -287,13 +287,13 @@ public void onGuildMemberUpdateTimeOut(@NotNull GuildMemberUpdateTimeOutEvent ev WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setThumbnailUrl(event.getUser().getEffectiveAvatarUrl()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getUser().getEffectiveName(), event.getUser().getEffectiveAvatarUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); AuditLogPaginationAction paginationAction = event.getGuild().retrieveAuditLogs().user(event.getUser()).type(ActionType.MEMBER_UPDATE).limit(1); if (event.getNewTimeOutEnd() != null) { @@ -335,13 +335,13 @@ public void onGuildMemberUpdateNickname(@Nonnull GuildMemberUpdateNicknameEvent WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setThumbnailUrl(event.getUser().getEffectiveAvatarUrl()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getUser().getEffectiveName(), event.getUser().getEffectiveAvatarUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); if (event.getNewNickname() == null) { @@ -381,12 +381,12 @@ public void onGuildVoiceUpdate(@NotNull GuildVoiceUpdateEvent event) { WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getEntity().getEffectiveName(), event.getEntity().getEffectiveAvatarUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); we.setDescription(LanguageService.getByEvent(event, "logging.voicechannel.join", event.getEntity().getUser().getAsMention(), event.getChannelJoined().getAsMention())); @@ -402,12 +402,12 @@ public void onGuildVoiceUpdate(@NotNull GuildVoiceUpdateEvent event) { WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getEntity().getEffectiveName(), event.getEntity().getEffectiveAvatarUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); we.setDescription(LanguageService.getByEvent(event, "logging.voicechannel.leave", event.getEntity().getUser().getAsMention(), event.getChannelLeft().getAsMention())); @@ -428,12 +428,12 @@ public void onGuildVoiceUpdate(@NotNull GuildVoiceUpdateEvent event) { WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getEntity().getEffectiveName(), event.getEntity().getEffectiveAvatarUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); we.setDescription(LanguageService.getByEvent(event, "logging.voicechannel.move", event.getEntity().getUser().getAsMention(), event.getChannelLeft().getAsMention(), event.getChannelJoined().getAsMention())); @@ -466,12 +466,12 @@ public void onGenericChannel(@Nonnull GenericChannelEvent event) { WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getGuild().getName(), event.getGuild().getIconUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); we.setDescription(LanguageService.getByGuild(event.getGuild(), "logging.channel.update.voice", event.getChannel().getAsMention())); @@ -511,12 +511,12 @@ public void onGenericChannel(@Nonnull GenericChannelEvent event) { WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getGuild().getName(), event.getGuild().getIconUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); we.setDescription(LanguageService.getByGuild(event.getGuild(), "logging.channel.update.chat", event.getChannel().getAsMention())); @@ -574,13 +574,13 @@ public void onGuildMemberRoleAdd(@Nonnull GuildMemberRoleAddEvent event) { WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setThumbnailUrl(event.getUser().getEffectiveAvatarUrl()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getUser().getEffectiveName(), event.getUser().getEffectiveAvatarUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); StringBuilder finalString = new StringBuilder(); @@ -615,13 +615,13 @@ public void onGuildMemberRoleRemove(@Nonnull GuildMemberRoleRemoveEvent event) { WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setThumbnailUrl(event.getUser().getEffectiveAvatarUrl()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getUser().getEffectiveName(), event.getUser().getEffectiveAvatarUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); StringBuilder finalString = new StringBuilder(); @@ -655,12 +655,12 @@ public void onRoleCreate(@Nonnull RoleCreateEvent event) { WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getGuild().getName(), event.getGuild().getIconUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); we.setDescription(LanguageService.getByGuild(event.getGuild(), "logging.role.create", event.getRole().getName())); @@ -687,12 +687,12 @@ public void onRoleDelete(@Nonnull RoleDeleteEvent event) { WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getGuild().getName(), event.getGuild().getIconUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); we.setDescription(LanguageService.getByGuild(event.getGuild(), "logging.role.delete", event.getRole().getName())); @@ -719,12 +719,12 @@ public void onRoleUpdateName(@Nonnull RoleUpdateNameEvent event) { WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getGuild().getName(), event.getGuild().getIconUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); we.setDescription(LanguageService.getByGuild(event.getGuild(), "logging.role.update", event.getRole().getName())); we.addField(new WebhookEmbed.EmbedField(true, "**" + LanguageService.getByGuild(event.getGuild(), "label.oldName") + "**", event.getOldName())); @@ -753,12 +753,12 @@ public void onRoleUpdateMentionable(@Nonnull RoleUpdateMentionableEvent event) { WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getGuild().getName(), event.getGuild().getIconUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); we.setDescription(LanguageService.getByGuild(event.getGuild(), "logging.role.update", event.getRole().getName())); we.addField(new WebhookEmbed.EmbedField(true, "**" + LanguageService.getByGuild(event.getGuild(), "label.oldMentionable") + "**", event.getOldValue().toString())); @@ -787,12 +787,12 @@ public void onRoleUpdateHoisted(@Nonnull RoleUpdateHoistedEvent event) { WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getGuild().getName(), event.getGuild().getIconUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); we.setDescription(LanguageService.getByGuild(event.getGuild(), "logging.role.update", event.getRole().getName())); we.addField(new WebhookEmbed.EmbedField(true, "**" + LanguageService.getByGuild(event.getGuild(), "label.oldHoist") + "**", event.getOldValue().toString())); @@ -821,12 +821,12 @@ public void onRoleUpdatePermissions(@Nonnull RoleUpdatePermissionsEvent event) { WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getGuild().getName(), event.getGuild().getIconUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); we.setDescription(LanguageService.getByGuild(event.getGuild(), "logging.role.update", event.getRole().getName())); @@ -881,12 +881,12 @@ public void onRoleUpdateColor(@Nonnull RoleUpdateColorEvent event) { WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setAuthor(new WebhookEmbed.EmbedAuthor(event.getGuild().getName(), event.getGuild().getIconUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); we.setDescription(LanguageService.getByGuild(event.getGuild(), "logging.role.update", event.getRole().getName())); we.addField(new WebhookEmbed.EmbedField(true, "**" + LanguageService.getByGuild(event.getGuild(), "label.oldColor") + "**", (event.getOldColor() != null ? event.getOldColor() : Color.gray).getRGB() + "")); @@ -923,12 +923,12 @@ public void onMessageDelete(@Nonnull MessageDeleteEvent event) { WebhookMessageBuilder wm = new WebhookMessageBuilder(); wm.setAvatarUrl(event.getJDA().getSelfUser().getAvatarUrl()); - wm.setUsername(Data.getBotName() + "-Logs"); + wm.setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder we = new WebhookEmbedBuilder(); we.setColor(Color.BLACK.getRGB()); we.setAuthor(new WebhookEmbed.EmbedAuthor(user.getName(), user.getEffectiveAvatarUrl(), null)); - we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + we.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); we.setTimestamp(Instant.now()); Message message = ArrayUtil.getMessageFromMessageListAndRemove(event.getMessageId()); diff --git a/src/main/java/de/presti/ree6/events/MenuEvents.java b/src/main/java/de/presti/ree6/events/MenuEvents.java index ed8f2e36c..7a82cda65 100644 --- a/src/main/java/de/presti/ree6/events/MenuEvents.java +++ b/src/main/java/de/presti/ree6/events/MenuEvents.java @@ -14,7 +14,7 @@ import de.presti.ree6.sql.entities.stats.ChannelStats; import de.presti.ree6.sql.entities.webhook.Webhook; import de.presti.ree6.utils.apis.YouTubeAPIHandler; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.wrapper.entities.channel.ChannelResult; import io.github.redouane59.twitter.dto.user.UserV2; import masecla.reddit4j.objects.subreddit.RedditSubreddit; @@ -67,7 +67,7 @@ public class MenuEvents extends ListenerAdapter { public void onButtonInteraction(@NotNull ButtonInteractionEvent event) { super.onButtonInteraction(event); - if (Data.allowRecordingInChat() && event.getComponentId().startsWith("r_recordingDownload:") && event.getComponentId().contains(":")) { + if (BotConfig.allowRecordingInChat() && event.getComponentId().startsWith("r_recordingDownload:") && event.getComponentId().contains(":")) { String[] split = event.getComponentId().split(":"); if (split.length == 2) { @@ -77,7 +77,7 @@ public void onButtonInteraction(@NotNull ButtonInteractionEvent event) { messageEditBuilder.setEmbeds(new EmbedBuilder() .setDescription(LanguageService.getByGuild(event.getGuild(), "message.recording.inChat")) .setColor(Color.GREEN) - .setFooter(Data.getAdvertisement(), event.getGuild().getIconUrl()) + .setFooter(BotConfig.getAdvertisement(), event.getGuild().getIconUrl()) .setTitle(LanguageService.getByGuild(event.getGuild(), "label.recording.finished")) .build()); messageEditBuilder.setFiles(FileUpload.fromData(recording.getRecording(), "recording.wav")); @@ -86,7 +86,7 @@ public void onButtonInteraction(@NotNull ButtonInteractionEvent event) { messageEditBuilder.setEmbeds(new EmbedBuilder() .setDescription(LanguageService.getByGuild(event.getGuild(), "message.recording.notFound")) .setColor(Color.RED) - .setFooter(Data.getAdvertisement(), event.getGuild().getIconUrl()) + .setFooter(BotConfig.getAdvertisement(), event.getGuild().getIconUrl()) .setTitle(LanguageService.getByGuild(event.getGuild(), "label.error")) .build()); messageEditBuilder.setComponents(List.of()); @@ -150,7 +150,7 @@ public void onButtonInteraction(@NotNull ButtonInteractionEvent event) { if (tickets != null) { StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(Data.getBotName() + " Ticket transcript") + stringBuilder.append(BotConfig.getBotName() + " Ticket transcript") .append(" ") .append(ZonedDateTime.now().format(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.LONG))) .append("\n") @@ -184,12 +184,12 @@ public void onButtonInteraction(@NotNull ButtonInteractionEvent event) { WebhookMessageBuilder webhookMessageBuilder = new WebhookMessageBuilder(); webhookMessageBuilder.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - webhookMessageBuilder.setUsername(Data.getBotName() + "-Tickets"); + webhookMessageBuilder.setUsername(BotConfig.getBotName() + "-Tickets"); WebhookEmbedBuilder webhookEmbedBuilder = new WebhookEmbedBuilder(); webhookEmbedBuilder.setDescription("Here is the transcript of the ticket " + tickets.getTicketCount() + "!"); - webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); webhookEmbedBuilder.setColor(BotWorker.randomEmbedColor().getRGB()); webhookMessageBuilder.addEmbeds(webhookEmbedBuilder.build()); @@ -210,23 +210,23 @@ public void onButtonInteraction(@NotNull ButtonInteractionEvent event) { if (guildMusicManager.getPlayer().isPaused()) { guildMusicManager.getPlayer().setPaused(false); EmbedBuilder em = new EmbedBuilder() - .setAuthor(event.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + .setAuthor(event.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), event.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuild(event.getGuild(), "label.musicPlayer")) .setThumbnail(event.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.music.resume")) - .setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()); + .setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()); Main.getInstance().getCommandManager().sendMessage(em, event.getChannel(), event.getHook()); } else { EmbedBuilder em = new EmbedBuilder() - .setAuthor(event.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + .setAuthor(event.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), event.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuild(event.getGuild(), "label.musicPlayer")) .setThumbnail(event.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.music.pause")) - .setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()); + .setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()); Main.getInstance().getCommandManager().sendMessage(em, event.getChannel(), event.getHook()); } } else { @@ -242,13 +242,13 @@ public void onButtonInteraction(@NotNull ButtonInteractionEvent event) { if (guildMusicManager != null) { guildMusicManager.getPlayer().setPaused(true); EmbedBuilder em = new EmbedBuilder() - .setAuthor(event.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + .setAuthor(event.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), event.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()) .setTitle(LanguageService.getByGuild(event.getGuild(), "label.musicPlayer")) .setThumbnail(event.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.music.pause")) - .setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()); + .setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()); Main.getInstance().getCommandManager().sendMessage(em, event.getChannel(), event.getHook()); } else { Main.getInstance().getCommandManager().sendMessage(LanguageService.getByGuild(event.getGuild(), "message.music.notConnected"), @@ -275,7 +275,7 @@ public void onButtonInteraction(@NotNull ButtonInteractionEvent event) { if (guildMusicManager != null) { EmbedBuilder em = new EmbedBuilder(); - em.setAuthor(event.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + em.setAuthor(event.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), event.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setTitle(LanguageService.getByGuild(event.getGuild(), "label.musicPlayer")); em.setThumbnail(event.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); @@ -283,7 +283,7 @@ public void onButtonInteraction(@NotNull ButtonInteractionEvent event) { em.setDescription(Main.getInstance().getMusicWorker().getGuildAudioPlayer(event.getGuild()).getScheduler().loop() ? LanguageService.getByGuild(event.getGuild(), "message.music.loop.enabled") : LanguageService.getByGuild(event.getGuild(), "message.music.loop.disabled")); - em.setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()); + em.setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()); Main.getInstance().getCommandManager().sendMessage(em, event.getChannel(), event.getHook()); } else { @@ -301,13 +301,13 @@ public void onButtonInteraction(@NotNull ButtonInteractionEvent event) { guildMusicManager.getScheduler().shuffle(); - em.setAuthor(event.getGuild().getJDA().getSelfUser().getName(), Data.getWebsite(), + em.setAuthor(event.getGuild().getJDA().getSelfUser().getName(), BotConfig.getWebsite(), event.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setTitle(LanguageService.getByGuild(event.getGuild(), "label.musicPlayer")); em.setThumbnail(event.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()); em.setColor(Color.GREEN); em.setDescription(LanguageService.getByGuild(event.getGuild(), "message.music.shuffle")); - em.setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()); + em.setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()); Main.getInstance().getCommandManager().sendMessage(em, event.getChannel(), event.getHook()); } else { @@ -354,7 +354,7 @@ public void onModalInteraction(@NotNull ModalInteractionEvent event) { .setTitle(LanguageService.getByGuild(event.getGuild(), "label.rewards")) .setColor(Color.RED) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.default.incorrectNumbers")) - .setFooter(Data.getAdvertisement(), event.getGuild().getIconUrl()), null, event.getInteraction().getHook()); + .setFooter(BotConfig.getAdvertisement(), event.getGuild().getIconUrl()), null, event.getInteraction().getHook()); } SQLSession.getSqlConnector().getSqlWorker() @@ -376,7 +376,7 @@ public void onModalInteraction(@NotNull ModalInteractionEvent event) { .setTitle(LanguageService.getByGuild(event.getGuild(), "label.rewards")) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.rewards.success")) - .setFooter(Data.getAdvertisement(), event.getGuild().getIconUrl()), null, event.getInteraction().getHook()); + .setFooter(BotConfig.getAdvertisement(), event.getGuild().getIconUrl()), null, event.getInteraction().getHook()); } case "re_feedback_modal" -> { @@ -390,7 +390,7 @@ public void onModalInteraction(@NotNull ModalInteractionEvent event) { .setFooter("By " + event.getUser().getEffectiveName() + " (" + event.getUser().getId() + ")", event.getUser().getEffectiveAvatarUrl()) .setTimestamp(Instant.now()); - Main.getInstance().getCommandManager().sendMessage(embedBuilder, BotWorker.getShardManager().getTextChannelById(Data.getFeedbackChannel())); + Main.getInstance().getCommandManager().sendMessage(embedBuilder, BotWorker.getShardManager().getTextChannelById(BotConfig.getFeedbackChannel())); Main.getInstance().getCommandManager().sendMessage("Thank you!", null, event.getInteraction().getHook()); } @@ -450,9 +450,9 @@ public void onModalInteraction(@NotNull ModalInteractionEvent event) { if (twitchIntegration == null) { EmbedBuilder embedBuilder = new EmbedBuilder() .setTitle(LanguageService.getByGuild(event.getGuild(), "label.setupMenu")) - .setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()) + .setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()) .setColor(Color.RED) - .setDescription(LanguageService.getByGuild(event.getGuild(), "message.stream-action.noTwitch", Data.getTwitchAuth())); + .setDescription(LanguageService.getByGuild(event.getGuild(), "message.stream-action.noTwitch", BotConfig.getTwitchAuth())); event.deferEdit().setEmbeds(embedBuilder.build()).setComponents(new ArrayList<>()).queue(); return; } @@ -494,7 +494,7 @@ public void onModalInteraction(@NotNull ModalInteractionEvent event) { EmbedBuilder embedBuilder = new EmbedBuilder() .setTitle(LanguageService.getByGuild(event.getGuild(), "label.setupMenu")) - .setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()) + .setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.statistics.twitchSuccess")); event.deferEdit().setEmbeds(embedBuilder.build()).setComponents(new ArrayList<>()).queue(); @@ -515,7 +515,7 @@ public void onModalInteraction(@NotNull ModalInteractionEvent event) { EmbedBuilder embedBuilder = new EmbedBuilder() .setTitle(LanguageService.getByGuild(event.getGuild(), "label.setupMenu")) - .setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()) + .setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.statistics.youtubeSuccess")); @@ -535,7 +535,7 @@ public void onModalInteraction(@NotNull ModalInteractionEvent event) { } catch (Exception e) { embedBuilder .setTitle(LanguageService.getByGuild(event.getGuild(), "label.setupMenu")) - .setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()) + .setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()) .setColor(Color.RED) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.default.retrievalError")); event.deferEdit().setEmbeds(embedBuilder.build()).setComponents(new ArrayList<>()).queue(); @@ -545,7 +545,7 @@ public void onModalInteraction(@NotNull ModalInteractionEvent event) { if (youTubeChannel == null) { embedBuilder = embedBuilder .setTitle(LanguageService.getByGuild(event.getGuild(), "label.setupMenu")) - .setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()) + .setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()) .setColor(Color.RED) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.statistics.youtubeNotFound")); event.deferEdit().setEmbeds(embedBuilder.build()).setComponents(new ArrayList<>()).queue(); @@ -590,7 +590,7 @@ public void onModalInteraction(@NotNull ModalInteractionEvent event) { embedBuilder = embedBuilder .setTitle(LanguageService.getByGuild(event.getGuild(), "label.setupMenu")) - .setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()) + .setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.statistics.youtubeSuccess")); event.deferEdit().setEmbeds(embedBuilder.build()).setComponents(new ArrayList<>()).queue(); @@ -611,7 +611,7 @@ public void onModalInteraction(@NotNull ModalInteractionEvent event) { EmbedBuilder embedBuilder = new EmbedBuilder() .setTitle(LanguageService.getByGuild(event.getGuild(), "label.setupMenu")) - .setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()) + .setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.statistics.redditSuccess")); @@ -627,7 +627,7 @@ public void onModalInteraction(@NotNull ModalInteractionEvent event) { } catch (IOException | InterruptedException e) { embedBuilder .setTitle(LanguageService.getByGuild(event.getGuild(), "label.setupMenu")) - .setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()) + .setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()) .setColor(Color.RED) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.default.retrievalError")); event.deferEdit().setEmbeds(embedBuilder.build()).setComponents(new ArrayList<>()).queue(); @@ -672,7 +672,7 @@ public void onModalInteraction(@NotNull ModalInteractionEvent event) { embedBuilder = embedBuilder .setTitle(LanguageService.getByGuild(event.getGuild(), "label.setupMenu")) - .setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()) + .setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.statistics.redditSuccess")); event.deferEdit().setEmbeds(embedBuilder.build()).setComponents(new ArrayList<>()).queue(); @@ -693,7 +693,7 @@ public void onModalInteraction(@NotNull ModalInteractionEvent event) { EmbedBuilder embedBuilder = new EmbedBuilder() .setTitle(LanguageService.getByGuild(event.getGuild(), "label.setupMenu")) - .setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()) + .setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.statistics.twitterSuccess")); @@ -709,7 +709,7 @@ public void onModalInteraction(@NotNull ModalInteractionEvent event) { } catch (NoSuchElementException e) { embedBuilder .setTitle(LanguageService.getByGuild(event.getGuild(), "label.setupMenu")) - .setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()) + .setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()) .setColor(Color.RED) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.default.retrievalError")); event.deferEdit().setEmbeds(embedBuilder.build()).setComponents(new ArrayList<>()).queue(); @@ -754,7 +754,7 @@ public void onModalInteraction(@NotNull ModalInteractionEvent event) { embedBuilder = embedBuilder .setTitle(LanguageService.getByGuild(event.getGuild(), "label.setupMenu")) - .setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()) + .setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.statistics.twitterSuccess")); event.deferEdit().setEmbeds(embedBuilder.build()).setComponents(new ArrayList<>()).queue(); @@ -775,7 +775,7 @@ public void onModalInteraction(@NotNull ModalInteractionEvent event) { EmbedBuilder embedBuilder = new EmbedBuilder() .setTitle(LanguageService.getByGuild(event.getGuild(), "label.setupMenu")) - .setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()) + .setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.statistics.instagramSuccess")); @@ -791,7 +791,7 @@ public void onModalInteraction(@NotNull ModalInteractionEvent event) { } catch (ExecutionException | InterruptedException e) { embedBuilder .setTitle(LanguageService.getByGuild(event.getGuild(), "label.setupMenu")) - .setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()) + .setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()) .setColor(Color.RED) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.default.retrievalError")); event.deferEdit().setEmbeds(embedBuilder.build()).setComponents(new ArrayList<>()).queue(); @@ -836,7 +836,7 @@ public void onModalInteraction(@NotNull ModalInteractionEvent event) { embedBuilder = embedBuilder .setTitle(LanguageService.getByGuild(event.getGuild(), "label.setupMenu")) - .setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()) + .setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()) .setColor(Color.GREEN) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.statistics.instagramSuccess")); event.deferEdit().setEmbeds(embedBuilder.build()).setComponents(new ArrayList<>()).queue(); @@ -844,7 +844,7 @@ public void onModalInteraction(@NotNull ModalInteractionEvent event) { default -> event.deferEdit().setEmbeds(new EmbedBuilder() .setTitle(LanguageService.getByGuild(event.getGuild(), "label.unknownMenu")) - .setFooter(event.getGuild().getName() + " - " + Data.getAdvertisement(), event.getGuild().getIconUrl()) + .setFooter(event.getGuild().getName() + " - " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl()) .setColor(Color.RED) .setDescription(LanguageService.getByGuild(event.getGuild(), "message.default.unknownMenu")) .build()).setComponents(new ArrayList<>()).queue(); @@ -934,7 +934,7 @@ public void onStringSelectInteraction(@NotNull StringSelectInteractionEvent even case "autorole" -> { embedBuilder.setDescription(LanguageService.getByGuild(event.getGuild(), "message.setup.steps.autoRole")); - event.editMessageEmbeds(embedBuilder.build()).setActionRow(Button.link(Data.getWebinterface(), "Webinterface")).queue(); + event.editMessageEmbeds(embedBuilder.build()).setActionRow(Button.link(BotConfig.getWebinterface(), "Webinterface")).queue(); } case "tempvoice" -> { @@ -1342,7 +1342,7 @@ public void onStringSelectInteraction(@NotNull StringSelectInteractionEvent even TextChannel textChannel = event.getGuild().getTextChannelById(value); if (textChannel != null) { - textChannel.createWebhook(Data.getBotName() + "-Logs").queue(webhook -> { + textChannel.createWebhook(BotConfig.getBotName() + "-Logs").queue(webhook -> { if (SQLSession.getSqlConnector().getSqlWorker().isLogSetup(event.getGuild().getId())) { WebhookUtil.deleteWebhook(event.getGuild().getId(), SQLSession.getSqlConnector().getSqlWorker().getLogWebhook(event.getGuild().getId())); } @@ -1448,7 +1448,7 @@ public void onStringSelectInteraction(@NotNull StringSelectInteractionEvent even TextChannel textChannel = event.getGuild().getTextChannelById(event.getInteraction().getValues().get(0)); if (textChannel != null) { - textChannel.createWebhook(Data.getBotName() + "-Welcome").queue(webhook -> { + textChannel.createWebhook(BotConfig.getBotName() + "-Welcome").queue(webhook -> { if (SQLSession.getSqlConnector().getSqlWorker().isWelcomeSetup(event.getGuild().getId())) { WebhookUtil.deleteWebhook(event.getGuild().getId(), SQLSession.getSqlConnector().getSqlWorker().getWelcomeWebhook(event.getGuild().getId())); } diff --git a/src/main/java/de/presti/ree6/events/OtherEvents.java b/src/main/java/de/presti/ree6/events/OtherEvents.java index 60f8f6385..6fe115ab8 100644 --- a/src/main/java/de/presti/ree6/events/OtherEvents.java +++ b/src/main/java/de/presti/ree6/events/OtherEvents.java @@ -18,16 +18,13 @@ import de.presti.ree6.sql.entities.stats.ChannelStats; import de.presti.ree6.utils.apis.ChatGPTAPI; import de.presti.ree6.utils.data.ArrayUtil; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.data.ImageCreationUtility; import de.presti.ree6.utils.others.*; import io.sentry.Sentry; import lombok.extern.slf4j.Slf4j; import net.dv8tion.jda.api.Permission; -import net.dv8tion.jda.api.entities.Activity; -import net.dv8tion.jda.api.entities.Member; -import net.dv8tion.jda.api.entities.Message; -import net.dv8tion.jda.api.entities.Role; +import net.dv8tion.jda.api.entities.*; import net.dv8tion.jda.api.entities.channel.ChannelType; import net.dv8tion.jda.api.entities.channel.concrete.Category; import net.dv8tion.jda.api.entities.channel.concrete.TextChannel; @@ -62,6 +59,7 @@ import java.util.Map; import java.util.Objects; import java.util.concurrent.TimeUnit; +import java.util.stream.IntStream; /** * Event Handler for no categorized Events. @@ -79,7 +77,7 @@ public void onReady(@Nonnull ReadyEvent event) { Main.getInstance().getCommandManager().addSlashCommand(event.getJDA()); - BotWorker.setActivity(event.getJDA(), Data.getStatus(), Activity.ActivityType.CUSTOM_STATUS); + BotWorker.setActivity(event.getJDA(), BotConfig.getStatus(), Activity.ActivityType.CUSTOM_STATUS); } /** @@ -199,7 +197,7 @@ public void onGuildMemberRemove(@NotNull GuildMemberRemoveEvent event) { } }); - if (Data.isModuleActive("tickets")) { + if (BotConfig.isModuleActive("tickets")) { Tickets tickets = SQLSession.getSqlConnector().getSqlWorker().getEntity(new Tickets(), "FROM Tickets WHERE guildId=:gid", Map.of("gid", event.getGuild().getIdLong())); if (tickets != null) { Category category = event.getGuild().getCategoryById(tickets.getTicketCategory()); @@ -209,7 +207,7 @@ public void onGuildMemberRemove(@NotNull GuildMemberRemoveEvent event) { if (!channels.isEmpty()) { TextChannel channel = channels.get(0); StringBuilder stringBuilder = new StringBuilder(); - stringBuilder.append(Data.getBotName()) + stringBuilder.append(BotConfig.getBotName()) .append(" Ticket transcript") .append(" ") .append(ZonedDateTime.now().format(DateTimeFormatter.ofLocalizedDateTime(FormatStyle.LONG))) @@ -242,12 +240,12 @@ public void onGuildMemberRemove(@NotNull GuildMemberRemoveEvent event) { WebhookMessageBuilder webhookMessageBuilder = new WebhookMessageBuilder(); webhookMessageBuilder.setAvatarUrl(event.getJDA().getSelfUser().getEffectiveAvatarUrl()); - webhookMessageBuilder.setUsername(Data.getBotName() + "-Tickets"); + webhookMessageBuilder.setUsername(BotConfig.getBotName() + "-Tickets"); WebhookEmbedBuilder webhookEmbedBuilder = new WebhookEmbedBuilder(); webhookEmbedBuilder.setDescription("Here is the transcript of the ticket " + tickets.getTicketCount() + "!"); - webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " " + Data.getAdvertisement(), event.getGuild().getIconUrl())); + webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(event.getGuild().getName() + " " + BotConfig.getAdvertisement(), event.getGuild().getIconUrl())); webhookEmbedBuilder.setColor(BotWorker.randomEmbedColor().getRGB()); webhookMessageBuilder.addEmbeds(webhookEmbedBuilder.build()); @@ -267,11 +265,18 @@ public void onGuildMemberRemove(@NotNull GuildMemberRemoveEvent event) { @Override public void onGuildVoiceUpdate(@Nonnull GuildVoiceUpdateEvent event) { if (event.getChannelLeft() == null) { - if (!ArrayUtil.voiceJoined.containsKey(event.getMember()) && !event.getEntity().getUser().isBot() && (event.getEntity().getVoiceState() != null && !event.getEntity().getVoiceState().isGuildDeafened())) { + if (!ArrayUtil.voiceJoined.containsKey(event.getMember()) && !event.getEntity().getUser().isBot()) { + GuildVoiceState voiceState = event.getVoiceState(); + + if (voiceState.isMuted() && BotConfig.shouldResetOnMute()) return; + if (voiceState.isGuildMuted() && BotConfig.shouldResetOnMuteGlobal()) return; + if (voiceState.isDeafened() && BotConfig.shouldResetOnDeafen()) return; + if (voiceState.isGuildDeafened() && BotConfig.shouldResetOnDeafenGlobal()) return; + ArrayUtil.voiceJoined.put(event.getMember(), System.currentTimeMillis()); } - if (Data.isModuleActive("temporalvoice")) { + if (BotConfig.isModuleActive("temporalvoice")) { TemporalVoicechannel temporalVoicechannel = SQLSession.getSqlConnector().getSqlWorker().getEntity(new TemporalVoicechannel(), "FROM TemporalVoicechannel WHERE guildId=:gid", Map.of("gid", event.getGuild().getId())); if (temporalVoicechannel != null) { @@ -314,7 +319,7 @@ public void onGuildVoiceUpdate(@Nonnull GuildVoiceUpdateEvent event) { Main.getInstance().getMusicWorker().disconnect(event.getGuild()); } - if (Data.isModuleActive("temporalvoice")) { + if (BotConfig.isModuleActive("temporalvoice")) { if (ArrayUtil.isTemporalVoicechannel(event.getChannelLeft()) && (event.getChannelLeft().getMembers().isEmpty() || (event.getChannelLeft().getMembers().size() == 1 && event.getChannelLeft().getMembers().get(0).getIdLong() == event.getJDA().getSelfUser().getIdLong()))) { @@ -356,53 +361,56 @@ public void onGuildVoiceUpdate(@Nonnull GuildVoiceUpdateEvent event) { @Override public void onGenericGuildVoice(@NotNull GenericGuildVoiceEvent event) { - boolean toggleOn = false; + if (!(event instanceof GuildVoiceDeafenEvent || event instanceof GuildVoiceGuildDeafenEvent || event instanceof GuildVoiceGuildMuteEvent || event instanceof GuildVoiceMuteEvent)) { + return; + } if (event instanceof GuildVoiceGuildDeafenEvent guildDeafenEvent) { if (event.getMember() == event.getGuild().getSelfMember() && !guildDeafenEvent.isGuildDeafened()) { event.getGuild().getSelfMember().deafen(true).queue(); } - - toggleOn = guildDeafenEvent.isGuildDeafened(); - } else if (event instanceof GuildVoiceGuildMuteEvent guildVoiceGuildMuteEvent) { - toggleOn = guildVoiceGuildMuteEvent.isGuildMuted(); - } else if (event instanceof GuildVoiceMuteEvent guildVoiceMuteEvent) { - toggleOn = guildVoiceMuteEvent.isMuted(); - } else if (event instanceof GuildVoiceDeafenEvent guildVoiceDeafenEvent) { - toggleOn = guildVoiceDeafenEvent.isDeafened(); } if (event.getMember().getUser().isBot()) return; + GuildVoiceState voiceState = event.getVoiceState(); + + boolean toggleOn = (BotConfig.shouldResetOnDeafenGlobal() && voiceState.isGuildDeafened()) || + (BotConfig.shouldResetOnDeafen() && voiceState.isDeafened()) || + (BotConfig.shouldResetOnMuteGlobal() && voiceState.isGuildMuted()) || + (BotConfig.shouldResetOnMute() && voiceState.isMuted()); + if (toggleOn) { doVoiceXPStuff(event.getMember()); } else { + if (!event.getVoiceState().inAudioChannel()) return; + if (ArrayUtil.voiceJoined.containsKey(event.getMember())) return; + ArrayUtil.voiceJoined.put(event.getMember(), System.currentTimeMillis()); } } - @Override - public void onGuildVoiceMute(@NotNull GuildVoiceMuteEvent event) { - super.onGuildVoiceMute(event); - } - + /** + * Method used to do all the calculations for the Voice XP. + * @param member the Member that should be checked. + */ public void doVoiceXPStuff(Member member) { if (ArrayUtil.voiceJoined.containsKey(member)) { int min = TimeUtil.getTimeinMin(TimeUtil.getTimeinSec(ArrayUtil.voiceJoined.get(member))); - int addXP = 0; + int addXP = IntStream.rangeClosed(1, min).map(i -> RandomUtils.random.nextInt(5, 11)).sum(); - for (int i = 1; i <= min; i++) { - addXP += RandomUtils.random.nextInt(5, 11); - } + // TODO:: await database future system. + ThreadUtil.createThread(x -> { + VoiceUserLevel newUserLevel = SQLSession.getSqlConnector().getSqlWorker().getVoiceLevelData(member.getGuild().getId(), member.getId()); + newUserLevel.addExperience(addXP); - VoiceUserLevel newUserLevel = SQLSession.getSqlConnector().getSqlWorker().getVoiceLevelData(member.getGuild().getId(), member.getId()); - newUserLevel.addExperience(addXP); + SQLSession.getSqlConnector().getSqlWorker().addVoiceLevelData(member.getGuild().getId(), newUserLevel); - SQLSession.getSqlConnector().getSqlWorker().addVoiceLevelData(member.getGuild().getId(), newUserLevel); + UserUtil.handleVoiceLevelReward(member.getGuild(), member); + }); - UserUtil.handleVoiceLevelReward(member.getGuild(), member); ArrayUtil.voiceJoined.remove(member); } } @@ -430,7 +438,7 @@ public void onMessageReceived(@NotNull MessageReceivedEvent event) { super.onMessageReceived(event); if (event.isFromType(ChannelType.NEWS) && - Data.isModuleActive("autopublish") && + BotConfig.isModuleActive("autopublish") && SQLSession.getSqlConnector().getSqlWorker().getSetting(event.getGuild().getId(), "configuration_autopublish").getBooleanValue()) { event.getMessage().crosspost().queue(c -> c.addReaction(Emoji.fromUnicode("U+1F4E2")).queue()); } @@ -474,7 +482,7 @@ public void onMessageReceived(@NotNull MessageReceivedEvent event) { } } - if (Data.isModuleActive("level")) { + if (BotConfig.isModuleActive("level")) { if (!ArrayUtil.timeout.contains(event.getMember())) { ChatUserLevel userLevel = SQLSession.getSqlConnector().getSqlWorker().getChatLevelData(event.getGuild().getId(), event.getMember().getId()); @@ -504,7 +512,7 @@ public void onMessageReceived(@NotNull MessageReceivedEvent event) { */ @Override public void onMessageReactionAdd(@NotNull MessageReactionAddEvent event) { - if (!Data.isModuleActive("reactionRoles")) return; + if (!BotConfig.isModuleActive("reactionRoles")) return; if (event.getMember() == null) return; @@ -585,7 +593,7 @@ public void onMessageReactionAdd(@NotNull MessageReactionAddEvent event) { */ @Override public void onMessageReactionRemove(@NotNull MessageReactionRemoveEvent event) { - if (!Data.isModuleActive("reactionRoles")) return; + if (!BotConfig.isModuleActive("reactionRoles")) return; if (event.getMember() == null) return; String reactionCode = event.getReaction().getEmoji().getAsReactionCode(); @@ -615,7 +623,7 @@ public void onMessageReactionRemove(@NotNull MessageReactionRemoveEvent event) { */ @Override public void onSlashCommandInteraction(@NotNull SlashCommandInteractionEvent event) { - if (!Data.isModuleActive("slashcommands")) return; + if (!BotConfig.isModuleActive("slashcommands")) return; // Only accept commands from guilds if (!event.isFromGuild() && event.getMember() != null) return; diff --git a/src/main/java/de/presti/ree6/language/LanguageService.java b/src/main/java/de/presti/ree6/language/LanguageService.java index dc1554cac..1b79c027d 100644 --- a/src/main/java/de/presti/ree6/language/LanguageService.java +++ b/src/main/java/de/presti/ree6/language/LanguageService.java @@ -2,7 +2,7 @@ import de.presti.ree6.commands.CommandEvent; import de.presti.ree6.sql.SQLSession; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.external.RequestUtility; import lombok.extern.slf4j.Slf4j; import net.dv8tion.jda.api.entities.Guild; @@ -289,7 +289,7 @@ public static void downloadLanguages() { if (discordLocale == DiscordLocale.UNKNOWN) return getDefault(key, parameters); Language language = languageResources.containsKey(discordLocale) ? languageResources.get(discordLocale) : - languageResources.get(DiscordLocale.from(Data.getDefaultLanguage())); + languageResources.get(DiscordLocale.from(BotConfig.getDefaultLanguage())); return language != null ? language.getResource(key, parameters) : "Missing language resource!"; } diff --git a/src/main/java/de/presti/ree6/logger/events/LoggerQueue.java b/src/main/java/de/presti/ree6/logger/events/LoggerQueue.java index 8a566e6cb..25b2a2599 100644 --- a/src/main/java/de/presti/ree6/logger/events/LoggerQueue.java +++ b/src/main/java/de/presti/ree6/logger/events/LoggerQueue.java @@ -9,7 +9,7 @@ import de.presti.ree6.logger.events.implentation.LogMessageRole; import de.presti.ree6.logger.events.implentation.LogMessageUser; import de.presti.ree6.logger.events.implentation.LogMessageVoice; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.others.ThreadUtil; import net.dv8tion.jda.api.Permission; @@ -40,9 +40,9 @@ public void add(LogMessage loggerMessage) { logs.add(loggerMessage); // Creating a new Webhook Message with an Embed. - WebhookMessageBuilder webhookMessageBuilder = new WebhookMessageBuilder().setAvatarUrl(loggerMessage.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()).setUsername(Data.getBotName() + "-Logs"); + WebhookMessageBuilder webhookMessageBuilder = new WebhookMessageBuilder().setAvatarUrl(loggerMessage.getGuild().getJDA().getSelfUser().getEffectiveAvatarUrl()).setUsername(BotConfig.getBotName() + "-Logs"); WebhookEmbedBuilder webhookEmbedBuilder = new WebhookEmbedBuilder().setColor(Color.BLACK.getRGB()) - .setFooter(new WebhookEmbed.EmbedFooter(loggerMessage.getGuild().getName() + " - " + Data.getAdvertisement(), + .setFooter(new WebhookEmbed.EmbedFooter(loggerMessage.getGuild().getName() + " - " + BotConfig.getAdvertisement(), (loggerMessage.getGuild().getIconUrl() != null ? loggerMessage.getGuild().getIconUrl() : null))) .setTimestamp(Instant.now()); diff --git a/src/main/java/de/presti/ree6/main/Main.java b/src/main/java/de/presti/ree6/main/Main.java index 1f51ba6e7..be184191e 100644 --- a/src/main/java/de/presti/ree6/main/Main.java +++ b/src/main/java/de/presti/ree6/main/Main.java @@ -9,6 +9,7 @@ import de.presti.ree6.addons.AddonLoader; import de.presti.ree6.addons.AddonManager; import de.presti.ree6.audio.music.MusicWorker; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.bot.BotWorker; import de.presti.ree6.bot.util.WebhookUtil; import de.presti.ree6.bot.version.BotState; @@ -211,7 +212,7 @@ public static void main(String[] args) { getInstance().getConfig().getConfiguration().getString("hikari.misc.storageFile"), databaseTyp, getInstance().getConfig().getConfiguration().getInt("hikari.misc.poolSize"), getInstance().getConfig().getConfiguration().getBoolean("hikari.misc.createEmbeddedServer"), - Data.isDebug()); + BotConfig.isDebug()); } catch (Exception exception) { log.error("Shutting down, because of an critical error!", exception); System.exit(0); @@ -236,7 +237,7 @@ public static void main(String[] args) { "command_" + commandAnnotation.name().toLowerCase(), commandAnnotation.name(), true)); } Setting prefixSetting = SettingsManager.getDefault("chatprefix"); - prefixSetting.setValue(Data.getDefaultPrefix()); + prefixSetting.setValue(BotConfig.getDefaultPrefix()); Setting languageSetting = SettingsManager.getDefault("configuration_language"); languageSetting.setValue("en_US"); @@ -262,7 +263,7 @@ public static void main(String[] args) { version = BotVersion.BETA; } - if (Data.shouldUseLavaLink()) { + if (BotConfig.shouldUseLavaLink()) { getInstance().lavalink = new JdaLavalink(shards, shard -> BotWorker.getShardManager().getShardById(shard)); } @@ -271,7 +272,7 @@ public static void main(String[] args) { getInstance().setMusicWorker(new MusicWorker()); getInstance().addEvents(); - if (Data.shouldUseLavaLink()) { + if (BotConfig.shouldUseLavaLink()) { List> nodes = (List>) getInstance().getConfig() .getConfiguration().getList("lavalink.nodes"); @@ -290,14 +291,14 @@ public static void main(String[] args) { return; } - if (Data.isModuleActive("music")) { + if (BotConfig.isModuleActive("music")) { log.info("Loading SpotifyAPI"); new SpotifyAPIHandler(); } - if (Data.isModuleActive("games")) { + if (BotConfig.isModuleActive("games")) { - if (Data.isModuleActive("music")) { + if (BotConfig.isModuleActive("music")) { log.info("Loading MusicQuizUtil"); new MusicQuizUtil(); } @@ -306,7 +307,7 @@ public static void main(String[] args) { GameManager.loadAllGames(); } - if (Data.isModuleActive("streamtools")) { + if (BotConfig.isModuleActive("streamtools")) { log.info("Loading Stream-actions"); StreamActionContainerCreator.loadAll(); } @@ -319,7 +320,7 @@ public static void main(String[] args) { // Create the Notifier-Manager instance. getInstance().setNotifier(new Notifier()); - if (Data.isModuleActive("notifier")) { + if (BotConfig.isModuleActive("notifier")) { ThreadUtil.createThread(x -> { log.info("Loading Notifier data."); List channelStats = SQLSession.getSqlConnector().getSqlWorker().getEntityList(new ChannelStats(), "FROM ChannelStats", null); @@ -399,7 +400,7 @@ public static void main(String[] args) { // Initialize the Addon-Manager. getInstance().setAddonManager(new AddonManager()); - if (Data.isModuleActive("addons")) { + if (BotConfig.isModuleActive("addons")) { // Initialize the Addon-Loader. AddonLoader.loadAllAddons(); @@ -429,13 +430,13 @@ public static void main(String[] args) { private void addEvents() { BotWorker.addEvent(new MenuEvents(), new OtherEvents()); - if (Data.isModuleActive("logging")) + if (BotConfig.isModuleActive("logging")) BotWorker.addEvent(new LoggingEvents()); - if (Data.isModuleActive("games")) + if (BotConfig.isModuleActive("games")) BotWorker.addEvent(new GameEvents()); - if (Data.isModuleActive("customevents")) + if (BotConfig.isModuleActive("customevents")) BotWorker.getShardManager().addEventListener(new CustomEvents()); } @@ -455,7 +456,7 @@ private void shutdown() { log.info("[Main] Shutdown init. !"); BotWorker.setState(BotState.STOPPED); - if (Data.isModuleActive("temporalvoice")) { + if (BotConfig.isModuleActive("temporalvoice")) { // Save it all. getConfig().getTemporal().set("temporalvoice", ArrayUtil.temporalVoicechannel); } @@ -467,14 +468,14 @@ private void shutdown() { log.info("[Main] Closed Database Connection!"); } - if (Data.isModuleActive("addons")) { + if (BotConfig.isModuleActive("addons")) { // Shutdown every Addon. log.info("[Main] Disabling every Addon!"); getAddonManager().stopAddons(); log.info("[Main] Every Addon has been disabled!"); } - if (Data.isModuleActive("notifier")) { + if (BotConfig.isModuleActive("notifier")) { // Close the Twitch-Client log.info("[Main] Closing Twitch API Instance!"); getNotifier().getTwitchClient().close(); @@ -553,7 +554,7 @@ public void createCheckerThread() { ArrayUtil.messageIDwithUser.clear(); BotWorker.getShardManager().getShards().forEach(jda -> - BotWorker.setActivity(jda, Data.getStatus(), Activity.ActivityType.CUSTOM_STATUS)); + BotWorker.setActivity(jda, BotConfig.getStatus(), Activity.ActivityType.CUSTOM_STATUS)); log.info("[Stats] "); log.info("[Stats] Today's Stats:"); @@ -624,7 +625,7 @@ public void createCheckerThread() { if (Timestamp.from(Instant.now()).after(Timestamp.from(scheduledMessage.getCreated().toInstant().plusMillis(scheduledMessage.getDelayAmount())))) { WebhookUtil.sendWebhook(new WebhookMessageBuilder() - .setUsername(Data.getBotName() + "-Scheduler") + .setUsername(BotConfig.getBotName() + "-Scheduler") .setAvatarUrl(BotWorker.getShardManager().getShards().get(0).getSelfUser().getEffectiveAvatarUrl()) .append(scheduledMessage.getMessage()).build(), scheduledMessage.getScheduledMessageWebhook()); @@ -638,7 +639,7 @@ public void createCheckerThread() { if (Timestamp.from(Instant.now()).after(Timestamp.from(scheduledMessage.getCreated().toInstant().plusMillis(scheduledMessage.getDelayAmount())))) { WebhookUtil.sendWebhook(new WebhookMessageBuilder() - .setUsername(Data.getBotName() + "-Scheduler") + .setUsername(BotConfig.getBotName() + "-Scheduler") .setAvatarUrl(BotWorker.getShardManager().getShards().get(0).getSelfUser().getEffectiveAvatarUrl()) .append(scheduledMessage.getMessage()).build(), scheduledMessage.getScheduledMessageWebhook()); @@ -649,7 +650,7 @@ public void createCheckerThread() { if (Timestamp.from(Instant.now()).after(Timestamp.from(scheduledMessage.getLastUpdated().toInstant().plusMillis(scheduledMessage.getDelayAmount())))) { WebhookUtil.sendWebhook(new WebhookMessageBuilder() - .setUsername(Data.getBotName() + "-Scheduler") + .setUsername(BotConfig.getBotName() + "-Scheduler") .setAvatarUrl(BotWorker.getShardManager().getShards().get(0).getSelfUser().getEffectiveAvatarUrl()) .append(scheduledMessage.getMessage()).build(), scheduledMessage.getScheduledMessageWebhook()); @@ -756,7 +757,7 @@ public void createCheckerThread() { //region Twitch credentials updater. try { // Need to load them all. - if (Data.isModuleActive("notifier")) + if (BotConfig.isModuleActive("notifier")) Main.getInstance().getNotifier().getCredentialManager().load(); for (TwitchIntegration twitchIntegrations : @@ -833,7 +834,7 @@ public void createHeartbeatThread() { * @param args the arguments for the message that should be logged. */ public void logAnalytic(String message, Object... args) { - if (!Data.isDebug()) return; + if (!BotConfig.isDebug()) return; getAnalyticsLogger().debug(message, args); } diff --git a/src/main/java/de/presti/ree6/news/AnnouncementManager.java b/src/main/java/de/presti/ree6/news/AnnouncementManager.java index 5c77f577c..7b2ea8d43 100644 --- a/src/main/java/de/presti/ree6/news/AnnouncementManager.java +++ b/src/main/java/de/presti/ree6/news/AnnouncementManager.java @@ -1,6 +1,6 @@ package de.presti.ree6.news; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import lombok.Getter; import java.util.ArrayList; @@ -30,7 +30,7 @@ public class AnnouncementManager { * @param announcement Announcement to add. */ public static void addAnnouncement(Announcement announcement) { - if (!Data.isModuleActive("news")) return; + if (!BotConfig.isModuleActive("news")) return; announcementList.add(announcement); } @@ -42,7 +42,7 @@ public static void addAnnouncement(Announcement announcement) { * @return True if the Guild already received the announcement. */ public static boolean hasReceivedAnnouncement(long guildId, String announcementId) { - if (!Data.isModuleActive("news")) return true; + if (!BotConfig.isModuleActive("news")) return true; if (receivedAnnouncements.containsKey(guildId)) { return receivedAnnouncements.get(guildId).contains(announcementId); diff --git a/src/main/java/de/presti/ree6/utils/apis/ChatGPTAPI.java b/src/main/java/de/presti/ree6/utils/apis/ChatGPTAPI.java index 1df11006e..4ac8f8b02 100644 --- a/src/main/java/de/presti/ree6/utils/apis/ChatGPTAPI.java +++ b/src/main/java/de/presti/ree6/utils/apis/ChatGPTAPI.java @@ -6,7 +6,7 @@ import de.presti.ree6.language.LanguageService; import de.presti.ree6.main.Main; import de.presti.ree6.utils.data.ArrayUtil; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import io.sentry.Sentry; import net.dv8tion.jda.api.entities.Member; @@ -49,7 +49,7 @@ public void updatePreDefinedText(String addition) { * Method to initialise and create the API Wrapper Instance. */ public void initGPT() { - if (Data.isModuleActive("ai")) { + if (BotConfig.isModuleActive("ai")) { preDefinedInformation = Main.getInstance().getConfig().getConfiguration().getString("bot.misc.predefineInformation"); chatGPT = new ChatGPT(Main.getInstance().getConfig().getConfiguration().getString("openai.apiUrl", "https://api.openai.com/v1/chat/completions"), Main.getInstance().getConfig().getConfiguration().getString("openai.apiToken")); @@ -94,7 +94,7 @@ public static String getResponse(Member member, String message) { * @return the response by the Model. */ public static String getResponse(List messages) { - if (!Data.isModuleActive("ai")) return Data.shouldHideModuleNotification() ? "" : "AI Module has been disabled!"; + if (!BotConfig.isModuleActive("ai")) return BotConfig.shouldHideModuleNotification() ? "" : "AI Module has been disabled!"; return chatGPT.ask(Main.getInstance().getConfig().getConfiguration().getString("openai.model", "gpt-3.5-turbo-0301"), messages); } diff --git a/src/main/java/de/presti/ree6/utils/apis/Notifier.java b/src/main/java/de/presti/ree6/utils/apis/Notifier.java index 19e51bd79..3a7013715 100644 --- a/src/main/java/de/presti/ree6/utils/apis/Notifier.java +++ b/src/main/java/de/presti/ree6/utils/apis/Notifier.java @@ -38,7 +38,7 @@ import de.presti.ree6.sql.entities.TwitchIntegration; import de.presti.ree6.sql.entities.stats.ChannelStats; import de.presti.ree6.sql.entities.webhook.*; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.utils.data.DatabaseStorageBackend; import de.presti.ree6.utils.others.ThreadUtil; import de.presti.wrapper.entities.VideoResult; @@ -161,7 +161,7 @@ public class Notifier { * Constructor used to created instance of the API Clients. */ public Notifier() { - if (!Data.isModuleActive("notifier")) return; + if (!BotConfig.isModuleActive("notifier")) return; log.info("Initializing Twitch Client..."); try { @@ -170,7 +170,7 @@ public Notifier() { .build(); TwitchAuth.registerIdentityProvider(credentialManager, Main.getInstance().getConfig().getConfiguration().getString("twitch.client.id"), - Main.getInstance().getConfig().getConfiguration().getString("twitch.client.secret"), Data.getTwitchAuth()); + Main.getInstance().getConfig().getConfiguration().getString("twitch.client.secret"), BotConfig.getTwitchAuth()); twitchIdentityProvider = (TwitchIdentityProvider) credentialManager.getIdentityProviderByName("twitch").orElse(null); @@ -278,7 +278,7 @@ public Notifier() { .onChallenge(challengeHandler).build(); instagramClient.sendLoginRequest().exceptionally(throwable -> { - if (Data.isDebug()) { + if (BotConfig.isDebug()) { log.error("Failed to login to Instagram API, you can ignore this if you don't use Instagram.", throwable); } else { log.error("Failed to login to Instagram API, you can ignore this if you don't use Instagram."); @@ -427,7 +427,7 @@ public void createRssStream() { WebhookMessageBuilder webhookMessageBuilder = new WebhookMessageBuilder(); - webhookMessageBuilder.setUsername(Data.getBotName()); + webhookMessageBuilder.setUsername(BotConfig.getBotName()); webhookMessageBuilder.setAvatarUrl(BotWorker.getShardManager().getShards().get(0).getSelfUser().getEffectiveAvatarUrl()); WebhookEmbedBuilder webhookEmbedBuilder = new WebhookEmbedBuilder(); @@ -450,7 +450,7 @@ public void createRssStream() { webhookEmbedBuilder.setTitle(new WebhookEmbed.EmbedTitle(item.getChannel().getTitle(), null)); webhookEmbedBuilder.setAuthor(new WebhookEmbed.EmbedAuthor("Twitter Notifier", BotWorker.getShardManager().getShards().get(0).getSelfUser().getEffectiveAvatarUrl(), null)); - webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(Data.getAdvertisement(), BotWorker.getShardManager().getShards().get(0).getSelfUser().getEffectiveAvatarUrl())); + webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(BotConfig.getAdvertisement(), BotWorker.getShardManager().getShards().get(0).getSelfUser().getEffectiveAvatarUrl())); webhookEmbedBuilder.setTimestamp(Instant.now()); webhookEmbedBuilder.setColor(Color.CYAN.getRGB()); @@ -476,7 +476,7 @@ public void createRssStream() { WebhookMessageBuilder webhookMessageBuilder = new WebhookMessageBuilder(); - webhookMessageBuilder.setUsername(Data.getBotName()); + webhookMessageBuilder.setUsername(BotConfig.getBotName()); webhookMessageBuilder.setAvatarUrl(BotWorker.getShardManager().getShards().get(0).getSelfUser().getEffectiveAvatarUrl()); WebhookEmbedBuilder webhookEmbedBuilder = new WebhookEmbedBuilder(); @@ -496,7 +496,7 @@ public void createRssStream() { webhookEmbedBuilder.setTitle(new WebhookEmbed.EmbedTitle(item.getChannel().getTitle(), null)); webhookEmbedBuilder.setAuthor(new WebhookEmbed.EmbedAuthor("RSS Notifier", BotWorker.getShardManager().getShards().get(0).getSelfUser().getEffectiveAvatarUrl(), null)); - webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(Data.getAdvertisement(), BotWorker.getShardManager().getShards().get(0).getSelfUser().getEffectiveAvatarUrl())); + webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(BotConfig.getAdvertisement(), BotWorker.getShardManager().getShards().get(0).getSelfUser().getEffectiveAvatarUrl())); webhookEmbedBuilder.setTimestamp(Instant.now()); webhookEmbedBuilder.setColor(Color.CYAN.getRGB()); @@ -533,7 +533,7 @@ public void registerTwitchEventHandler() { WebhookMessageBuilder wmb = new WebhookMessageBuilder(); wmb.setAvatarUrl(BotWorker.getShardManager().getShards().get(0).getSelfUser().getEffectiveAvatarUrl()); - wmb.setUsername(Data.getBotName()); + wmb.setUsername(BotConfig.getBotName()); WebhookEmbedBuilder webhookEmbedBuilder = new WebhookEmbedBuilder(); @@ -551,7 +551,7 @@ public void registerTwitchEventHandler() { webhookEmbedBuilder.setDescription("**" + channelGoLiveEvent.getStream().getTitle() + "**\n[Watch Stream](" + twitchUrl + ")"); webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "**Game**", channelGoLiveEvent.getStream().getGameName())); webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "**Viewer**", String.valueOf(channelGoLiveEvent.getStream().getViewerCount()))); - webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(Data.getAdvertisement(), BotWorker.getShardManager().getShards().get(0).getSelfUser().getEffectiveAvatarUrl())); + webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(BotConfig.getAdvertisement(), BotWorker.getShardManager().getShards().get(0).getSelfUser().getEffectiveAvatarUrl())); webhookEmbedBuilder.setColor(Color.MAGENTA.getRGB()); wmb.addEmbeds(webhookEmbedBuilder.build()); @@ -739,7 +739,7 @@ public void createYTStream() { WebhookMessageBuilder webhookMessageBuilder = new WebhookMessageBuilder(); webhookMessageBuilder.setAvatarUrl(BotWorker.getShardManager().getShards().get(0).getSelfUser().getAvatarUrl()); - webhookMessageBuilder.setUsername(Data.getBotName()); + webhookMessageBuilder.setUsername(BotConfig.getBotName()); WebhookEmbedBuilder webhookEmbedBuilder = new WebhookEmbedBuilder(); @@ -757,7 +757,7 @@ public void createYTStream() { if (playlistItem.getUploadDate() != -1) webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "**Upload Date**", TimeFormat.DATE_TIME_SHORT.format(playlistItem.getUploadDate()))); - webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(Data.getAdvertisement(), BotWorker.getShardManager().getShards().get(0).getSelfUser().getAvatarUrl())); + webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(BotConfig.getAdvertisement(), BotWorker.getShardManager().getShards().get(0).getSelfUser().getAvatarUrl())); webhookEmbedBuilder.setColor(Color.RED.getRGB()); webhooks.forEach(webhook -> { @@ -913,7 +913,7 @@ public void createRedditPostStream() { WebhookMessageBuilder webhookMessageBuilder = new WebhookMessageBuilder(); webhookMessageBuilder.setAvatarUrl(BotWorker.getShardManager().getShards().get(0).getSelfUser().getAvatarUrl()); - webhookMessageBuilder.setUsername(Data.getBotName()); + webhookMessageBuilder.setUsername(BotConfig.getBotName()); WebhookEmbedBuilder webhookEmbedBuilder = new WebhookEmbedBuilder(); @@ -928,7 +928,7 @@ public void createRedditPostStream() { webhookEmbedBuilder.setDescription(URLDecoder.decode(redditPost.getSelftext(), StandardCharsets.UTF_8)); webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "**Author**", redditPost.getAuthor())); webhookEmbedBuilder.addField(new WebhookEmbed.EmbedField(true, "**Subreddit**", redditPost.getSubreddit())); - webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(Data.getAdvertisement(), BotWorker.getShardManager().getShards().get(0).getSelfUser().getAvatarUrl())); + webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(BotConfig.getAdvertisement(), BotWorker.getShardManager().getShards().get(0).getSelfUser().getAvatarUrl())); webhookEmbedBuilder.setColor(Color.ORANGE.getRGB()); @@ -1068,7 +1068,7 @@ public void createInstagramPostStream() { WebhookMessageBuilder webhookMessageBuilder = new WebhookMessageBuilder(); webhookMessageBuilder.setAvatarUrl(BotWorker.getShardManager().getShards().get(0).getSelfUser().getAvatarUrl()); - webhookMessageBuilder.setUsername(Data.getBotName()); + webhookMessageBuilder.setUsername(BotConfig.getBotName()); WebhookEmbedBuilder webhookEmbedBuilder = new WebhookEmbedBuilder(); @@ -1085,7 +1085,7 @@ public void createInstagramPostStream() { webhookEmbedBuilder.setDescription(user.getUsername() + " just posted something new on Instagram!"); } - webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(Data.getAdvertisement(), BotWorker.getShardManager().getShards().get(0).getSelfUser().getAvatarUrl())); + webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(BotConfig.getAdvertisement(), BotWorker.getShardManager().getShards().get(0).getSelfUser().getAvatarUrl())); webhookEmbedBuilder.setColor(Color.MAGENTA.getRGB()); @@ -1186,7 +1186,7 @@ public void createTikTokStream() { WebhookMessageBuilder webhookMessageBuilder = new WebhookMessageBuilder(); webhookMessageBuilder.setAvatarUrl(BotWorker.getShardManager().getShards().get(0).getSelfUser().getAvatarUrl()); - webhookMessageBuilder.setUsername(Data.getBotName()); + webhookMessageBuilder.setUsername(BotConfig.getBotName()); WebhookEmbedBuilder webhookEmbedBuilder = new WebhookEmbedBuilder(); @@ -1201,7 +1201,7 @@ public void createTikTokStream() { webhookEmbedBuilder.setDescription(user.getDisplayName() + " just posted something new on TikTok!"); } - webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(Data.getAdvertisement(), BotWorker.getShardManager().getShards().get(0).getSelfUser().getAvatarUrl())); + webhookEmbedBuilder.setFooter(new WebhookEmbed.EmbedFooter(BotConfig.getAdvertisement(), BotWorker.getShardManager().getShards().get(0).getSelfUser().getAvatarUrl())); webhookEmbedBuilder.setColor(Color.MAGENTA.getRGB()); diff --git a/src/main/java/de/presti/ree6/utils/data/Config.java b/src/main/java/de/presti/ree6/utils/data/Config.java index 07bae3021..377c2696c 100644 --- a/src/main/java/de/presti/ree6/utils/data/Config.java +++ b/src/main/java/de/presti/ree6/utils/data/Config.java @@ -30,6 +30,11 @@ public class Config { */ private YamlFile yamlTempFile; + /** + * The config version. + */ + private final String version = "3.0.17"; + /** * Initialize the Configuration. */ @@ -90,7 +95,7 @@ public void createConfigFile() { """); yamlFile.path("config") .comment("Do not change this!") - .path("version").addDefault("3.0.15") + .path("version").addDefault(version) .parent().path("creation").addDefault(System.currentTimeMillis()); yamlFile.path("hikari") @@ -108,7 +113,7 @@ public void createConfigFile() { .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.") @@ -130,12 +135,22 @@ public void createConfigFile() { .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 wanna allow users to let the Bot send their recording into the chat.") + .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("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("modules").comment("Customize the active modules in Ree6.").blankLine() + .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.") @@ -241,7 +256,7 @@ public void migrateOldConfig() { String configVersion = yamlFile.getString("config.version", "1.9.0"); if (compareVersion(configVersion, BotWorker.getBuild()) || configVersion.equals(BotWorker.getBuild()) || - configVersion.equals("3.0.15")) + configVersion.equals(version)) return; Map resources = yamlFile.getValues(true); diff --git a/src/main/java/de/presti/ree6/utils/data/ImageCreationUtility.java b/src/main/java/de/presti/ree6/utils/data/ImageCreationUtility.java index 400a76026..ef3ca8c3b 100644 --- a/src/main/java/de/presti/ree6/utils/data/ImageCreationUtility.java +++ b/src/main/java/de/presti/ree6/utils/data/ImageCreationUtility.java @@ -1,5 +1,6 @@ package de.presti.ree6.utils.data; +import de.presti.ree6.bot.BotConfig; import de.presti.ree6.bot.BotWorker; import de.presti.ree6.main.Main; import de.presti.ree6.sql.entities.level.UserLevel; @@ -473,7 +474,7 @@ public static BufferedImage resize(BufferedImage inputImage, int scaledWidth, in * @return the Font. */ public static Font retrieveFont(int size, String text) { - Font font = new Font(Data.getTextFont(), Font.PLAIN, size); + Font font = new Font(BotConfig.getTextFont(), Font.PLAIN, size); if (font.canDisplayUpTo(text) != -1) { font = new Font("Arial", Font.PLAIN, size); diff --git a/src/main/java/de/presti/ree6/utils/others/ModerationUtil.java b/src/main/java/de/presti/ree6/utils/others/ModerationUtil.java index faeef638b..e9ed9eec3 100644 --- a/src/main/java/de/presti/ree6/utils/others/ModerationUtil.java +++ b/src/main/java/de/presti/ree6/utils/others/ModerationUtil.java @@ -1,7 +1,7 @@ package de.presti.ree6.utils.others; import de.presti.ree6.sql.SQLSession; -import de.presti.ree6.utils.data.Data; +import de.presti.ree6.bot.BotConfig; import java.util.ArrayList; import java.util.Arrays; @@ -60,7 +60,7 @@ public static boolean checkBlacklist(String guildId, String word) { * @return true, if the Server should be moderated. */ public static boolean shouldModerate(String guildId) { - return Data.isModuleActive("moderation") && SQLSession.getSqlConnector().getSqlWorker().isChatProtectorSetup(guildId); + return BotConfig.isModuleActive("moderation") && SQLSession.getSqlConnector().getSqlWorker().isChatProtectorSetup(guildId); } /** From 8b368cd092d72d7b9cc1f7b43a21baef9d18cc5d Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 1 Dec 2023 11:24:57 +0000 Subject: [PATCH 11/23] Update jersey monorepo to v3.1.4 --- pom.xml | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/pom.xml b/pom.xml index 06d13adbd..697c7252f 100644 --- a/pom.xml +++ b/pom.xml @@ -232,12 +232,12 @@ org.glassfish.jersey.media jersey-media-json-jackson - 3.1.3 + 3.1.4 org.glassfish.jersey.core jersey-client - 3.1.3 + 3.1.4 From 482e84aa5631e6903e190e51593c3c15a4e5199a Mon Sep 17 00:00:00 2001 From: Presti Date: Fri, 1 Dec 2023 12:30:33 +0100 Subject: [PATCH 12/23] New Crowdin updates (#486) * New translations en-gb.yml (Portuguese, Brazilian) --- languages/pt-BR.yml | 705 ++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 705 insertions(+) create mode 100644 languages/pt-BR.yml diff --git a/languages/pt-BR.yml b/languages/pt-BR.yml new file mode 100644 index 000000000..8028e05fe --- /dev/null +++ b/languages/pt-BR.yml @@ -0,0 +1,705 @@ +language: + name: "Português (BR)" + locale: "pt-BR" + version: "3.0.15" + author: "louanfontenele" +logging: + banned: ":airplane_departure: %s **foi banido.**" + unbanned: ":airplane_arriving: %s **foi desbanido.**" + joined: + default: "%s **entrou no servidor.**\n:timer: Idade da Conta:\n**%s**\n**%s**" + bot: + found: "**O bot** %s **foi convidado por** %s" + notFound: "**Não conseguimos identificar quem convidou o bot** %s" + leave: "%s **entrou e saiu do servidor.**" + invite: + vanity: "%s **foi convidado através de convite personalizado.**" + default: "%s **foi convidado por** %s (Código: %s, Usos: %s)" + notFound: "**Não foi possível determinar quem convidou** %s" + left: + default: "%s **saiu do servidor.**\n:timer: Entrou em:\n**%s**" + slim: "%s **saiu do servidor.**" + timeout: + started: "**O usuário** %s **recebeu um timeout.**\n**Tempo:** %s" + updated: "**O usuário** %s **recebeu um timeout.**\n**Motivo:** %s\n**Moderador:** %s\n**Tempo:** %s" + ended: "**O usuário** %s **concluiu o seu timeout.**\n**Tempo:** %s" + nickname: + reset: "O apelido de %s foi redefinido.\n**Antigo Apelido:**\n%s" + changed: "O apelido de %s foi alterado.\n**Novo Apelido:**\n%s\n**Antigo Apelido:**\n%s" + voicechannel: + join: "%s **entrou no canal de voz** %s" + move: "%s **mudou do canal de voz** %s **para** %s**.**" + moveMany: "%s **mudou por vários canais de voz e agora está em** %s" + leave: "%s **saiu do canal de voz** %s" + leaveInstant: "%s **entrou e saiu imediatamente do canal de voz** %s" + rejoin: "%s **reentrou no canal de voz** %s" + channel: + update: + voice: ":house: **Canal de Voz atualizado:** %s" + chat: ":house: **Canal de Texto atualizado:** %s" + delete: + voice: ":house: **Canal de Voz excluído:** ``%s``" + chat: ":house: **Canal de Texto excluído:** ``%s``" + create: + voice: ":house: **Canal de Voz criado:** %s" + chat: ":house: **Canal de Texto criado:** %s" + member: ":writing_hand: %s **foi atualizado.**" + role: + create: ":family_mmb: ``%s`` **foi criado.**" + update: ":family_mmb: ``%s`` **foi atualizado.**" + delete: ":family_mmb: ``%s`` **foi excluído.**" + message: + deleted: ":wastebasket: **Mensagem de %s em %s foi excluída.**\n%s" + tooLong: "Mensagem é muito longa para exibir!" + attachmentFailed: "Não foi possível adicionar anexo da mensagem. Motivo: %s" + attachmentNotice: "Abaixo estão os anexos. Recomendamos cuidado ao lidar com esses arquivos!" +label: + status: "Status" + typ: "Tipo" + genres: "Gêneros" + aired: "Exibição" + episodes: "Episódios" + duration: "Duração" + averageRating: "Classificação Média" + rank: "Ranking" + randomCatImage: "Imagem de Gato Aleatória" + randomDogImage: "Imagem de Cachorro Aleatória" + published: "Publicado" + chapters: "Capítulos" + volumes: "Volumes" + randomMemeImage: "Imagem de Meme Aleatória" + monkey: "Macaco" + randomShibaImage: "Imagem de Shiba Aleatória" + character: "Personagem" + from: "De" + invite: "Convidar" + support: "Suporte" + serverId: "ID do Servidor" + creationDate: "Data de Criação" + owner: "Proprietário" + members: "Membros" + channels: "Canais" + other: "Outro" + verificationLevel: "Nível de Verificação" + notExisting: "Não Existente" + serverStats: "Estatísticas do Servidor" + guilds: "Guildas" + users: "Usuários" + botStats: "Estatísticas do Bot" + version: "Versão" + uptime: "Tempo de Atividade" + networkStats: "Estatísticas de Rede" + responseTime: "Tempo de Resposta" + systemDate: "Data do Sistema" + discordStats: "Estatísticas do Discord" + gatewayTime: "Tempo da Gateway" + shardAmount: "Quantidade de Shards" + shards: "Shards" + commandStats: "Estatísticas de Comandos" + topCommands: "Comandos Mais Usados" + overallTopCommands: "Comandos Mais Usados no Geral" + discordGuidelines: "Diretrizes do Discord" + chatLeaderboard: "Classificação de Chat" + voiceLeaderboard: "Classificação de Voz" + title: "Título" + description: "Descrição" + setupMenu: "Menu de Configuração" + auditLog: "Log de Auditoria" + welcomeChannel: "Canal de Boas-Vindas" + autoRole: "Auto-Rank" + temporalVoice: "Canal de Voz Temporário" + statistics: "Estatísticas" + ticketSystem: "Sistema de Tickets" + suggestionMenu: "Menu de Sugestões" + webinterface: "Interface Web" + musicPlayer: "Player de Música" + actor: "Ator" + oldName: "Nome Antigo" + newName: "Nome Novo" + nsfw: "NSFW" + roles: "Funções" + oldMentionable: "Antigo Mencionável" + newMentionable: "Novo Mencionável" + oldHoist: "Antigo Elevado" + newHoist: "Novo Elevado" + newPermissions: "Novas Permissões" + oldColor: "Cor Antiga" + newColor: "Nova Cor" + overallMembers: "Membros Totais" + realMembers: "Membros Reais" + botMembers: "Membros de Bot" + temporalVoiceName: "VC Temporário #%s" + chat: "Chat" + voice: "Voz" + startGame: "Iniciar Jogo" + joinGame: "Entrar no Jogo" + leaveGame: "Sair do Jogo" + blackJack: "BlackJack" + hit: "Pedir" + stand: "Parar" + userCards: "%ss **Cartas**" + userCardsSelf: "**Suas Cartas**" + suggestion: "Sugestão" + openTicket: "Abrir Ticket" + closeTicket: "Fechar Ticket" + setup: "Configuração" + delete: "Excluir" + backToMenu: "Voltar ao Menu" + setImage: "Definir Imagem" + ticket: "Ticket" + overallMembersName: "Membros Totais: %s" + realMembersName: "Membros Reais: %s" + botMembersName: "Membros de Bot: %s" + twitchCountName: "Seguidores no Twitch: %s" + youtubeCountName: "Inscritos no YouTube: %s" + redditCountName: "Membros no Subreddit: %s" + twitterCountName: "Seguidores no Twitter: %s" + instagramCountName: "Seguidores no Instagram: %s" + setupMemberStatistics: "Configurar Estatísticas de Membros" + setupTwitchStatistics: "Configurar Estatísticas do Twitch" + setupYoutubeStatistics: "Configurar Estatísticas do YouTube" + setupRedditStatistics: "Configurar Estatísticas do Reddit" + setupTwitterStatistics: "Configurar Estatísticas do Twitter" + setupInstagramStatistics: "Configurar Estatísticas do Instagram" + channelName: "Nome do Canal" + subreddit: "Subreddit" + name: "Nome" + selectChannel: "Selecionar um Canal!" + unknownMenu: "Menu Desconhecido" + language: "Idioma" + unknown: "Desconhecido" + recording: + start: "Gravação iniciada!" + name: "[\uD83D\uDD34] Gravação!" + finished: "Gravação concluída!" + download: "Baixar" + error: "Erro" + game: "Jogo" + viewer: "Espectador" + more: "Mais" + skip: "Pular" + musicQuiz: "Quiz de Música" + position: "Posição %s" + feedback: "Feedback" + github: "Github" + queueAdd: "Adicionar à Fila" + song: "Música" + shuffle: "Embaralhar" + loop: "Repetir" + loading: "Carregando" + blackJackWin: "Vitória no BlackJack" + musicQuizWin: "Vitória no MusicQuiz" + musicQuizFeatureGuess: "Palpite no Recurso do MusicQuiz" + musicQuizArtistGuess: "Palpite no Artista do MusicQuiz" + musicQuizTitleGuess: "Palpite no Título do MusicQuiz" + rewards: "Recompensas" + sendToChat: "Enviar no Chat" +message: + default: + usage: "Uso {guild_prefix}%s." + needPermission: "Parece que não tenho permissão para `%s`!" + insufficientPermission: "Parece que você não tem permissão para `%s`!" + noMention: + user: "Por favor, mencione um usuário!" + role: "Por favor, mencione um cargo!" + channel: "Por favor, mencione um canal!" + onlyNSFW: "Este comando só pode ser usado em canais NSFW!" + invalidQuery: "Por favor, forneça uma consulta válida!" + invalidUrl: "Por favor, forneça uma URL válida!" + checkBelow: "Confira abaixo!" + retrievalError: "Ocorreu um erro ao recuperar os dados!" + notInVoiceChannel: "Você não está em um canal de voz!" + notInSameVoiceChannel: "Você não está no mesmo canal de voz!" + alreadyInVoiceChannel: "Já estou em um canal de voz!" + image: + needed: "Uma imagem é necessária!" + tooBig: "A imagem é muito grande!" + tooBigMax: "A imagem é muito grande! Tamanho máximo: %sMB" + actionRequired: "Selecione uma ação!" + unknownMenu: "Houve um erro ao resolver o modal!" + invalidOption: "Você selecionou de alguma forma uma opção inválida! Você é um bruxo?" + invalidOptionChannel: "O canal fornecido não existe, como você o selecionou? Você é um bruxo?" + missingOption: "Você precisa fornecer um valor para a opção %s!" + nameChangeFailed: "Não foi possível alterar meu próprio apelido!" + time: + date: "Por favor, use uma data válida!\nObserve que usamos o formato dd.MM.yyyy (dia.mês.ano)!" + time: "Por favor, use um horário válido!\nObserve que usamos o formato HH/mm (hora/minuto (24 horas))!" + notEnough: "O tempo inserido não é suficiente!" + incorrectNumbers: "Por favor, insira valores numéricos corretos" + birthday: + added: + self: "Seu aniversário foi adicionado!" + other: "O aniversário de %s foi adicionado!" + noPerms: "Você não tem permissão para adicionar um aniversário!" + removed: + self: "Seu aniversário foi removido!" + other: "O aniversário de %s foi removido!" + noPerms: "Você não tem permissão para remover um aniversário!" + wish: "Feliz aniversário para <@%s>!" + instagramNotifier: + added: "Um Notificador do Instagram foi criado para o usuário %s!" + list: "Aqui estão todos os Notificadores do Instagram que foram configurados:\n```%s```" + removed: "Um Notificador do Instagram foi removido do usuário %s!" + redditNotifier: + added: "Um Notificador do Reddit foi criado para o subreddit %s!" + list: "Aqui estão todos os Notificadores do Reddit que foram configurados:\n```%s```" + removed: "Um Notificador do Reddit foi removido do subreddit %s!" + twitchNotifier: + added: "Um Notificador de Transmissão da Twitch foi criado para o canal %s!" + list: "Aqui estão todos os Notificadores da Twitch que foram configurados:\n```%s```" + removed: "Um Notificador de Transmissão da Twitch foi removido do canal %s!" + twitterNotifier: + added: "Um Notificador do Twitter foi criado para o usuário %s!" + list: "Aqui estão todos os Notificadores do Twitter que foram configurados:\n```%s```" + removed: "Um Notificador do Twitter foi removido do usuário %s!" + youtubeNotifier: + added: "Um Notificador de Vídeo do YouTube foi criado para o canal %s!" + list: "Aqui estão todos os Notificadores do YouTube que foram configurados:\n```%s```" + removed: "Um Notificador de Vídeo do YouTube foi removido do canal %s!" + tiktokNotifier: + added: "Um Notificador do TikTok foi criado para o usuário %s!" + list: "Aqui estão todos os Notificadores do TikTok que foram configurados:\n```%s```" + removed: "Um Notificador do TikTok foi removido do usuário %s!" + invalidUser: "Não conseguimos encontrar o usuário do TikTok fornecido!" + rssNotifier: + added: "Um Notificador de RSS foi criado para a URL %s!" + list: "Aqui estão todos os Notificadores de RSS que foram configurados:\n```%s```" + removed: "Um Notificador de RSS foi removido da URL %s!" + anime: + searching: "Procurando por Anime..." + found: "Anime encontrado!" + error: "Ocorreu um erro ao procurar Anime!" + game: + actionNeeded: "Você precisa especificar uma ação!" + valueNeeded: "Você precisa especificar um valor!" + invalidAction: "Por favor, forneça uma ação válida!" + invalidInvite: "Por favor, forneça um convite válido!" + gameAlreadyStarted: "O jogo já foi iniciado!" + availableGames: "Jogos disponíveis:" + hornyJail: "%s está agora na Prisão do Tesão!" + hug: "%s foi abraçado por %s!" + kiss: "%s foi beijado por %s!" + manga: + searching: "Procurando por Mangá..." + found: "Mangá encontrado!" + error: "Ocorreu um erro ao procurar Mangá!" + ping: "Pong" + record: + recordingStarted: "Agora estou gravando o canal de voz!" + recordingStopped: "Gravação interrompida!" + recordingError: "Ocorreu um erro ao gravar!" + slap: "%s foi esbofeteado por %s!" + addon: + list: "Lista de Addons:" + reloadAll: "Recarregando Addons...." + reloadedAll: "Todos os Addons recarregados com sucesso!" + credits: + default: "Conheça nossa equipe!" + easterEgg: "Conheça o Espião!" + optout: + optedOut: "Você foi excluído da coleta de dados!" + optedIn: "Você foi incluído na coleta de dados!" + leaderboards: "Abaixo desta mensagem, você pode encontrar os placares do servidor atual!\nPor favor, note que você precisa estar logado para ver essas estatísticas, de acordo com as diretrizes do Discord!" + ban: + success: "Banimento de %s realizado com sucesso!" + hierarchySelfError: "Você não pode banir alguém com um cargo igual ou superior ao seu!" + hierarchyBotError: "Eu não posso banir alguém com um cargo igual ou superior ao meu!" + blacklist: + addedList: "As seguintes palavras foram adicionadas à Lista Negra:" + added: "A palavra `%s` foi adicionada à Lista Negra!" + removed: "A palavra `%s` foi removida da Lista Negra!" + setupNeeded: "Você precisa configurar a Lista Negra primeiro!" + notFound: "A palavra `%s` não foi encontrada na Lista Negra!" + clear: + noNumber: "%s não é um número!" + notInRange: "%s não está entre 2 e 200!" + success: "Foram excluídas com sucesso %s mensagens!" + clearData: + success: "Todos os dados de convite foram excluídos com sucesso!" + cooldown: "Você só pode usar este comando uma vez a cada 10 minutos!" + import: + botRequired: "Por favor, forneça um bot do qual deseja importar dados!" + unknownBot: "Bot desconhecido!" + success: "Dados importados com sucesso de %s usuários!" + error: + unknown: "Ocorreu um erro desconhecido! (%s)" + noData: "Nenhum dado encontrado!" + visibility: "Você não pode importar dados de um bot que não é visível para todos!" + kick: + success: "Expulsão de %s realizada com sucesso!" + hierarchySelfError: "Você não pode expulsar alguém com um cargo igual ou superior ao seu!" + hierarchyBotError: "Eu não posso expulsar alguém com um cargo igual ou superior ao meu!" + mute: + invalidTime: "Por favor, forneça um tempo válido!" + success: "Silenciamento de %s por %ss realizado com sucesso!" + hierarchySelfError: "Você não pode silenciar alguém com um cargo igual ou superior ao seu!" + hierarchyBotError: "Eu não posso silenciar alguém com um cargo igual ou superior ao meu!" + prefix: + success: "Prefixo alterado com sucesso para `%s`!" + setup: + successImage: "Nova imagem de entrada definida com sucesso!" + setupMenu: "Qual configuração você deseja verificar?" + setupMenuPlaceholder: "Selecione uma etapa de configuração!" + steps: + auditLog: "Você pode configurar nosso próprio Registro de Auditoria, que fornece todas as informações por meio de um Webhook no canal de sua escolha!\nMas o nosso não é o mesmo que as auditorias padrão, o nosso permite que você defina o que deseja que seja registrado e o que não seja!\nTambém permitimos que você registre Eventos de Voz!" + welcome: "Você pode configurar nossas próprias Mensagens de Boas-Vindas!\nVocê pode escolher o Canal de Boas-Vindas por conta própria e até configurar a Mensagem!" + autoRole: "Você pode configurar nosso próprio sistema de Autorole!\nVocê pode selecionar funções que os usuários devem receber ao entrar no servidor!" + temporalVoice: "Você pode configurar seu próprio canal de Voz Temporário!\nConfigurando canais de voz temporários em um canal específico que será usado para criar um novo canal de voz sempre que alguém entrar nele!" + lang: "Você pode alterar a configuração de idioma do bot!" + suggestion: + suggestionMenu: "Clique no botão abaixo para sugerir algo!" + suggestionMenuPlaceholder: "Sugira algo!" + success: "Sistema de Sugestões configurado com sucesso!" + sent: "Sua sugestão foi enviada!" + footer: "Sugestão por %s" + notSetup: "Parece que o Sistema de Sugestões não está configurado corretamente!" + unban: + success: "Desbanimento de %s realizado com sucesso!" + notFound: "O usuário `%s` não foi encontrado!" + unmute: + success: "Desmutamento de %s realizado com sucesso!" + hierarchySelfError: "Você não pode desmutar alguém com um cargo igual ou superior ao seu!" + hierarchyBotError: "Eu não posso desmutar alguém com um cargo igual ou superior ao meu!" + music: + clearQueue: "A fila foi limpa!" + notPlaying: "Não estou tocando nada!" + notConnected: "Não estou conectado a um canal de voz!" + loop: + enabled: "O loop foi ativado!" + disabled: "O loop foi desativado!" + lyrics: + notFound: "Não foi possível encontrar a letra para %s." + foundUnlikely: "Letra para %s encontrada, mas é improvável que esteja correta: %s" + stop: "O player foi parado!" + pause: "O player foi pausado!" + resume: "O jogador foi retomado!" + shuffle: "A fila foi embaralhada!" + songInfo: "**Música:**```%s por %s```\n%s `[%s/%s]` %s" + songInfoSlim: "%s por %s" + songQueueEmpty: "A fila está vazia!" + songQueue: "A fila contém as seguintes músicas: %s" + volume: + success: "O volume foi ajustado para %s com sucesso!" + default: "O volume atual é %s!" + notFound: "Não foi possível encontrar a música ``%s``!" + notFoundMultiple: "Não foi possível encontrar ``%s`` músicas!" + searchFailed: "Ocorreu um erro ao buscar a música, por favor, tente novamente em alguns minutos!" + searchUrlFailed: "Não foi possível encontrar uma música com o URL ``%s``!" + songNext: "Próxima música!\nMúsica:``%s``" + songQueueReachedEnd: "Não há música nova!" + seek: + success: "Avançado para ``%s``!" + failed: "Você não pode avançar para uma posição que seja maior do que a duração da música!" + failedPlaying: "Erro ao reproduzir: ``%s``\nErro : %s" + failedLoading: "Erro ao carregar uma música: %s" + queueAdded: + default: "A música ``%s`` foi adicionada à fila!" + firstOfList: "A música ``%s`` foi adicionada à fila! (A primeira música da lista de reprodução: %s)" + skip: "Pulando para a próxima música na fila!" + nsfw: + searching: "Procurando por Conteúdo NSFW ..." + notAllowed: "O conteúdo que você está procurando não é permitido! Exemplo: loli hentai" + blacklisted: "Sua mensagem contém conteúdo bloqueado!" + levelUp: "Você subiu de nível para %s(%s)! %s" + gameCore: + needMore: "É necessário um mínimo de %s participantes para jogar este jogo!" + alreadyStarted: "O jogo já começou!" + full: "O jogo já está cheio!" + alreadyIn: "Você já é um participante deste jogo!" + minimalReached: "O número mínimo de participantes foi atingido!\nVocê pode iniciar o jogo clicando no botão abaixo!" + minimalReachedHost: "O número mínimo de participantes foi atingido!\nVocê pode iniciar o jogo clicando no botão na primeira mensagem!" + joined: "Agora você é um participante deste jogo!\nAguarde o anfitrião iniciar o jogo!" + blackJackGame: + welcome: "Bem-vindo ao Blackjack! Você pode iniciar o jogo clicando no botão abaixo!\nAntes de começar, você precisará de alguém para jogar com você!\nEles precisarão usar /game join %s para entrar no jogo!\nOu pressionar o botão abaixo!" + playerHand: "%s\n\nValor: %s" + end: + win: "O jogo terminou!\n%s venceu com um valor de %s!" + draw: "O jogo terminou!\nFoi um empate!" + turn: + player: "É a sua vez!" + wait: "Aguarde o outro jogador terminar a jogada!" + 8ball: + answers: + 1: "É certo." + 2: "É decididamente assim." + 3: "Sem dúvida." + 4: "Sim - definitivamente." + 5: "Você pode contar com isso." + 6: "Pelo que vejo, sim." + 7: "Muito provável." + 8: "Perspectiva boa." + 9: "Sim." + 10: "Os sinais apontam para sim." + 11: "Resposta vaga, tente novamente." + 12: "Pergunte novamente mais tarde." + 13: "Melhor não dizer agora." + 14: "Não é possível prever agora." + 15: "Concentre-se e pergunte novamente." + 16: "Não conte com isso." + 17: "Minha resposta é não." + 18: "Minhas fontes dizem que não." + 19: "Perspectiva não tão boa." + 20: "Muito duvidoso." + brs: + autoRole: + missingPermission: "Ree6-BRS (Sistema de Relatório de Bugs)\nDetectamos que não tenho permissão para atribuir funções automaticamente, pois estou sem a permissão ``Gerenciar Funções``!\nEu preciso dessa permissão para atribuir funções aos usuários!\nA função que não pude atribuir é ``%s``!" + hierarchy: "Ree6-BRS (Sistema de Relatório de Bugs)\nDetectamos que não posso atribuir funções automaticamente, pois minha função está abaixo da função de atribuição automática!\nPor favor, mova minha função acima da função de atribuição automática!\nA função que está causando o problema é ``%s``!" + deleted: "Ree6-BRS (Sistema de Relatório de Bugs)\nDetectamos que não posso atribuir funções automaticamente, pois a função de atribuição automática foi excluída!\nAgora removemos a função atribuída!" + ticket: + created: "Abrimos um ticket para você! Confira em %s" + alreadyOpen: "Você já tem um ticket em aberto!" + categoryNotFound: "A categoria do ticket não foi encontrada!" + alreadyArchived: "O ticket já está arquivado!" + close: "Ticket fechado!" + setup: "Você pode configurar seu próprio sistema de tickets!\nDefinindo um canal específico como Canal de Tickets, o Ree6 criará um novo Canal de Ticket para cada ticket que você criar!\nApós o fechamento do ticket, eles serão movidos para uma categoria de arquivo!" + menuDescription: "Ao clicar no botão abaixo, você pode abrir um ticket!" + setupSuccess: "Configurou o sistema de tickets com sucesso, ótimo trabalho!" + setupDescription: "Consulte o comando /tickets!" + deleted: "Canal de ticket excluído com sucesso, ótimo trabalho!" + statistics: + twitchSuccess: "Configurou com sucesso os canais de estatísticas para estatísticas do Twitch!" + youtubeSuccess: "Configurou com sucesso os canais de estatísticas para estatísticas do YouTube!" + youtubeNotFound: "Não conseguimos encontrar o canal fornecido! Você tem certeza de que o nome/id está correto?" + redditSuccess: "Configurou com sucesso os canais de estatísticas para estatísticas do Reddit!" + twitterSuccess: "Configurou com sucesso os canais de estatísticas para estatísticas do Twitter!" + instagramSuccess: "Configurou com sucesso os canais de estatísticas para estatísticas do Instagram!" + setup: "Você pode configurar seus próprios canais de estatísticas!\nDefinindo canais de estatísticas, o Ree6 criará novos canais para cada tipo de estatística que você configurar!\nSe você quiser se livrar de um canal de estatísticas, basta excluí-lo!" + memberSuccess: "Configurou com sucesso os canais de estatísticas para estatísticas de membros!" + temporalVoice: + setupSuccess: "Configurou com sucesso o canal de voz temporal, bom trabalho!" + setupDescription: "Qual canal você deseja usar como canal de voz temporal?" + deleted: "Canal de voz temporal excluído com sucesso, bom trabalho!" + auditLog: + setupSuccess: "Configurou com sucesso o canal de log, bom trabalho!" + setupDescription: "Qual canal você deseja usar como canal de log?" + deleted: "Canal de log excluído com sucesso, bom trabalho!" + welcome: + setupSuccess: "Configurou com sucesso o canal de boas-vindas, bom trabalho!" + setupDescription: "Qual canal você deseja usar como canal de boas-vindas?" + imageRequired: "Use o seguinte comando com uma imagem como anexo: `{guild_prefix}setup joinImage`!" + deleted: "Canal de boas-vindas excluído com sucesso, bom trabalho!" + lang: + setupSuccess: "Idioma alterado com sucesso para %s!" + recording: + started: "Estou gravando este canal de voz conforme solicitado por um participante!" + startReason: "Gravação iniciada por %s" + stopReason: "Gravação interrompida." + stopped: "Seu áudio foi convertido e agora está disponível para download!" + error: "Algo deu errado ao converter seu áudio!\nMotivo: %s" + inChat: "Sua gravação deve estar abaixo desta mensagem!" + notFound: "Não foi possível encontrar a gravação solicitada!" + reactions: + roleAssign: "Você atribuiu a função %s à reação com sucesso!" + reactionNeeded: "Você precisa reagir a esta mensagem com a reação que deseja atribuir a %s!" + roleNotFound: "A função que você deseja atribuir à reação não foi encontrada!" + removed: "Reação-Role removida com sucesso para a função %s!" + roleAdded: "Você recebeu a função %s!" + roleRemoved: "Você perdeu a função %s!" + musicQuiz: + welcome: "Bem-vindo ao Music Quiz! Você pode começar o jogo clicando no botão abaixo!\nAntes de começar, você precisará de alguém para jogar com você!\nEles precisarão usar /game join %s para entrar no jogo!\nOu pressionar o botão abaixo!" + foundTitle: "Você adivinhou o título, era %s! Você recebe 1 ponto" + foundArtists: "Você adivinhou os artistas, era %s! Você recebe 2 pontos" + foundFeature: "Você adivinhou um recurso, era %s! Você recebe 3 pontos" + foundAll: "Tudo foi adivinhado!" + skipSong: "A música foi pulada!" + finishedSong: "A música atual terminou, era %s por %s! Vamos começar com a próxima!" + newSong: "Adivinhe o título (1 ponto), os artistas (2 pontos) ou um recurso (3 pontos)" + points: "%s alcançou %s pontos" + announcement: + added: "Anúncio adicionado com sucesso!" + list: "Aqui está uma lista de todos os anúncios:\n```%s```" + removed: "Anúncio removido com sucesso!" + news: + enabled: "Recebimento de notícias ativado com sucesso!" + disabled: "Recebimento de notícias desativado com sucesso!" + notice: "Para desativar o recebimento de notícias, use /news" + stream-action: + added: "Adicionamos com sucesso a ação de transmissão com o nome **%s**" + addedLine: "Adicionamos com sucesso a ação de transmissão com o nome **%s**" + deleted: "Excluímos com sucesso a ação de transmissão com o nome **%s**" + deletedLine: "Excluímos com sucesso a linha de ação %s!" + alreadyExisting: "Encontramos uma ação de transmissão já existente com o nome **%s**" + list: "Aqui está uma lista de todas as ações de transmissão:\n```%s```" + actionList: "Aqui está uma lista de todas as ações:\n```%s```" + points: "Aqui está uma lista de todas as recompensas de pontos de canal!\nVerifique o points.txt!" + listener: "Você definiu o ouvinte para **%s**" + listenerArgument: "Você definiu o ouvinte para **%s** com o ID **%s**" + noTwitch: "Para usar esse recurso, precisamos que você autorize sua conta do Twitch! Consulte <%s> para fazer isso!" + notFound: "Não foi possível encontrar a ação de transmissão com o nome **%s**" + levelRole: + added: "Adicionamos com sucesso uma função de nível com a função **%s** e o nível **%s**" + removed: "Removemos com sucesso a função de nível com a função **%s** e o nível **%s**" + list: "Nos arquivos acima desta mensagem, você pode encontrar uma lista de todas as funções de nível!" + warn: + punishment: + created: "Você criou com sucesso uma punição!" + list: "Aqui está uma lista de todas as punições para este servidor:\n```%s```" + listEntry: + timeout: "Tempo limite por %s segundos" + roleAdd: "Adição de função por %s" + roleRemove: "Remoção de função por %s" + kick: "Expulsão com motivo %s" + ban: "Banimento com motivo %s" + deleted: "A punição com o ID %s foi excluída com sucesso." + notFound: "Não existe punição com o ID %s para este servidor." + success: "Você advertiu com sucesso %s!\nO usuário agora possui %s advertências!" + hierarchySelfError: "Você não pode advertir alguém com um cargo igual ou superior ao seu!" + hierarchyBotError: "Não posso advertir alguém com um cargo igual ou superior ao meu!" + reachedWarnings: "Atingiu %s advertências!" + infractions: + success: "O usuário %s possui %s infrações!" + empty: "O usuário %s não possui infrações!" + schedule: + added: "O agendamento foi criado com sucesso!" + delete: + success: "O agendamento foi excluído com sucesso!" + failed: "O agendamento fornecido não existe!" + list: "Aqui está uma lista de todos os agendamentos: ```%s```" + pickupline: + response: ":speaking_head: %s" + responseNsfw: ":red_circle: ||%s|| **NSFW**" + money: + notEnoughMoney: "Você não tem dinheiro suficiente para esta ação!" + withdraw: "Você retirou com sucesso %s$!" + deposit: "Você depositou com sucesso %s$!" + send: "Você enviou com sucesso %s$ para %s!" + balance: "O saldo de %s contém %s$ em dinheiro e %s$ no banco!" + steal: + success: "Você roubou com sucesso %s$ de %s!" + failed: "Você não conseguiu roubar %s$ de %s!" + cooldown: "Você está em cooldown! Você pode roubar novamente em cerca de %s segundos." + self: "Você não pode roubar de si mesmo!" + notEnoughMoney: "%s não tem dinheiro suficiente!" + work: + success: "Você trabalhou com sucesso e ganhou %s$!" + cooldown: "Você está em cooldown! Você pode trabalhar novamente em cerca de %s segundos." + failed: "Você não conseguiu trabalhar!" + rewards: + success: "Atualização de recompensas realizada com sucesso!" + giveaway: + created: "Sorteio criado com sucesso com o ID: ```%s```!" + finish: "O sorteio terminou e os vencedores são %s" + ended: "O sorteio já terminou." + reroll: "Rerolled: %s" + notFound: "Nenhum sorteio com o ID fornecido foi encontrado!" + notEnded: "O sorteio ainda não terminou." + reaction: + none: "Não há reações na mensagem do sorteio!" + less: "Não há reações suficientes na mensagem do sorteio!" + error: "Ocorreu um erro ao buscar as reações!" + list: + default: "Aqui está uma lista de todos os sorteios:\n```%s```" + entry: "ID: %s | Canal: %s | Vencedor: %s | Prêmio: %s | Encerra em: %s" +game: + description: + blackjack: "Jogue Blackjack com seus amigos!" + musicquiz: "Jogue um jogo de Quiz baseado em Música com seus amigos!" +command: + perform: + cooldown: "Você está em cooldown!" + missingCommand: "Por favor, forneça um comando!" + error: "Ocorreu um erro ao executar o comando!" + errorWithException: "Ocorreu um erro ao executar o comando!\nExceção: %s" + internalError: "Ocorreu um erro ao realizar o comando!\nSe isso continuar acontecendo, entre em contato com o nosso suporte!\n" + notFound: "Esse comando não pôde ser encontrado" + blocked: "Este comando está bloqueado!" + slashNotSupported: "Este comando ainda não suporta comandos de barra!" + onlySlashSupported: "Este comando só suporta comandos de barra!" + description: + pickupline: "Precisa de uma cantada? Nós temos você." + birthday: "Deixe o bot lembrar do seu aniversário." + instagramNotifier: "Gerencie seu Instagram-Notifier!" + redditNotifier: "Gerencie seu Reddit-Notifier!" + twitch: "Gerencie seu Twitch-Notifier!" + twitterNotifier: "Gerencie seu Twitter-Notifier!" + youtubeNotifier: "Gerencie seu Youtube-Notifier!" + tiktokNotifier: "Gerencie seu TikTok-Notifier!" + rssNotifier: "Gerencie seu Notificador de Feed RSS!" + anime: "Procure animes em kitsu.io!" + randomcat: "Mostra imagens aleatórias de gatos, do thecatapi.com." + cringe: "Deixe o Shrek dizer a eles que a mensagem deles foi cringe!" + cringe_slash: "Deixe o Shrek dizer a eles que a mensagem deles não foi engraçada!" + randomdog: "Mostra imagens aleatórias de cachorros, do dog.ceo." + funFact: "Apenas alguns fatos aleatórios!" + game: "Acesse os jogos internos do Ree6." + hornyjail: "Coloque alguém na Prisão do Tesão." + hornyjail_slash: "Coloque alguém na Prisão dos Mal-Comportados." + hug: "Abraçe alguém que você gosta!" + kiss: "Beije alguém!" + manga: "Procure mangás em kitsu.io!" + meme: "Quer ver alguns memes?" + monke: "Mostra uma imagem de um macaco." + ping: "Pong!" + 8ball: "Deixe a Magic 8Ball decidir o destino da sua pergunta." + record: "Grave o canal de voz!" + shiba: "Mostra uma imagem aleatória de um shiba, de shiba.online." + slap: "Dê um tapa na cara de alguém!" + twitter: "Crie um tweet \"realista\"!" + waifu: "Quer ver algumas Waifus ou Husbandos?" + addon: "Destinado apenas a desenvolvedores, usado para recarregar ou carregar novos addons." + test: "Apenas um comando de teste." + credits: "Veja a equipe linda e adorável que trabalha no Ree6!" + help: "Mostra uma lista de todos os comandos!" + info: "Mostra informações específicas do usuário." + invite: "Obtenha um link de convite para o Ree6!" + optout: "Opte por não participar da coleta de dados neste servidor." + server: "Veja informações específicas do servidor." + stats: "Veja as estatísticas do Ree6!" + support: "Receba um convite para o servidor de suporte do Ree6!" + leaderboard: "Mostra o placar de classificação do servidor atual" + level: "Mostre seu próprio nível ou o nível de outro usuário no servidor." + ban: "Banir um usuário específico do servidor." + blacklist: "Gerenciar os filtros do servidor." + clear: "Limpar uma quantidade específica de mensagens na conversa atual." + clearData: "Limpe todos os convites armazenados e substitua-os pelos atuais." + embedSender: "Envie uma mensagem incorporada." + import: "Importe dados de outro bot." + kick: "Expulse um usuário específico do servidor." + mute: "Silencie um usuário específico no servidor." + prefix: "Mude o prefixo do servidor." + setup: "Configure recursos específicos para o servidor." + suggestion: "Configure o sistema de sugestões!" + unban: "Desbanir um usuário específico do servidor." + unmute: "Dessilencie um usuário específico no servidor." + webinterface: "Mostra a URL para a interface web do Ree6." + clearQueue: "Limpe a fila de músicas do servidor." + disconnect: "Desconecte o bot do canal de voz." + loop: "Repita a música atual." + lyrics: "Mostra a letra da música que está tocando." + pause: "Pausar a música atual." + play: "Toque ou adicione uma música à fila." + resume: "Continue a música atual." + seek: "Vá para um momento específico na música atual." + shuffle: "Embaralhe a fila de músicas." + skip: "Pule algumas músicas na fila de músicas." + songinfo: "Mostra informações sobre a música atual." + songlist: "Mostra a fila de músicas." + stop: "Pare a música atual." + volume: "Mude o volume da música atual." + nsfw: "Mostra uma imagem NSFW aleatória." + rule34: "Mostra uma imagem Rule34 aleatória." + rule34_slash: "Mostra imagens não seguras para o trabalho de um site específico." + reactions: "Atribua cargos a reações em uma mensagem!" + announcement: "Crie um anúncio!" + stream-action: "Gerencie ações de transmissão que podem levar sua transmissão para o canal de voz!" + tickets: "Crie um sistema de tickets para se comunicar com sua comunidade!" + news: "Configure o recebimento de notícias do Ree6!" + levelrole: "Gerencie Auto-Roles para níveis de voz ou texto!" + warn: "Aviso a um usuário e deixe-o ser punido automaticamente." + infractions: "Mostra todos os avisos de um usuário." + musicpanel: "Acesse uma interface de usuário simples para gerenciar o sistema de música!" + schedule: "Agende mensagens para mais tarde ou para um horário repetido!" + money: "Gerencie seu dinheiro!" + steal: "Roube dinheiro de outros usuários!" + work: "Obtenha seu próprio dinheiro fazendo trabalhos!" + giveaway: "Gerencie sorteios!" +category: + info: "Usado para reunir informações ou fornecer informações." + moderation: "Ferramentas de moderação que podem ajudar você a gerenciar usuários ou evitar infrações nas regras do servidor." + music: "Utilitários de música que permitem que você se divirta com seus amigos através do poder da música!" + fun: "Utilitários divertidos que lhe dão o poder de fazer coisas bobas só porque você pode!" + level: "Ferramentas de nivelamento que permitem que você acompanhe o progresso no servidor." + community: "Ferramentas comunitárias que permitem que você interaja com sua comunidade." + economy: "Ferramentas econômicas que permitem que você gerencie seu dinheiro." + nsfw: "Conteúdo NSFW que só pode ser usado em canais NSFW." + hidden: "Comandos ocultos que só são visíveis para o proprietário do bot." From 50b2a0bdcdbf946c798c0cafebc7219879ee3146 Mon Sep 17 00:00:00 2001 From: Presti Date: Fri, 1 Dec 2023 12:36:50 +0100 Subject: [PATCH 13/23] Notice for some config values. --- src/main/java/de/presti/ree6/utils/data/Config.java | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/main/java/de/presti/ree6/utils/data/Config.java b/src/main/java/de/presti/ree6/utils/data/Config.java index 377c2696c..36ffd1838 100644 --- a/src/main/java/de/presti/ree6/utils/data/Config.java +++ b/src/main/java/de/presti/ree6/utils/data/Config.java @@ -124,11 +124,11 @@ public void createConfigFile() { .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.") From 1c587ff451b775a9faa11c04f1ea85b8f475bde3 Mon Sep 17 00:00:00 2001 From: Presti Date: Fri, 1 Dec 2023 12:39:11 +0100 Subject: [PATCH 14/23] Fix typo in documentation and also update Installer config. --- .../java/de/presti/ree6/installer/Config.java | 39 +++++++++++++------ .../de/presti/ree6/utils/data/Config.java | 2 +- 2 files changed, 28 insertions(+), 13 deletions(-) diff --git a/Ree6-Installer/src/main/java/de/presti/ree6/installer/Config.java b/Ree6-Installer/src/main/java/de/presti/ree6/installer/Config.java index 330896151..1d668861e 100644 --- a/Ree6-Installer/src/main/java/de/presti/ree6/installer/Config.java +++ b/Ree6-Installer/src/main/java/de/presti/ree6/installer/Config.java @@ -19,6 +19,11 @@ public class Config { */ private YamlFile yamlFile; + /** + * The config version. + */ + private final String version = "3.0.17"; + /** * Initialize the Configuration. */ @@ -59,7 +64,7 @@ public void createConfigFile() { """); yamlFile.path("config") .comment("Do not change this!") - .path("version").addDefault("3.0.15") + .path("version").addDefault(version) .parent().path("creation").addDefault(System.currentTimeMillis()); yamlFile.path("hikari") @@ -77,7 +82,7 @@ public void createConfigFile() { .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.") @@ -88,23 +93,33 @@ public void createConfigFile() { .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 wanna allow users to let the Bot send their recording into the chat.") + .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("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("modules").comment("Customize the active modules in Ree6.").blankLine() + .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.") @@ -211,8 +226,8 @@ public void createConfigFile() { public void migrateOldConfig() { String configVersion = yamlFile.getString("config.version", "1.9.0"); - if (compareVersion(configVersion, "3.0.15") || - configVersion.equals("3.0.15")) + if (compareVersion(configVersion, version) || + configVersion.equals(version)) return; Map resources = yamlFile.getValues(true); @@ -286,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. diff --git a/src/main/java/de/presti/ree6/utils/data/Config.java b/src/main/java/de/presti/ree6/utils/data/Config.java index 36ffd1838..e0fb6153d 100644 --- a/src/main/java/de/presti/ree6/utils/data/Config.java +++ b/src/main/java/de/presti/ree6/utils/data/Config.java @@ -330,7 +330,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. From acd02908bacaf3cd103cdf127452c3a3ebe05a6b Mon Sep 17 00:00:00 2001 From: Presti Date: Fri, 1 Dec 2023 12:42:54 +0100 Subject: [PATCH 15/23] Bump version. --- Ree6-Installer/pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/Ree6-Installer/pom.xml b/Ree6-Installer/pom.xml index eae670b57..16fd7eb16 100644 --- a/Ree6-Installer/pom.xml +++ b/Ree6-Installer/pom.xml @@ -6,7 +6,7 @@ de.presti Ree6-Installer - 2.0.0 + 2.1.0 17 From eb3b7a4a224249181f90766ec4422aadab02f186 Mon Sep 17 00:00:00 2001 From: Presti Date: Fri, 1 Dec 2023 14:26:47 +0100 Subject: [PATCH 16/23] Bug fixing. --- src/main/java/de/presti/ree6/audio/music/TrackScheduler.java | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/src/main/java/de/presti/ree6/audio/music/TrackScheduler.java b/src/main/java/de/presti/ree6/audio/music/TrackScheduler.java index ecd9832c2..f811c8e74 100644 --- a/src/main/java/de/presti/ree6/audio/music/TrackScheduler.java +++ b/src/main/java/de/presti/ree6/audio/music/TrackScheduler.java @@ -182,7 +182,7 @@ public void nextTrack(MessageChannelUnion textChannel, int position, boolean sil .setDescription(LanguageService.getByGuild(guildMusicManager.getGuild(), "message.music.songNext", FormatUtil.filter(track.getInfo().title))) .setFooter(guildMusicManager.getGuild().getName() + " - " + BotConfig.getAdvertisement(), guildMusicManager.getGuild().getIconUrl()), 5, getChannel()); - Main.getInstance().getEventBus().post(new MusicPlayerStateChangeEvent(textChannel.asGuildMessageChannel().getGuild(), MusicPlayerStateChangeEvent.State.PLAYING, track)); + Main.getInstance().getEventBus().post(new MusicPlayerStateChangeEvent(guildMusicManager.getGuild(), MusicPlayerStateChangeEvent.State.PLAYING, track)); player.playTrack(track.makeClone(), false); } else { if (!silent) @@ -194,7 +194,7 @@ public void nextTrack(MessageChannelUnion textChannel, int position, boolean sil .setDescription(LanguageService.getByGuild(guildMusicManager.getGuild(), "message.music.songQueueReachedEnd")) .setFooter(guildMusicManager.getGuild().getName() + " - " + BotConfig.getAdvertisement(), guildMusicManager.getGuild().getIconUrl()), 5, getChannel()); - Main.getInstance().getEventBus().post(new MusicPlayerStateChangeEvent(textChannel.asGuildMessageChannel().getGuild(), MusicPlayerStateChangeEvent.State.QUEUE_EMPTY, null)); + Main.getInstance().getEventBus().post(new MusicPlayerStateChangeEvent(guildMusicManager.getGuild(), MusicPlayerStateChangeEvent.State.QUEUE_EMPTY, null)); } } From 024ab5328daaff4ffc6d8e7b4de8291b32326b3a Mon Sep 17 00:00:00 2001 From: Presti Date: Fri, 1 Dec 2023 14:28:55 +0100 Subject: [PATCH 17/23] Another silly bug fix. --- .../de/presti/ree6/logger/invite/InviteContainerManager.java | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/main/java/de/presti/ree6/logger/invite/InviteContainerManager.java b/src/main/java/de/presti/ree6/logger/invite/InviteContainerManager.java index 7dad87a4f..c3e8ddfe5 100644 --- a/src/main/java/de/presti/ree6/logger/invite/InviteContainerManager.java +++ b/src/main/java/de/presti/ree6/logger/invite/InviteContainerManager.java @@ -77,7 +77,7 @@ public static Invite convertVanityInvite(Guild guild) { guild.getVanityCode() != null) { try { VanityInvite vanityInvite = guild.retrieveVanityInvite().complete(); - return new InviteImpl(null, vanityInvite.getCode(), true, Objects.requireNonNull(guild.getOwner()).getUser(), 0, -1242525, + return new InviteImpl(null, vanityInvite.getCode(), true, Objects.requireNonNullElse(guild.getOwner(), guild.getSelfMember()).getUser(), 0, -1242525, true, OffsetDateTime.now(), vanityInvite.getUses(), null, null, null, null, Invite.InviteType.UNKNOWN); } catch (Exception ex) { log.error("[InviteManager] Error while retrieving Vanity Invite: " + ex.getMessage()); From 1b846cf38ce411530d3510d06034dd7099f61487 Mon Sep 17 00:00:00 2001 From: Presti Date: Fri, 1 Dec 2023 14:38:54 +0100 Subject: [PATCH 18/23] Bump. --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 697c7252f..e604c0a0d 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ de.presti Ree6 - 3.0.17 + 3.0.18 jar From ba2456b03b202451343009e9b69f7691c5086506 Mon Sep 17 00:00:00 2001 From: Presti Date: Fri, 1 Dec 2023 15:12:07 +0100 Subject: [PATCH 19/23] Preventing SpotifyAPIHandler to cause everything else to fall asleep. --- pom.xml | 8 +------- .../java/de/presti/ree6/utils/apis/SpotifyAPIHandler.java | 7 +++++-- 2 files changed, 6 insertions(+), 9 deletions(-) diff --git a/pom.xml b/pom.xml index e604c0a0d..5c38ca6fb 100644 --- a/pom.xml +++ b/pom.xml @@ -10,7 +10,7 @@ de.presti Ree6 - 3.0.18 + 3.0.19 jar @@ -116,12 +116,6 @@ se.michaelthelin.spotify spotify-web-api-java 8.3.4 - - - commons-codec - commons-codec - - de.ree6 diff --git a/src/main/java/de/presti/ree6/utils/apis/SpotifyAPIHandler.java b/src/main/java/de/presti/ree6/utils/apis/SpotifyAPIHandler.java index a8e3b26df..0fe36d9e3 100644 --- a/src/main/java/de/presti/ree6/utils/apis/SpotifyAPIHandler.java +++ b/src/main/java/de/presti/ree6/utils/apis/SpotifyAPIHandler.java @@ -68,7 +68,7 @@ public class SpotifyAPIHandler { public SpotifyAPIHandler() { try { initSpotify(); - } catch (ParseException | SpotifyWebApiException | IOException e) { + } catch (Exception e) { log.error("Couldn't create a Spotify Instance", e); } instance = this; @@ -84,7 +84,10 @@ public SpotifyAPIHandler() { public void initSpotify() throws ParseException, SpotifyWebApiException, IOException { if (isSpotifyConnected) return; - this.spotifyApi = new SpotifyApi.Builder().setClientId(Main.getInstance().getConfig().getConfiguration().getString("spotify.client.id")).setClientSecret(Main.getInstance().getConfig().getConfiguration().getString("spotify.client.secret")).build(); + this.spotifyApi = new SpotifyApi.Builder() + .setClientId(Main.getInstance().getConfig().getConfiguration().getString("spotify.client.id")) + .setClientSecret(Main.getInstance().getConfig().getConfiguration().getString("spotify.client.secret")) + .build(); try { ClientCredentialsRequest.Builder request = new ClientCredentialsRequest.Builder(spotifyApi.getClientId(), spotifyApi.getClientSecret()); From e62d7c551a62ff9786437e82f45e964c169effe4 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 1 Dec 2023 14:12:33 +0000 Subject: [PATCH 20/23] Update dependency ch.qos.logback:logback-classic to v1.4.14 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5c38ca6fb..42d9e4cd8 100644 --- a/pom.xml +++ b/pom.xml @@ -168,7 +168,7 @@ ch.qos.logback logback-classic - 1.4.13 + 1.4.14 From 11db4cc57ab56fb058b5f04ea4990f804912bb7b Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Fri, 1 Dec 2023 14:12:37 +0000 Subject: [PATCH 21/23] Update dependency org.apache.httpcomponents.client5:httpclient5 to v5.2.3 --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 5c38ca6fb..de6d02eb4 100644 --- a/pom.xml +++ b/pom.xml @@ -239,7 +239,7 @@ org.apache.httpcomponents.client5 httpclient5 - 5.2.2 + 5.2.3 From 390613557608e9afaf376ef0406487d1d6f36a29 Mon Sep 17 00:00:00 2001 From: Presti Date: Fri, 1 Dec 2023 16:30:02 +0100 Subject: [PATCH 22/23] Cleanup documentation. --- .../presti/ree6/audio/music/MusicWorker.java | 20 ++++++++++--------- 1 file changed, 11 insertions(+), 9 deletions(-) diff --git a/src/main/java/de/presti/ree6/audio/music/MusicWorker.java b/src/main/java/de/presti/ree6/audio/music/MusicWorker.java index 328d18dd0..25a433262 100644 --- a/src/main/java/de/presti/ree6/audio/music/MusicWorker.java +++ b/src/main/java/de/presti/ree6/audio/music/MusicWorker.java @@ -45,7 +45,7 @@ import java.util.regex.Matcher; /** - * Wrapper class that handles most Music related stuff. + * Wrapper class that handles most Music-related stuff. */ @Slf4j public class MusicWorker { @@ -67,7 +67,9 @@ public MusicWorker() { musicManagers = new HashMap<>(); playerManager = BotConfig.shouldUseLavaLink() ? Main.getInstance().getLavalink().getAudioPlayerManager() : new DefaultAudioPlayerManager(); - // Register AudioSources, if music module is active. If not, then don't register them. This will cause a failed resolve when ever a command is being executed. + // Register AudioSources if music module is active. + // If not, then don't register them. + // This will cause a failed resolve whenever a command is being executed. if (BotConfig.isModuleActive("music") && !BotConfig.shouldUseLavaLink()) { playerManager.registerSourceManager(SoundCloudAudioSourceManager.createDefault()); playerManager.registerSourceManager(new BandcampAudioSourceManager()); @@ -105,7 +107,7 @@ public synchronized GuildMusicManager getGuildAudioPlayer(Guild guild) { * @param channel the TextChannel where the command has been performed, used for errors. * @param audioChannel the AudioChannel for the Bot to join. * @param trackUrl the Track URL. - * @param interactionHook a InteractionHook if it was an SlashCommand. + * @param interactionHook an InteractionHook if it was a SlashCommand. */ public void loadAndPlaySilence(final MessageChannelUnion channel, final AudioChannel audioChannel, final String trackUrl, InteractionHook interactionHook) { loadAndPlay(channel, audioChannel, trackUrl, interactionHook, true); @@ -118,7 +120,7 @@ public void loadAndPlaySilence(final MessageChannelUnion channel, final AudioCha * @param channel the TextChannel where the command has been performed. * @param audioChannel the AudioChannel for the Bot to join. * @param trackUrl the Track URL. - * @param interactionHook a InteractionHook if it was an SlashCommand. + * @param interactionHook an InteractionHook if it was a SlashCommand. * @param silent if the Bot shouldn't send a Message. */ public void loadAndPlay(final MessageChannelUnion channel, final AudioChannel audioChannel, final String trackUrl, InteractionHook interactionHook, boolean silent) { @@ -131,7 +133,7 @@ public void loadAndPlay(final MessageChannelUnion channel, final AudioChannel au * @param channel the TextChannel where the command has been performed. * @param audioChannel the AudioChannel for the Bot to join. * @param trackUrl the Track URL. - * @param interactionHook a InteractionHook if it was an SlashCommand. + * @param interactionHook an InteractionHook if it was a SlashCommand. * @param silent if the Bot shouldn't send a Message. * @param force if the song should be forced or not. */ @@ -146,7 +148,7 @@ public void loadAndPlay(final MessageChannelUnion channel, final AudioChannel au * @param channel the TextChannel where the command has been performed. * @param audioChannel the AudioChannel for the Bot to join. * @param trackUrl the Track URL. - * @param interactionHook a InteractionHook if it was an SlashCommand. + * @param interactionHook an InteractionHook if it was a SlashCommand. * @param silent if the Bot shouldn't send a Message. * @param force if the song should be forced or not. */ @@ -191,7 +193,7 @@ public void loadAndPlay(final Guild guild, MessageChannelUnion channel, AudioCha playerManager.loadItemOrdered(musicManager, trackUrl.trim(), new AudioLoadResultHandler() { /** - * Just override the default trackLoaded with a simple play call. + * Override the default trackLoaded with a simple play call. * @param track the AudioTrack that you want to play */ @Override @@ -209,7 +211,7 @@ public void trackLoaded(AudioTrack track) { } /** - * Just override the default playlistLoaded with a rather simple play and queue call. + * Override the default playlistLoaded with a rather simple play and queue call. * @param playlist the AudioPlaylist. */ @Override @@ -473,7 +475,7 @@ public void skipTrack(MessageChannelUnion channel, InteractionHook interactionHo * A method used to seek to a specific position in the current AudioTrack. * * @param channel the TextChannel, used to inform the user about the seek. - * @param seekAmountInSeconds the amount of seconds that should be seeked. + * @param seekAmountInSeconds the number of seconds that should be seeked. */ public void seekInTrack(MessageChannelUnion channel, int seekAmountInSeconds) { getGuildAudioPlayer(channel.asGuildMessageChannel().getGuild()).getScheduler().seekPosition(channel, seekAmountInSeconds); From a54d4812b902d4b7556550e6c2c10373196081c0 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Sun, 3 Dec 2023 15:32:21 +0100 Subject: [PATCH 23/23] Update dependency dev.arbjerg:lavaplayer to v2.0.4 (#490) Co-authored-by: renovate[bot] <29139614+renovate[bot]@users.noreply.github.com> --- pom.xml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/pom.xml b/pom.xml index 426333e6e..c83520e15 100644 --- a/pom.xml +++ b/pom.xml @@ -52,7 +52,7 @@ dev.arbjerg lavaplayer - 2.0.3 + 2.0.4 com.sedmelluq