Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Couldn't handle packet of type INTERACTION_CREATE #795

Closed
Bastian opened this issue Jun 30, 2021 · 2 comments · Fixed by #801
Closed

Couldn't handle packet of type INTERACTION_CREATE #795

Bastian opened this issue Jun 30, 2021 · 2 comments · Fixed by #801
Labels
🐛 bug Something isn't working ✔️ resolved A resolved issue
Milestone

Comments

@Bastian
Copy link
Member

Bastian commented Jun 30, 2021

2021-06-30 21:27:11.979+0200 WARN org.javacord.core.util.gateway.PacketHandler Couldn't handle packet of type INTERACTION_CREATE. Please contact the developer! (packet: {"version":1,"type":3,"token":"<redacted>","message":{"id":"859877451131256832","flags":64},"member":{"user":{"username":"Bastian","public_flags":768,"id":"157862224206102529","discriminator":"0310","avatar":"b69de4679e4ee28c5235e75a6eca4aa3"},"roles":["151325992038825984"],"premium_since":null,"permissions":"137438953471","pending":false,"nick":"Bastian","mute":false,"joined_at":"2016-03-11T15:31:25.546000+00:00","is_pending":false,"deaf":false,"avatar":null},"id":"859877752002052116","guild_id":"151037561152733184","data":{"custom_id":"success","component_type":2},"channel_id":"151326329839681536","application_id":"157889000391180288"}) {shard=0} 
 java.lang.AssertionError
	at java.util.Optional.orElseThrow(Optional.java:290)
	at org.javacord.core.interaction.InteractionImpl.<init>(InteractionImpl.java:60)
	at org.javacord.core.interaction.MessageComponentInteractionImpl.<init>(MessageComponentInteractionImpl.java:37)
	at org.javacord.core.interaction.ButtonInteractionImpl.<init>(ButtonInteractionImpl.java:18)
	at org.javacord.core.util.handler.interaction.InteractionCreateHandler.handle(InteractionCreateHandler.java:61)
	at org.javacord.core.util.gateway.PacketHandler.lambda$handlePacket$0(PacketHandler.java:51)

This happened when clicking on a button that was created with the following code:

SlashCommand.with("example", "An example command").createForServer(api.getServerById(151037561152733184L).get()).join();

api.addSlashCommandCreateListener(event -> {
    SlashCommandInteraction slashCommandInteraction = event.getSlashCommandInteraction();
    if (slashCommandInteraction.getCommandName().equals("example")) {
        slashCommandInteraction.createImmediateResponder()
            .setContent("Slash commands are cool!")
            .setFlags(MessageFlag.EPHEMERAL)
            .addComponents(
                ActionRow.of(Button.success("success", "And"),
                    Button.danger("danger", "buttons"),
                    Button.secondary("secondary", "are too!")))
            .respond();
    }
});
@Bastian Bastian added the 🐛 bug Something isn't working label Jun 30, 2021
@puttydotexe
Copy link

Temporary workaround is removing the EPHEMERAL flag from the setFlags# constructor.

@felldo
Copy link
Member

felldo commented Jul 3, 2021

The issue is Discord sends ephemeral messages in the same format as messages in DM's. This results in a missing guild_id and therefore we create a private channel as we currently assume messages without a guild_id is a DM.

felldo added a commit to felldo/Javacord that referenced this issue Jul 3, 2021
…where ephemeral messages are missing the guild_id when sent in a server
@felldo felldo linked a pull request Jul 3, 2021 that will close this issue
felldo added a commit to felldo/Javacord that referenced this issue Jul 4, 2021
…where ephemeral messages are missing the guild_id when sent in a server
felldo added a commit to felldo/Javacord that referenced this issue Jul 5, 2021
…where ephemeral messages are missing the guild_id when sent in a server
felldo added a commit that referenced this issue Jul 5, 2021
…phemeral messages are missing the guild_id when sent in a server
@Bastian Bastian added the ✔️ resolved A resolved issue label Jul 8, 2021
@Bastian Bastian added this to the Next Version milestone Jul 8, 2021
@Bastian Bastian closed this as completed Jul 8, 2021
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
🐛 bug Something isn't working ✔️ resolved A resolved issue
Projects
None yet
Development

Successfully merging a pull request may close this issue.

3 participants