Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: discord webhook embed timestamp fails to serialize #555

Closed
wants to merge 4 commits into from
Closed
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
5 changes: 3 additions & 2 deletions app/discord.py
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@

from typing import Any

import orjson
from tenacity import retry
from tenacity import stop_after_attempt
from tenacity import wait_exponential
Expand Down Expand Up @@ -168,7 +169,7 @@ def json(self) -> Any:

payload["embeds"].append(embed_payload)

return payload
return orjson.dumps(payload, default=str).decode()

@retry(
stop=stop_after_attempt(10),
Expand All @@ -181,7 +182,7 @@ async def post(self) -> None:
headers = {"Content-Type": "application/json"}
response = await services.http_client.post(
self.url,
json=self.json,
content=self.json,
headers=headers,
)
response.raise_for_status()