Skip to content

Commit c7137ee

Browse files
authored
fix: properly set embed json for Message (#851)
1 parent 1629b42 commit c7137ee

File tree

1 file changed

+14
-0
lines changed

1 file changed

+14
-0
lines changed

interactions/api/models/message.py

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -877,6 +877,20 @@ class Message(ClientSerializerMixin):
877877
converter=convert_list(Sticker), default=None
878878
) # deprecated
879879

880+
def __attrs_post_init__(self):
881+
if self.embeds:
882+
# note from astrea49: this dumb fix is necessary to make sure the _json
883+
# is correct when using a dict for the embeds when initializing
884+
# otherwise, attributes like the footer will be missing or incorrect
885+
# i have no idea why this is necessary and i've have tried debugging for hours
886+
# to find why it's necessary, but i've came up with nothing
887+
# by all means, the converters and json should be correct, but it isn't
888+
# this also happens nowhere else as far as i can tell
889+
890+
# this line should NOT be touched unless you somehow find a solution to
891+
# this, or end up modifying how _json works altogether
892+
self._json["embeds"] = [e._json for e in self.embeds]
893+
880894
async def get_channel(self) -> Channel:
881895
"""
882896
Gets the channel where the message was sent.

0 commit comments

Comments
 (0)