nyxx-discord / nyxx

Wrapper around Discord API for Dart
Apache License 2.0
326 stars 49 forks source link

Getting Unknown Interaction when using commads #658

Open IsmailAlamKhan opened 4 months ago

IsmailAlamKhan commented 4 months ago

Describe the bug I am trying to make a command the selections work but when trying to respond after selection and an api call I get an error saying Unknown interaction (10062).

To Reproduce

  1. Create a command.
  2. Add some selection
  3. Make an api call based on those selection
  4. Respond using the fetched image using ChatContext.respond.

Expected behavior The image should be sent to the server.

Screenshots Screenshot 2024-05-04 at 3 33 37 PM

Desktop (please complete the following information):

Additional context I think maybe because of the api call the webhook is getting disconnected? But I am not sure about that.

IsmailAlamKhan commented 4 months ago

Ok if I respond before after the selection and before the api call the image is successfully sent

MCausc78 commented 4 months ago

"10062/Unknown Interaction" always means that interaction timed out. You have 3 seconds to respond to interaction. For support with nyxx/nyxx_commands you can join our discord guild

IsmailAlamKhan commented 4 months ago

oh @MCausc78 thanks for letting me know.

abitofevrything commented 4 months ago

Can you provide more information? As @MCausc78 says, this error is happening because the interaction is timing out - but this shouldn't be an issue here: 1) If you're using context.getSelection, this is already responding to the interaction 2) Once the selection is made, the context should be updated to point to the new interaction 3) nyxx_commands should automatically respond in less than 3 seconds if you don't

So. This shouldn't be happening. Do you perhaps have slow internet? In that case you can try setting CommandOptions.autoAcknowledgeDuration to something like 1 second?

IsmailAlamKhan commented 4 months ago

So basically get selections are working, after the second selection I make an API call which downloads and image and then I respond with that image. Now its working if I send a respond after the last selection something like please wait the image is being fetched.

abitofevrything commented 4 months ago

Ok, I think I have an idea of what was going wrong. I'll keep this open for bookmarking - thanks!