aboutsummaryrefslogtreecommitdiffstats
path: root/arthur/utils.py
diff options
context:
space:
mode:
Diffstat (limited to 'arthur/utils.py')
-rw-r--r--arthur/utils.py7
1 files changed, 7 insertions, 0 deletions
diff --git a/arthur/utils.py b/arthur/utils.py
index 12e2646..ea545b5 100644
--- a/arthur/utils.py
+++ b/arthur/utils.py
@@ -1,5 +1,7 @@
"""Utility functionality for King Arthur."""
+from datetime import datetime
+
from discord import Embed
from discord.colour import Colour
@@ -9,3 +11,8 @@ def generate_error_embed(
) -> Embed:
"""Generate an error embed to return to Discord."""
return Embed(title=title, description=description, colour=Colour.red())
+
+
+def datetime_to_discord(time: datetime, format: str = "f") -> str:
+ """Convert a datetime object to a Discord timestamp."""
+ return f"<t:{int(time.timestamp())}:{format}>"