From 34ba1d9443431a1fe6a3404b561091628a665282 Mon Sep 17 00:00:00 2001 From: Noikoio Date: Sun, 28 Oct 2018 19:37:07 -0700 Subject: [PATCH] Hide actual cooldown value --- Module/VoteTempChannel/VotingSession.cs | 17 ++++++++--------- 1 file changed, 8 insertions(+), 9 deletions(-) diff --git a/Module/VoteTempChannel/VotingSession.cs b/Module/VoteTempChannel/VotingSession.cs index dbc7cfa..23ccc99 100644 --- a/Module/VoteTempChannel/VotingSession.cs +++ b/Module/VoteTempChannel/VotingSession.cs @@ -4,19 +4,18 @@ using System.Collections.Generic; namespace Noikoio.RegexBot.Module.VoteTempChannel { /// - /// Keeps information on voting sessions and voting cooldowns. + /// Keeps information on voting sessions and cooldowns. /// class VotingSession { private Configuration _conf; private DateTimeOffset _initialVoteTime; private List _votes; - - public DateTimeOffset? CooldownStart { get; private set; } + public DateTimeOffset? _cooldownStart; public VotingSession() { - CooldownStart = null; + _cooldownStart = null; _votes = new List(); } @@ -35,7 +34,7 @@ namespace Noikoio.RegexBot.Module.VoteTempChannel /// /// Checks if the voting session has expired. - /// To be called by the background task. This automatically resets state. + /// To be called by the background task. This automatically resets and sets cooldown. /// public bool IsSessionExpired() { @@ -52,13 +51,13 @@ namespace Noikoio.RegexBot.Module.VoteTempChannel public void StartCooldown() { - CooldownStart = DateTimeOffset.UtcNow; + _cooldownStart = DateTimeOffset.UtcNow; } public bool IsInCooldown() { - if (!CooldownStart.HasValue) return false; - return CooldownStart.Value + _conf.VotingCooldown > DateTimeOffset.UtcNow; + if (!_cooldownStart.HasValue) return false; + return _cooldownStart.Value + _conf.VotingCooldown > DateTimeOffset.UtcNow; } /// @@ -67,7 +66,7 @@ namespace Noikoio.RegexBot.Module.VoteTempChannel public void Reset() { _votes.Clear(); - CooldownStart = null; + _cooldownStart = null; } } }