From 623e7850ee2b63230b23da7a8377d62120a009e0 Mon Sep 17 00:00:00 2001 From: freya02 <41875020+freya022@users.noreply.github.com> Date: Sun, 30 Jun 2024 15:51:27 +0200 Subject: [PATCH] Improve troubleshooting unknown interactions (#56) --- docs/introduction/faq.md | 4 ++++ docs/using-jda/troubleshooting.md | 33 +++++++++++++++++++++++++++++-- 2 files changed, 35 insertions(+), 2 deletions(-) diff --git a/docs/introduction/faq.md b/docs/introduction/faq.md index 3f38501..0f9a80b 100644 --- a/docs/introduction/faq.md +++ b/docs/introduction/faq.md @@ -284,6 +284,10 @@ Didn't find an answer? Try asking in [our Discord server](https://discord.gg/0hM The JDK provides a utility for creating a thread dump of a running JVM process: `jstack -l ` (that's an L for "Long") Example: `jstack -l 1337 > dump.txt` This will list the thread dump and write it to a file called `dump.txt`. + !!! tip + + You can get the PID using `jps -l`. + You can also create a thread dump directly in IntelliJ: ![](../assets/images/ide/thread_dump_1.png) diff --git a/docs/using-jda/troubleshooting.md b/docs/using-jda/troubleshooting.md index d4f9127..297bbeb 100644 --- a/docs/using-jda/troubleshooting.md +++ b/docs/using-jda/troubleshooting.md @@ -335,12 +335,41 @@ If you use these intents you are limited to 100 guilds on your bot. To allow the ## Interactions and Slash Commands -### This interaction failed / Unknown Interaction +### The application did not respond This means you didn't acknowledge or reply to an interaction in time. You only have **3 seconds** to reply or acknowledge. -You have to use `event.deferReply().queue()`, `event.deferEdit().queue()`, `event.editMessage(...).queue()`, or `event.reply(...).queue()`. (If you don't `queue()` it won't do it) +You have to use `event.deferReply().queue()`, `event.deferEdit().queue()`, `event.editMessage(...).queue()`, +or `event.reply(...).queue()`. (If you don't `queue()` it won't do it)
**Make sure your event listener code is executed.** +### Unknown Interaction + +This exception can happen due to two reasons: + +#### The interaction took longer than **3 seconds** to be acknowledged + +Possible reasons why your response was too slow: + +- JDA's WebSocket thread was blocked for too long, when you see the `This application did not respond` on Discord, +make a thread dump and look at the stack trace around `JDA MainWS-ReadThread` to see where it may have blocked +- Your interaction took too long to acknowledge, you can use `event.deferReply(boolean).queue()` to extend the response time to 15 minutes + +!!! tip "Making a thread dump" + + See `How do I make a thread dump?` in the [FAQ](../introduction/faq.md). + +#### The interaction was acknowledged by another process running the same bot + +You can confirm this by checking if your bot replied, +or the three dots in a button disappeared without saying `This interaction failed`, +or you see '[Bot] is thinking...' for more than 3 seconds. + +To resolve this, try stopping all current processes for the bot that could be responsible, or resetting your bot token. + +!!! tip "Resetting your token" + + You can reset your token in your [application dashboard](https://discord.com/developers/applications). + ### Interaction Followup Messages Timed out This means you sent followup messages through `InteractionHook.sendMessage(...)` or similar but never acknowledged the interaction.