From 0ead1290e98f1c8dc67b03bfd067eb29a967e621 Mon Sep 17 00:00:00 2001 From: Toastie <toastie@toastiet0ast.com> Date: Mon, 24 Feb 2025 13:22:34 +1300 Subject: [PATCH] Fixed some build warnings --- src/EllieBot/Modules/Games/Items/db/Item.cs | 4 ++-- src/EllieBot/Modules/Xp/XpService.cs | 9 ++++----- 2 files changed, 6 insertions(+), 7 deletions(-) diff --git a/src/EllieBot/Modules/Games/Items/db/Item.cs b/src/EllieBot/Modules/Games/Items/db/Item.cs index 0e27dc0..9f04629 100644 --- a/src/EllieBot/Modules/Games/Items/db/Item.cs +++ b/src/EllieBot/Modules/Games/Items/db/Item.cs @@ -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 diff --git a/src/EllieBot/Modules/Xp/XpService.cs b/src/EllieBot/Modules/Xp/XpService.cs index 3e4a574..552c3fe 100644 --- a/src/EllieBot/Modules/Xp/XpService.cs +++ b/src/EllieBot/Modules/Xp/XpService.cs @@ -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)