Skip to content

Commit

Permalink
Merge pull request #5 from IOL-Haven/fix-class-loader
Browse files Browse the repository at this point in the history
Fix resources being inaccessible to the command manager
  • Loading branch information
TechnoPorg authored Sep 22, 2024
2 parents 4d3b8c2 + 069b6dd commit 7b3950b
Showing 1 changed file with 2 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
import discord4j.discordjson.json.ApplicationCommandRequest;
import discord4j.rest.RestClient;
import discord4j.rest.service.ApplicationService;
import org.iolhaven.discord_verifier.DiscordVerifier;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;

Expand Down Expand Up @@ -78,7 +79,7 @@ private static List<String> getCommandsJson(List<String> fileNames) throws IOExc
* @return The contents of the file as a String, otherwise throws an exception
*/
private static String getResourceFileAsString(String fileName) throws IOException {
ClassLoader classLoader = ClassLoader.getSystemClassLoader();
ClassLoader classLoader = DiscordVerifier.class.getClassLoader();
try (InputStream resourceAsStream = classLoader.getResourceAsStream(fileName)) {
if (resourceAsStream == null) return null;
try (InputStreamReader inputStreamReader = new InputStreamReader(resourceAsStream);
Expand Down

0 comments on commit 7b3950b

Please sign in to comment.