Is there a way to serialize PublicMessageInteractionResponseBehavior ?
Hi there.
Is there a way to serialize an instance of PublicMessageInteractionResponseBehavior?
it doesn't seem to have an id field
and i need to put some kind of id
inside of my discord component's
custom id, so i can serialize it back
later, and edit the response
3 Replies
Behaviors cannot be serialised, you'll need to write your own serializer. However, if you have the ID, you may be able to use the
unsafe
propery on the Kord
object to reconstruct the behaviorto use a InteractionReponseBehavior, you also need its token and that's only valid for 15 minutes
but if you e.g. have a button on a message and that button is pressed, you'll receive a new interaction that will also allow you to edit the message the button was attached to
I solved it by using a mutablemap which key is a UUID and the value is PublicMessageInteractionResponseBehavior, and then i can just serialize the UUID