diff --git a/src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs b/src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs index 925ae08fc..56cc88eb1 100644 --- a/src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs +++ b/src/Discord.Net.Core/Entities/Interactions/IDiscordInteraction.cs @@ -37,6 +37,11 @@ namespace Discord /// int Version { get; } + /// + /// Gets the time that the interaction was received. + /// + DateTimeOffset ReceivedAt { get; } + /// /// Responds to an Interaction with type . /// diff --git a/src/Discord.Net.Rest/Entities/Interactions/InteractionHelper.cs b/src/Discord.Net.Rest/Entities/Interactions/InteractionHelper.cs index 44ee7ac22..30a8d8483 100644 --- a/src/Discord.Net.Rest/Entities/Interactions/InteractionHelper.cs +++ b/src/Discord.Net.Rest/Entities/Interactions/InteractionHelper.cs @@ -17,7 +17,7 @@ namespace Discord.Rest #region InteractionHelper public static bool CanSendResponse(IDiscordInteraction interaction) { - return (DateTime.UtcNow - interaction.CreatedAt).TotalSeconds < ResponseTimeLimit; + return (DateTime.UtcNow - interaction.ReceivedAt).TotalSeconds < ResponseTimeLimit; } public static bool CanRespondOrFollowup(IDiscordInteraction interaction) { diff --git a/src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs b/src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs index 20d8fa0f5..c63041ce5 100644 --- a/src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs +++ b/src/Discord.Net.WebSocket/Entities/Interaction/SocketInteraction.cs @@ -47,6 +47,10 @@ namespace Discord.WebSocket public DateTimeOffset CreatedAt => SnowflakeUtils.FromSnowflake(Id); + /// + public DateTimeOffset ReceivedAt { get; private set; } + + internal abstract bool _hasResponded { get; set; } /// @@ -58,6 +62,7 @@ namespace Discord.WebSocket internal SocketInteraction(DiscordSocketClient client, ulong id, ISocketMessageChannel channel) : base(client, id) { + ReceivedAt = DateTime.UtcNow; Channel = channel; }