K
Kord•2w ago
tmpod

Removing components from message with edit

I've seen this being done elsewhere, but I'm being dense right now and just can't do it on Kord. Inside a MessageModifyBuilder block, I've tried setting components to null, empty list, I've tried calling components { }, I've tried adding an empty action row in there (actionRow { }). In all cases, I get the following:
{"components":{"0":{"components":{"_errors":[{"code":"BASE_TYPE_REQUIRED","message":"This field is required"}]}}}}
{"components":{"0":{"components":{"_errors":[{"code":"BASE_TYPE_REQUIRED","message":"This field is required"}]}}}}
What am I missing?
GitHub
Trying to remove all buttons from a message, getting "Cannot have e...
Basically the title, im trying to edit a message in order to remove its buttons. Currently im doing it like this: message.editMessage(MessageEditData.fromMessage(message)).setActionRow().queue() Th...
2 Replies
Moon
Moon•2w ago
send an emptyList for the components list
tmpod
tmpodOP•2w ago
Sry, forgot to reply to this 😅 AbstractMessageModifyBuilder#components is a mutable list and I've tried setting it to mutableListOf(), to no avail. Enabled tracing and noticed it always sends an empty action row: "components":[{"type":1}] You can get it working by building the request manually like this:
kord.rest.interaction.modifyFollowupMessage(
applicationId,
token,
followup.id,
FollowupMessageModifyRequest(
...
components = Optional.Value(emptyList())
)
)
kord.rest.interaction.modifyFollowupMessage(
applicationId,
token,
followup.id,
FollowupMessageModifyRequest(
...
components = Optional.Value(emptyList())
)
)

Did you find this page helpful?