andersfylling / disgord

Go module for interacting with the documented Discord's bot interface; Gateway, REST requests and voice
BSD 3-Clause "New" or "Revised" License
502 stars 71 forks source link

Ability to add/edit files through Session.EditInteractionResponse() #496

Closed Cufee closed 2 years ago

Cufee commented 2 years ago

Describe the bug Possibly incorrect type used in as message argument in Session.EditInteractionResponse(ctx context.Context, interaction *InteractionCreate, message *Message) error It looks like this type is missing some fields that are available when creating the interaction response. From some discussions on the Discord server, it looks like the right type there might be UpdateMessage instead of Message.

Expected behavior session.EditInteractionResponse(...) should accept UpdateMessage as type for the message argument.

Error messages N/A

Desktop (please complete the following information):

Additional context I am rewriting my bot using Disgord and am looking for a way to edit an interaction message after it has been sent due to a possibility that some commands may take more than 3 seconds to process. The solution I found is to reply to the user interaction instantly with a loading status and edit the message once the response is ready.

The issue I ran into is that I am not able to add new files to the interaction message after it has been sent. I noticed that a recent change was made to session.SendInteractionResponse in order to accept Data: CreateInteractionResponseData, which allows me to add files as CreateMessageFile, but I am not able to add/edit a file using CreateMessageFile through EditInteractionResponse.

andersfylling commented 2 years ago

That seems sound. Do you want to throw up a PR for this?

Cufee commented 2 years ago

I got the type changed over, but I am still not able to add a file to an existing interaction message. I wonder if that's not something Discord API currently supports Found the issue, updated the PR.