Skip to content

Commit 59a03f5

Browse files
authored
fix: correct expire property for interaction ctx (#1624)
1 parent 7e770ff commit 59a03f5

File tree

1 file changed

+4
-3
lines changed

1 file changed

+4
-3
lines changed

interactions/models/internal/context.py

Lines changed: 4 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -35,6 +35,7 @@
3535
)
3636
from interactions.models.discord.snowflake import Snowflake, Snowflake_Type, to_snowflake, to_optional_snowflake
3737
from interactions.models.discord.embed import Embed
38+
from interactions.models.discord.timestamp import Timestamp
3839
from interactions.models.internal.application_commands import (
3940
OptionType,
4041
CallbackType,
@@ -329,16 +330,16 @@ def command(self) -> InteractionCommand:
329330
return self.client._interaction_lookup[self._command_name]
330331

331332
@property
332-
def expires_at(self) -> typing.Optional[datetime.datetime]:
333+
def expires_at(self) -> Timestamp:
333334
"""The time at which the interaction expires."""
334-
if self.responded:
335+
if self.responded or self.deferred:
335336
return self.id.created_at + datetime.timedelta(minutes=15)
336337
return self.id.created_at + datetime.timedelta(seconds=3)
337338

338339
@property
339340
def expired(self) -> bool:
340341
"""Whether the interaction has expired."""
341-
return datetime.datetime.utcnow() > self.expires_at
342+
return Timestamp.utcnow() > self.expires_at
342343

343344
@property
344345
def invoke_target(self) -> str:

0 commit comments

Comments
 (0)