jda-commands
jda-commands copied to clipboard
[BUG] DM message error
When I send a message to a user in DM, I get this error:
java.lang.IllegalStateException: This message event did not happen in a guild
at net.dv8tion.jda.api.events.message.GenericMessageEvent.getGuild(GenericMessageEvent.java:155)
at com.github.kaktushose.jda.commands.dispatching.GenericEvent.fromEvent(GenericEvent.java:54)
at com.github.kaktushose.jda.commands.dispatching.CommandContext.<init>(CommandContext.java:88)
at com.github.kaktushose.jda.commands.dispatching.parser.impl.MigratingMessageParser.parse(MigratingMessageParser.java:33)
at com.github.kaktushose.jda.commands.dispatching.parser.impl.MigratingMessageParser.parse(MigratingMessageParser.java:26)
at com.github.kaktushose.jda.commands.dispatching.parser.Parser.parseInternal(Parser.java:19)
at com.github.kaktushose.jda.commands.dispatching.parser.ParserSupervisor.onGenericEvent(ParserSupervisor.java:95)
at net.dv8tion.jda.api.hooks.ListenerAdapter.onEvent(ListenerAdapter.java:365)
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:169)
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:954)
at net.dv8tion.jda.internal.requests.WebSocketClient.onEvent(WebSocketClient.java:841)
at net.dv8tion.jda.internal.requests.WebSocketClient.handleEvent(WebSocketClient.java:819)
at net.dv8tion.jda.internal.requests.WebSocketClient.onBinaryMessage(WebSocketClient.java:993)
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)
I'm on JDA alpha 13 and on commit e9c1d76c6b
of the dev-jda5
branch (latest).
Can you also provide your source code?
It's a closed source bot for a customer, so I can't. If you need help debugging I can create an example throwing this same error.
The problem is that I dont understand what's going on. Is the bot sending a DM? Is the bot receiving a DM? Did the bot respond to a command executed in DMs?
The bot is sending a DM to a user in the command handling.
should be fixed with 4.0.0-alpha.1