From b17fb758f98aaa1b5eb84037785a187a2a5f63f3 Mon Sep 17 00:00:00 2001 From: Stanley Dimant Date: Thu, 19 Sep 2024 09:44:43 +0200 Subject: [PATCH] add botlog to vanity uid setting --- .../Discord/MareWizardModule.Vanity.cs | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/MareSynchronosServer/MareSynchronosServices/Discord/MareWizardModule.Vanity.cs b/MareSynchronosServer/MareSynchronosServices/Discord/MareWizardModule.Vanity.cs index 53d7826..66b35cd 100644 --- a/MareSynchronosServer/MareSynchronosServices/Discord/MareWizardModule.Vanity.cs +++ b/MareSynchronosServer/MareSynchronosServices/Discord/MareWizardModule.Vanity.cs @@ -120,6 +120,7 @@ public partial class MareWizardModule eb.WithTitle("Vanity UID successfully set"); eb.WithDescription($"Your Vanity UID for \"{uid}\" was successfully changed to \"{desiredVanityUid}\"." + Environment.NewLine + Environment.NewLine + "For changes to take effect you need to reconnect to the Mare service."); + await _botServices.LogToChannel($"{Context.User.Mention} VANITY UID SET: UID: {user.UID}, Vanity: {desiredVanityUid}").ConfigureAwait(false); AddHome(cb); } @@ -164,12 +165,12 @@ public partial class MareWizardModule EmbedBuilder eb = new(); ComponentBuilder cb = new(); - var desiredVanityUid = modal.DesiredVanityGID; + var desiredVanityGid = modal.DesiredVanityGID; using var db = GetDbContext(); bool canAddVanityId = !db.Groups.Any(u => u.GID == modal.DesiredVanityGID || u.Alias == modal.DesiredVanityGID); Regex rgx = new(@"^[_\-a-zA-Z0-9]{5,20}$", RegexOptions.ECMAScript); - if (!rgx.Match(desiredVanityUid).Success) + if (!rgx.Match(desiredVanityGid).Success) { eb.WithColor(Color.Red); eb.WithTitle("Invalid Vanity Syncshell ID"); @@ -181,21 +182,22 @@ public partial class MareWizardModule { eb.WithColor(Color.Red); eb.WithTitle("Vanity Syncshell ID already taken"); - eb.WithDescription($"The Vanity Synshell ID \"{desiredVanityUid}\" has already been claimed. Please pick a different one."); + eb.WithDescription($"The Vanity Synshell ID \"{desiredVanityGid}\" has already been claimed. Please pick a different one."); cb.WithButton("Cancel", "wizard-vanity", ButtonStyle.Secondary, emote: new Emoji("❌")); cb.WithButton("Pick Different ID", "wizard-vanity-gid-set:" + gid, ButtonStyle.Primary, new Emoji("💅")); } else { var group = await db.Groups.SingleAsync(u => u.GID == gid).ConfigureAwait(false); - group.Alias = desiredVanityUid; + group.Alias = desiredVanityGid; db.Update(group); await db.SaveChangesAsync().ConfigureAwait(false); eb.WithColor(Color.Green); eb.WithTitle("Vanity Syncshell ID successfully set"); - eb.WithDescription($"Your Vanity Syncshell ID for {gid} was successfully changed to \"{desiredVanityUid}\"." + Environment.NewLine + Environment.NewLine + eb.WithDescription($"Your Vanity Syncshell ID for {gid} was successfully changed to \"{desiredVanityGid}\"." + Environment.NewLine + Environment.NewLine + "For changes to take effect you need to reconnect to the Mare service."); AddHome(cb); + await _botServices.LogToChannel($"{Context.User.Mention} VANITY GID SET: GID: {group.GID}, Vanity: {desiredVanityGid}").ConfigureAwait(false); } await ModifyModalInteraction(eb, cb).ConfigureAwait(false);