@OneDeus

Как правильно сделать InputStream?

@Override
    public void onMessageReceived(@NotNull MessageReceivedEvent event) {
        InputStream inputStream = JDBCType.class.getClassLoader().getResourceAsStream("resources/embed/embed.json");
        if (event.getMessage().getContentStripped().startsWith("embed")) {
            event.getChannel().sendMessageEmbeds(jsonToEmbed((JsonObject) JsonParser.parseReader(new InputStreamReader(inputStream)))).queue();
        }
    }

java.lang.NullPointerException
	at java.base/java.io.Reader.<init>(Reader.java:168)
	at java.base/java.io.InputStreamReader.<init>(InputStreamReader.java:76)
	at core.task.GuildJoinHandler.onMessageReceived(GuildJoinHandler.java:38)
	at net.dv8tion.jda.api.hooks.ListenerAdapter.onEvent(ListenerAdapter.java:361)
	at net.dv8tion.jda.api.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:96)
	at net.dv8tion.jda.internal.hooks.EventManagerProxy.handleInternally(EventManagerProxy.java:88)
	at net.dv8tion.jda.internal.hooks.EventManagerProxy.handle(EventManagerProxy.java:70)
	at net.dv8tion.jda.internal.JDAImpl.handleEvent(JDAImpl.java:164)
	at net.dv8tion.jda.internal.handle.MessageCreateHandler.handleInternally(MessageCreateHandler.java:127)
	at net.dv8tion.jda.internal.handle.SocketHandler.handle(SocketHandler.java:36)
	at net.dv8tion.jda.internal.requests.WebSocketClient.onDispatch(WebSocketClient.java:957)
	at net.dv8tion.jda.internal.requests.WebSocketClient.onEvent(WebSocketClient.java:844)
	at net.dv8tion.jda.internal.requests.WebSocketClient.handleEvent(WebSocketClient.java:822)
	at net.dv8tion.jda.internal.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:996)
	at com.neovisionaries.ws.client.ListenerManager.callOnBinaryMessage(ListenerManager.java:385)
	at com.neovisionaries.ws.client.ReadingThread.callOnBinaryMessage(ReadingThread.java:276)
	at com.neovisionaries.ws.client.ReadingThread.handleBinaryFrame(ReadingThread.java:996)
	at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:755)
	at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:108)
	at com.neovisionaries.ws.client.ReadingThread.runMain(ReadingThread.java:64)
	at com.neovisionaries.ws.client.WebSocketThread.run(WebSocketThread.java:45)
  • Вопрос задан
  • 110 просмотров
Решения вопроса 1
Vamp
@Vamp
Вероятнее всего нужно путь прописать с ведущим слешем:

"/resources/embed/embed.json"
Ответ написан
Пригласить эксперта
Ваш ответ на вопрос

Войдите, чтобы написать ответ

Войти через центр авторизации
Похожие вопросы