Josh
3 years ago
committed by
GitHub
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with
15 additions and
0 deletions
-
discord/interactions.py
|
|
@ -27,6 +27,7 @@ DEALINGS IN THE SOFTWARE. |
|
|
|
from __future__ import annotations |
|
|
|
from typing import Any, Dict, List, Optional, TYPE_CHECKING, Tuple, Union |
|
|
|
import asyncio |
|
|
|
import datetime |
|
|
|
|
|
|
|
from . import utils |
|
|
|
from .enums import try_enum, InteractionType, InteractionResponseType |
|
|
@ -222,6 +223,20 @@ class Interaction: |
|
|
|
} |
|
|
|
return Webhook.from_state(data=payload, state=self._state) |
|
|
|
|
|
|
|
@property |
|
|
|
def created_at(self) -> datetime.datetime: |
|
|
|
""":class:`datetime.datetime`: When the interaction was created.""" |
|
|
|
return utils.snowflake_time(self.id) |
|
|
|
|
|
|
|
@property |
|
|
|
def expires_at(self) -> datetime.datetime: |
|
|
|
""":class:`datetime.datetime`: When the interaction expires.""" |
|
|
|
return self.created_at + datetime.timedelta(minutes=15) |
|
|
|
|
|
|
|
def is_expired(self) -> bool: |
|
|
|
""":class:`bool`: Returns ``True`` if the interaction is expired.""" |
|
|
|
return utils.utcnow() >= self.expires_at |
|
|
|
|
|
|
|
async def original_message(self) -> InteractionMessage: |
|
|
|
"""|coro| |
|
|
|
|
|
|
|