K
Kord3y ago
tmpod

Edit message components in-place

Hello, I'm trying to make a convenience function to disable a message's action buttons, however, I can't seem to find an interface to easily apply the existing message components and then edit them. Am I missing something? The code would be something like this:
suspend fun Message.disableButtons() {
edit {
actionRows.forEach { row ->
row.interactionButtons.values.forEach { btn ->
// smth?
}
}
// apply?
}
}
suspend fun Message.disableButtons() {
edit {
actionRows.forEach { row ->
row.interactionButtons.values.forEach { btn ->
// smth?
}
}
// apply?
}
}
2 Replies
gdude
gdude3y ago
kord doesn't provide anything like that editing the components on a message replaces all of them so you'd need to re-add them all to the message builder (this is what the component container in kordex is for)
tmpod
tmpodOP3y ago
(sorry for the very delayed follow-up) Oh I see, I'll try using containers then. Thank you!

Did you find this page helpful?