mirror of
https://github.com/PluralKit/PluralKit.git
synced 2026-02-07 22:37:54 +00:00
Convert autoproxy timeout to use seconds
This commit is contained in:
parent
ab3ccac60f
commit
db4e41a232
6 changed files with 36 additions and 25 deletions
|
|
@ -10,7 +10,7 @@ namespace PluralKit.Bot
|
|||
public class ProxyMatcher
|
||||
{
|
||||
private static readonly char AutoproxyEscapeCharacter = '\\';
|
||||
public static readonly int DefaultLatchExpiryTime = 6;
|
||||
public static readonly Duration DefaultLatchExpiryTime = Duration.FromHours(6);
|
||||
|
||||
private readonly IClock _clock;
|
||||
private readonly ProxyTagParser _parser;
|
||||
|
|
@ -79,8 +79,10 @@ namespace PluralKit.Bot
|
|||
{
|
||||
if (ctx.LastMessage == null) return true;
|
||||
if (ctx.LatchTimeout == 0) return false;
|
||||
|
||||
var timeout = Duration.FromHours(ctx.LatchTimeout == -1 ? DefaultLatchExpiryTime : ctx.LatchTimeout);
|
||||
|
||||
var timeout = ctx.LatchTimeout.HasValue
|
||||
? Duration.FromSeconds(ctx.LatchTimeout.Value)
|
||||
: DefaultLatchExpiryTime;
|
||||
|
||||
var timestamp = DiscordUtils.SnowflakeToInstant(ctx.LastMessage.Value);
|
||||
return _clock.GetCurrentInstant() - timestamp > timeout;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue