Table of Contents

Interface ICooldownTracker

Namespace
Signal.Application.Commands.Preconditions
Assembly
Signal.Application.dll

Stores cooldown expirations. Replace it (e.g. with a distributed cache) when running several bot instances.

public interface ICooldownTracker

Methods

TryEnter(string, TimeSpan, out TimeSpan)

Starts a cooldown for key unless one is active.

bool TryEnter(string key, TimeSpan period, out TimeSpan remaining)

Parameters

key string

The cooldown key (command, scope and scope identifier).

period TimeSpan

The cooldown length.

remaining TimeSpan

The remaining time when the method returns false.

Returns

bool

true if no cooldown was active (a new one was started).