serenity-rs / poise

Discord bot command framework for serenity, with advanced features like edit tracking and flexible argument parsing
MIT License
624 stars 111 forks source link

Fix modal acknowledgement #200

Closed arqunis closed 1 year ago

arqunis commented 1 year ago

Discord has ceased accepting the DeferredUpdateMessage response type for acknowledging a modal, which has resulted in errors propping up when using modals via poise.

This fixes said errors by switching to the alternative DeferredChannelMessageWithSource type. In addition, the response to the modal is made ephemeral to prevent a " is thinking..." message from appearing, waiting to be replaced by proper message content, which will never happen.

kangalio commented 1 year ago

This will show a "This interaction failed" after 5 seconds in an ephemeral box for the invoking user, right?

arqunis commented 1 year ago

This will show a "This interaction failed" after 5 seconds in an ephemeral box for the invoking user, right?

That message is displayed when a client to Discord's API fails to respond within the 3 second timeframe upon receiving an interaction. With DeferredChannelMessageWithSource, for the user a " is thinking..." message is shown, which will last a few minutes before expiring.

kangalio commented 1 year ago

Hm okay. Is there no way anymore to just acknowledge a modal submit without replying with a text?

arqunis commented 1 year ago

Hm okay. Is there no way anymore to just acknowledge a modal submit without replying with a text?

No, unless they would add a new response type just for acknowledging a modal.

kangalio commented 1 year ago

That's sad.

The modal API in poise was built with the assumption that you can acknowledge a model submit without any further input needed. I suppose this workaround with the ephemeral loading indicator will have to do for now as a workaround