Fixed some build warnings

This commit is contained in:
Toastie 2025-02-24 13:22:34 +13:00
parent dc12a7558e
commit 0ead1290e9
Signed by: toastie_t0ast
GPG key ID: 0861BE54AD481DC7
2 changed files with 6 additions and 7 deletions
src/EllieBot/Modules
Games/Items/db
Xp

View file

@ -10,8 +10,8 @@ public class Item
public string MediaUrl { get; set; } = string.Empty;
public ItemQuality Quality { get; set; }
public bool IsUsable { get; set; }
public string ItemType { get; set; }
public string ItemSubType { get; set; }
public string ItemType { get; set; } = string.Empty;
public string ItemSubType { get; set; } = string.Empty;
}
public static class ItemTypes

View file

@ -16,7 +16,6 @@ using LinqToDB.Tools;
using Microsoft.Extensions.Caching.Memory;
using EllieBot.Modules.Administration;
using EllieBot.Modules.Patronage;
using SixLabors.ImageSharp.Formats.Png;
using ArgumentOutOfRangeException = System.ArgumentOutOfRangeException;
using Color = SixLabors.ImageSharp.Color;
using Exception = System.Exception;
@ -641,20 +640,20 @@ public class XpService : IEService, IReadyExecutor, IExecNoCommand
return [];
}
private async Task<bool> TryAddUserGainedXpAsync(ulong userId, int cdInSeconds)
private Task<bool> TryAddUserGainedXpAsync(ulong userId, int cdInSeconds)
{
if (cdInSeconds <= 0)
return true;
return Task.FromResult(true);
if (_memCache.TryGetValue(userId, out _))
return false;
return Task.FromResult(false);
using var entry = _memCache.CreateEntry(userId);
entry.Value = true;
entry.AbsoluteExpirationRelativeToNow = TimeSpan.FromSeconds(cdInSeconds);
return true;
return Task.FromResult(true);
}
public async Task<FullUserStats> GetUserStatsAsync(IGuildUser user)