Time to bring these from my personal branch #33

Manually merged
toastie_t0ast merged 57 commits from :v6 into v6 2025-02-28 23:18:40 +00:00
2 changed files with 6 additions and 7 deletions
Showing only changes of commit 0ead1290e9 - Show all commits
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)