aquelemiguel / parrot

🦜 A hassle-free, highly performant, self-hosted Discord music bot with YouTube and Spotify support. Powered by yt-dlp.
MIT License
136 stars 44 forks source link

Interaction has already been acknowledged. #201

Closed StaticRocket closed 2 years ago

StaticRocket commented 2 years ago

📝 Description

So there's been a change to the way interaction responses are handled which causes some issues with the error reporting. If we attempt to create a new response and there's already an existing response the following is returned:

parrot  | thread 'tokio-runtime-worker' panicked at 'failed to create response: Serenity(Http(UnsuccessfulRequest(ErrorResponse { status_code: 400, url: Url { [TRUNCATED] }, error: DiscordJsonError { code: 40060, message: "Interaction has already been acknowledged.", errors: [] } })))', src/handlers/serenity.rs:373:14

It's an easy fix, but I figured I would ask how we'd like to address it: A) Clobber the old response with the new one B) Create a followup message when creating the initial response fails

Unfortunately I don't know of a clean way to implement this with the current error handling built into the create_embed_response at the moment.

🪜 Reproduction Steps

  1. Play a video that has been privated or has been deleted (https://www.youtube.com/watch?v=cwFQpRTwaP0 for example
  2. The application will respond indicating that it is searching
  3. yt-dlp will throw an error since the video is inaccessible
  4. The application will attempt to respond with an error but will fail because the initial response still exists

ℹ Environment / Computer Info

📸 Screenshots

No response