dondaum commented on code in PR #58603:
URL: https://github.com/apache/airflow/pull/58603#discussion_r2654041350
##########
providers/discord/src/airflow/providers/discord/hooks/discord_webhook.py:
##########
@@ -70,21 +115,28 @@ def build_discord_payload(
(max 2000 characters)
:param username: Override the default username of the webhook
:param avatar_url: Override the default avatar of the webhook
+ :param embed: Discord embed object.
:return: Discord payload (str) to send
"""
- if len(message) > 2000:
- raise ValueError("Discord message length must be 2000 or fewer
characters.")
- payload: dict[str, Any] = {
+ payload = {
"content": message,
"tts": tts,
}
+ if len(message) > 2000:
+ raise ValueError("Discord message length must be 2000 or fewer
characters.")
if username:
payload["username"] = username
if avatar_url:
payload["avatar_url"] = avatar_url
+ if embed:
+ payload["embeds"] = [self.validate_embed(embed=embed)]
return json.dumps(payload)
+if TYPE_CHECKING:
+ from airflow.providers.discord.notifications.embed import Embed
Review Comment:
Hmm sorry for this one. Changed.
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]