diff --git a/CHANGELOG.md b/CHANGELOG.md index b31e2a492a..f90c8c5056 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -53,8 +53,10 @@ These changes are available on the `master` branch, but have not yet been releas ([#2598](https://github.com/Pycord-Development/pycord/pull/2598)) - Added the ability to change the API's base URL with `Route.API_BASE_URL`. ([#2714](https://github.com/Pycord-Development/pycord/pull/2714)) -- Added the ability to pass a `datetime.time` object to `format_dt` +- Added the ability to pass a `datetime.time` object to `format_dt`. ([#2747](https://github.com/Pycord-Development/pycord/pull/2747)) +- Added `discord.Interaction.created_at`. + ([#2801](https://github.com/Pycord-Development/pycord/pull/2801)) ### Fixed diff --git a/discord/interactions.py b/discord/interactions.py index 57628f4691..0834e9bb75 100644 --- a/discord/interactions.py +++ b/discord/interactions.py @@ -26,6 +26,7 @@ from __future__ import annotations import asyncio +import datetime from typing import TYPE_CHECKING, Any, Coroutine, Union from . import utils @@ -300,6 +301,11 @@ def guild(self) -> Guild | None: return self._guild return self._state and self._state._get_guild(self.guild_id) + @property + def created_at(self) -> datetime.datetime: + """Returns the interaction's creation time in UTC.""" + return utils.snowflake_time(self.id) + def is_command(self) -> bool: """Indicates whether the interaction is an application command.""" return self.type == InteractionType.application_command