From 83819767ce1c8f5750b5aed1edcffeb252c2f1c9 Mon Sep 17 00:00:00 2001 From: zeroo | inject <153208404+zerootoad@users.noreply.github.com> Date: Fri, 28 Jun 2024 11:38:18 +0200 Subject: [PATCH] Update webhook.py --- discord_webhook/webhook.py | 16 ++++++++++++++++ 1 file changed, 16 insertions(+) diff --git a/discord_webhook/webhook.py b/discord_webhook/webhook.py index 7b1ff06..d6aeb8d 100644 --- a/discord_webhook/webhook.py +++ b/discord_webhook/webhook.py @@ -213,6 +213,22 @@ def get_embed_fields(self) -> List[Dict[str, Optional[Any]]]: """ return self.fields + def to_dict(self) -> Dict[str, Any]: + embed = { + "title": self.title, + "description": self.description, + "url": self.url, + "timestamp": self.timestamp, + "color": self.color, + "footer": self.footer, + "image": self.image, + "thumbnail": self.thumbnail, + "video": self.video, + "provider": self.provider, + "author": self.author, + "fields": self.fields, + } + return {k: v for k, v in embed.items() if v is not None} class DiscordWebhook: """