From 9f97badfc7906c201fb51df850551e6bf2d7f568 Mon Sep 17 00:00:00 2001 From: Toastie Date: Tue, 8 Oct 2024 14:03:38 +1300 Subject: [PATCH] .waifulb will no longer show #0000 discriminators, for real this time --- .../Gambling/Waifus/WaifuClaimCommands.cs | 14 +++++++------- .../Gambling/Waifus/db/WaifuExtensions.cs | 17 +++++++++++------ .../Modules/Gambling/Waifus/db/WaifuLbResult.cs | 7 ++----- src/EllieBot/Services/GrpcApi/OtherSvc.cs | 6 +++--- 4 files changed, 23 insertions(+), 21 deletions(-) diff --git a/src/EllieBot/Modules/Gambling/Waifus/WaifuClaimCommands.cs b/src/EllieBot/Modules/Gambling/Waifus/WaifuClaimCommands.cs index 8afb886..9fca94e 100644 --- a/src/EllieBot/Modules/Gambling/Waifus/WaifuClaimCommands.cs +++ b/src/EllieBot/Modules/Gambling/Waifus/WaifuClaimCommands.cs @@ -252,18 +252,18 @@ public partial class Gambling var claimer = "no one"; string status; - var waifuUsername = w.Username.TrimTo(20); - var claimerUsername = w.Claimer?.TrimTo(20); + var waifuUsername = w.WaifuName.TrimTo(20); + var claimerUsername = w.ClaimerName?.TrimTo(20); - if (w.Claimer is not null) - claimer = $"{claimerUsername}#{w.ClaimerDiscrim}"; + if (w.ClaimerName is not null) + claimer = $"{claimerUsername}"; if (w.Affinity is null) status = $"... but {waifuUsername}'s heart is empty"; - else if (w.Affinity + w.AffinityDiscrim == w.Claimer + w.ClaimerDiscrim) + else if (w.Affinity == w.ClaimerName) status = $"... and {waifuUsername} likes {claimerUsername} too <3"; else - status = $"... but {waifuUsername}'s heart belongs to {w.Affinity.TrimTo(20)}#{w.AffinityDiscrim}"; - return $"**{waifuUsername}#{w.Discrim}** - claimed by **{claimer}**\n\t{status}"; + status = $"... but {waifuUsername}'s heart belongs to {w.Affinity.TrimTo(20)}"; + return $"**{waifuUsername}** - claimed by **{claimer}**\n\t{status}"; } [Cmd] diff --git a/src/EllieBot/Modules/Gambling/Waifus/db/WaifuExtensions.cs b/src/EllieBot/Modules/Gambling/Waifus/db/WaifuExtensions.cs index d0615eb..a134635 100644 --- a/src/EllieBot/Modules/Gambling/Waifus/db/WaifuExtensions.cs +++ b/src/EllieBot/Modules/Gambling/Waifus/db/WaifuExtensions.cs @@ -40,12 +40,17 @@ public static class WaifuExtensions .Take(count) .Select(x => new WaifuLbResult { - Affinity = x.Affinity == null ? null : x.Affinity.Username, - AffinityDiscrim = x.Affinity == null ? null : x.Affinity.Discriminator, - Claimer = x.Claimer == null ? null : x.Claimer.Username, - ClaimerDiscrim = x.Claimer == null ? null : x.Claimer.Discriminator, - Username = x.Waifu.Username, - Discrim = x.Waifu.Discriminator, + Affinity = x.Affinity == null + ? null + : x.Affinity.Username + + (x.Affinity.Discriminator != "0000" ? "#" + x.Affinity.Discriminator : ""), + ClaimerName = + x.Claimer == null + ? null + : x.Claimer.Username + + (x.Claimer.Discriminator != "0000" ? "#" + x.Claimer.Discriminator : ""), + WaifuName = x.Waifu.Username + + (x.Waifu.Discriminator != "0000" ? "#" + x.Waifu.Discriminator : ""), Price = x.Price }) .ToListAsyncEF(); diff --git a/src/EllieBot/Modules/Gambling/Waifus/db/WaifuLbResult.cs b/src/EllieBot/Modules/Gambling/Waifus/db/WaifuLbResult.cs index f83af4f..02c83f2 100644 --- a/src/EllieBot/Modules/Gambling/Waifus/db/WaifuLbResult.cs +++ b/src/EllieBot/Modules/Gambling/Waifus/db/WaifuLbResult.cs @@ -3,14 +3,11 @@ namespace EllieBot.Db.Models; public class WaifuLbResult { - public string Username { get; set; } - public string Discrim { get; set; } + public string WaifuName { get; set; } - public string Claimer { get; set; } - public string ClaimerDiscrim { get; set; } + public string ClaimerName { get; set; } public string Affinity { get; set; } - public string AffinityDiscrim { get; set; } public long Price { get; set; } } \ No newline at end of file diff --git a/src/EllieBot/Services/GrpcApi/OtherSvc.cs b/src/EllieBot/Services/GrpcApi/OtherSvc.cs index 8865c6d..febcfc5 100644 --- a/src/EllieBot/Services/GrpcApi/OtherSvc.cs +++ b/src/EllieBot/Services/GrpcApi/OtherSvc.cs @@ -134,10 +134,10 @@ public sealed class OtherSvc : GrpcOther.GrpcOtherBase, IEService var reply = new WaifuLbReply(); reply.Entries.AddRange(waifus.Select(x => new WaifuLbEntry() { - ClaimedBy = x.Claimer ?? string.Empty, - IsMutual = x.Claimer == x.Affinity, + ClaimedBy = x.ClaimerName ?? string.Empty, + IsMutual = x.ClaimerName == x.Affinity, Value = x.Price, - User = x.Username, + User = x.WaifuName, })); return reply; }