You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Within UpdateMessageInteractionResponseCreateBuilder, there's non-nullable fields named components, embeds and files, each populated with an empty list.
This empty list makes it impossible to persist components, embeds and files without having to redefine them.
This is also inconsistent with the regular MessageBehavior.edit {} API, and inconsistent with JDA, both of which can persist components, embeds and files without having to redefine them anywhere in the code.
With the given example above, clicking the button would only change the content of the message to a random double, leaving the button and other input intact.
Actual behaviour
The message gets edited to a random double, while also removing the input.
Workarounds
Tell the API you're deferring an edit, and edit using the original message behaviour and its API.
Manually adding all components that were originally on the message.
Forcefully setting the lists to null (which would've normally cleared this bug entirely) will bug-check due to Optional having an explicit non-nullable API.
Extra
This may affect other aspects of code.
Side effect of fixing this will bring a breaking API change to applications expecting the current behaviour, which is clearing on interaction edit or fixing the list itself.
The text was updated successfully, but these errors were encountered:
Ampflower
changed the title
Responding to interaction with public message update implicitly clears components
Responding to interaction with public message update implicitly clears components, embeds & files
Oct 16, 2022
Description
Within
UpdateMessageInteractionResponseCreateBuilder
, there's non-nullable fields named components, embeds and files, each populated with an empty list.kord/rest/src/main/kotlin/builder/message/create/UpdateMessageInteractionResponseCreateBuilder.kt
Lines 20 to 30 in 8e2a2d0
This empty list makes it impossible to persist components, embeds and files without having to redefine them.
This is also inconsistent with the regular
MessageBehavior.edit {}
API, and inconsistent with JDA, both of which can persist components, embeds and files without having to redefine them anywhere in the code.Steps to reproduce
In this case, it happened with buttons.
Expected behaviour
With the given example above, clicking the button would only change the content of the message to a random double, leaving the button and other input intact.
Actual behaviour
The message gets edited to a random double, while also removing the input.
Workarounds
Forcefully setting the lists to null (which would've normally cleared this bug entirely) will bug-check due to Optional having an explicit non-nullable API.
Extra
This may affect other aspects of code.
Side effect of fixing this will bring a breaking API change to applications expecting the current behaviour, which is clearing on interaction edit or fixing the list itself.
The text was updated successfully, but these errors were encountered: