Skip to content

Commit 2b5c7b9

Browse files
committed
feat: add created_at property to Interaction for message creation time
1 parent e391c82 commit 2b5c7b9

File tree

1 file changed

+6
-0
lines changed

1 file changed

+6
-0
lines changed

discord/interactions.py

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -26,6 +26,7 @@
2626
from __future__ import annotations
2727

2828
import asyncio
29+
import datetime
2930
from typing import TYPE_CHECKING, Any, Coroutine, Union
3031

3132
from . import utils
@@ -300,6 +301,11 @@ def guild(self) -> Guild | None:
300301
return self._guild
301302
return self._state and self._state._get_guild(self.guild_id)
302303

304+
@property
305+
def created_at(self) -> datetime.datetime:
306+
"""The partial message's creation time in UTC."""
307+
return utils.snowflake_time(self.id)
308+
303309
def is_command(self) -> bool:
304310
"""Indicates whether the interaction is an application command."""
305311
return self.type == InteractionType.application_command

0 commit comments

Comments
 (0)