From a9e24b0d2e1b7fc15f3c4bc92c365153b2127a6d Mon Sep 17 00:00:00 2001 From: Astrea49 <25420078+Astrea49@users.noreply.github.com> Date: Sun, 12 Jun 2022 15:57:16 -0400 Subject: [PATCH] fix: properly set embed json for Message --- interactions/api/models/message.py | 14 ++++++++++++++ 1 file changed, 14 insertions(+) diff --git a/interactions/api/models/message.py b/interactions/api/models/message.py index c0cc1fa03..8f0552b13 100644 --- a/interactions/api/models/message.py +++ b/interactions/api/models/message.py @@ -834,6 +834,20 @@ class Message(ClientSerializerMixin): converter=convert_list(Sticker), default=None ) # deprecated + def __attrs_post_init__(self): + if self.embeds: + # note from astrea49: this dumb fix is necessary to make sure the _json + # is correct when using a dict for the embeds when initializing + # otherwise, attributes like the footer will be missing or incorrect + # i have no idea why this is necessary and i've have tried debugging for hours + # to find why it's necessary, but i've came up with nothing + # by all means, the converters and json should be correct, but it isn't + # this also happens nowhere else as far as i can tell + + # this line should NOT be touched unless you somehow find a solution to + # this, or end up modifying how _json works altogether + self._json["embeds"] = [e._json for e in self.embeds] + async def get_channel(self) -> Channel: """ Gets the channel where the message was sent.