.divorce cooldown now properly works on multiple shards

This commit is contained in:
Master Kwoth
2017-11-03 12:46:51 +01:00
parent 0dbd60b5ac
commit 1c157ddfc1
4 changed files with 18 additions and 14 deletions

View File

@ -96,5 +96,18 @@ namespace NadekoBot.Core.Services.Impl
}
return false;
}
public bool TryAddDivorceCooldown(ulong userId, out TimeSpan? time)
{
time = _db.KeyTimeToLive($"{_redisKey}_divorce_{userId}");
if (time == null)
{
time = TimeSpan.FromHours(6);
_db.StringSet($"{_redisKey}_divorce_{userId}", true);
_db.KeyExpire($"{_redisKey}_divorce_{userId}", time);
return true;
}
return false;
}
}
}