DiscordSRV

DiscordSRV

86.8k Downloads

Account for null authors at receiving Discord messages from a webhook (NPE)

mb243 opened this issue · 1 comments

commented

When you generate a message to a WebHook bot within the Discord channel, DiscordSRV doesn't take it well and can't pass it to the game chat.

Here's the goods:

[Tue Jan 03 16:33:42 UTC 2017 WARN] [16:33:42] [Fatal] [JDA]: One of the EventListeners had an uncaught exception
[Tue Jan 03 16:33:42 UTC 2017 WARN] [16:33:42] [Fatal] [JDA]: Encountered an exception:
[Tue Jan 03 16:33:42 UTC 2017 WARN] [16:33:42] [Fatal] [JDA]: java.lang.NullPointerException
    at com.scarsz.discordsrv.listeners.DiscordListener.onGuildMessageReceived(DiscordListener.java:29)
    at com.scarsz.discordsrv.jda.hooks.ListenerAdapter.onEvent(ListenerAdapter.java:166)
    at com.scarsz.discordsrv.jda.hooks.InterfacedEventManager.handle(InterfacedEventManager.java:64)
    at com.scarsz.discordsrv.jda.handle.MessageReceivedHandler.handleDefaultMessage(MessageReceivedHandler.java:81)
    at com.scarsz.discordsrv.jda.handle.MessageReceivedHandler.handleInternally(MessageReceivedHandler.java:50)
    at com.scarsz.discordsrv.jda.handle.SocketHandler.handle(SocketHandler.java:38)
    at com.scarsz.discordsrv.jda.requests.WebSocketClient.handleEvent(WebSocketClient.java:596)
    at com.scarsz.discordsrv.jda.requests.WebSocketClient.onTextMessage(WebSocketClient.java:324)
    at com.neovisionaries.ws.client.ListenerManager.callOnTextMessage(ListenerManager.java:352)
    at com.neovisionaries.ws.client.ReadingThread.callOnTextMessage(ReadingThread.java:233)
    at com.neovisionaries.ws.client.ReadingThread.callOnTextMessage(ReadingThread.java:211)
    at com.neovisionaries.ws.client.ReadingThread.handleTextFrame(ReadingThread.java:910)
    at com.neovisionaries.ws.client.ReadingThread.handleFrame(ReadingThread.java:693)
    at com.neovisionaries.ws.client.ReadingThread.main(ReadingThread.java:102)
    at com.neovisionaries.ws.client.ReadingThread.run(ReadingThread.java:61)
commented

IMO this might happen because the WebHook bot doesn't actually show in the list of channel members.
¯\(ツ)