From f3ffa19bfa463b638df15c39306ba895e97e76fd Mon Sep 17 00:00:00 2001 From: ChomeNS <95471003+ChomeNS@users.noreply.github.com> Date: Sun, 2 Mar 2025 15:38:12 +0700 Subject: [PATCH] refactor: remove debug song loading error logging in SongLoaderThread & some minor refactors with the comments --- build-number.txt | 2 +- .../chomens_bot/song/SongLoaderThread.java | 19 +++++++------------ 2 files changed, 8 insertions(+), 13 deletions(-) diff --git a/build-number.txt b/build-number.txt index 7f3589da..d2fc5e3e 100644 --- a/build-number.txt +++ b/build-number.txt @@ -1 +1 @@ -1651 \ No newline at end of file +1654 \ No newline at end of file diff --git a/src/main/java/me/chayapak1/chomens_bot/song/SongLoaderThread.java b/src/main/java/me/chayapak1/chomens_bot/song/SongLoaderThread.java index 4533ca76..1bfcdfb1 100644 --- a/src/main/java/me/chayapak1/chomens_bot/song/SongLoaderThread.java +++ b/src/main/java/me/chayapak1/chomens_bot/song/SongLoaderThread.java @@ -15,8 +15,7 @@ import java.util.ArrayList; import java.util.List; import java.util.stream.Stream; -// Author: _ChipMC_ or hhhzzzsss? also i modified it to use runnable -// because thread = bad !!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!! +// Author: _ChipMC_ & hhhzzzsss public class SongLoaderThread extends Thread { // should the converters be here? public static final List converters = new ArrayList<>(); @@ -81,14 +80,12 @@ public class SongLoaderThread extends Thread { public void run () { if (isFolder && !isUrl && !isItem) { try (Stream files = Files.list(songPath)) { - if (files != null) { - files.forEach((file) -> { - songPath = file; - processFile(); - }); + files.forEach((file) -> { + songPath = file; + processFile(); + }); - showAddedToQueue(); - } + showAddedToQueue(); } catch (IOException e) { bot.logger.error(e); } @@ -126,9 +123,7 @@ public class SongLoaderThread extends Thread { try { song = converter.getSongFromBytes(bytes, name, bot); - } catch (Exception e) { - bot.logger.error(e); - } + } catch (Exception ignored) {} } if (song == null) {