Skip to content
Merged
Show file tree
Hide file tree
Changes from 3 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
6 changes: 6 additions & 0 deletions discord/interactions.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@
from __future__ import annotations

import asyncio
import datetime
from typing import TYPE_CHECKING, Any, Coroutine, Union

from . import utils
Expand Down Expand Up @@ -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:
"""The partial message'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
Expand Down