Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Can't edit messages to remove all components. #232

Open
MacDue opened this issue Jul 2, 2021 · 4 comments
Open

Can't edit messages to remove all components. #232

MacDue opened this issue Jul 2, 2021 · 4 comments

Comments

@MacDue
Copy link
Contributor

MacDue commented Jul 2, 2021

It does not seem like it's currently possible to remove all buttons from a message when handling an interaction with createInteractionResponse().

To remove all buttons/components you must set the components field to an empty array, however, if you do this it appears that the JSON serializer ignores the component field (not adding it or the empty array in the update) -- making it impossible to remove buttons.

The root issue seems to be treating an empty vector as representing not present, it probably should be something like std::optional<std::vector<Components>> to separate the "not present" and "empty" states.

@MacDue
Copy link
Contributor Author

MacDue commented Jul 2, 2021

The minimal fix for my bot was to add json::OPTIONAL_NON_EMPTY_FIELD which means the the "components" field is always sent. This is not a true fix though since it means you can't ever not edit the components now (which is fine for me currently).

@yourWaifu
Copy link
Owner

yourWaifu commented Jul 4, 2021

I wonder what a vector with one nullptr does. I might make that represent the empty array value.

@MacDue
Copy link
Contributor Author

MacDue commented Jul 4, 2021

I wonder what a vector with one nullptr does. I might make that represent the empty array value.

I tried a vector with an empty action bar and that was an invalid request, I'm not sure if [null] would be but I would guess it might be.

Edit: I see what you mean, that'd probably work for this case if handled to just produce an empty array in the serializer.

@MacDue
Copy link
Contributor Author

MacDue commented Jul 9, 2021

This issue extends to more than just components. You can't edit a message to remove the "content" if you want to edit a message to contain just an embed (in an interaction -- but I assume it holds for the normal edit message)

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants