Skip to content

fix: correct expire property for interaction ctx #1624

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
Merged
Changes from all 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
7 changes: 4 additions & 3 deletions interactions/models/internal/context.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
)
from interactions.models.discord.snowflake import Snowflake, Snowflake_Type, to_snowflake, to_optional_snowflake
from interactions.models.discord.embed import Embed
from interactions.models.discord.timestamp import Timestamp
from interactions.models.internal.application_commands import (
OptionType,
CallbackType,
Expand Down Expand Up @@ -329,16 +330,16 @@ def command(self) -> InteractionCommand:
return self.client._interaction_lookup[self._command_name]

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

@property
def expired(self) -> bool:
"""Whether the interaction has expired."""
return datetime.datetime.utcnow() > self.expires_at
return Timestamp.utcnow() > self.expires_at

@property
def invoke_target(self) -> str:
Expand Down