fix up some bot shit

This commit is contained in:
Stanley Dimant
2024-11-09 02:06:10 +01:00
parent e2e030be90
commit 028d1642e1
13 changed files with 120 additions and 274 deletions

View File

@@ -1,6 +1,5 @@
using Discord.Interactions;
using Discord;
using MareSynchronosShared.Data;
using MareSynchronosShared.Utils;
using MareSynchronosShared.Utils.Configuration;
@@ -15,7 +14,7 @@ public partial class MareWizardModule
_logger.LogInformation("{method}:{userId}", nameof(ComponentDelete), Context.Interaction.User.Id);
using var mareDb = GetDbContext();
using var mareDb = await GetDbContext().ConfigureAwait(false);
EmbedBuilder eb = new();
eb.WithTitle("Delete Account");
eb.WithDescription("You can delete your primary or secondary UIDs here." + Environment.NewLine + Environment.NewLine
@@ -38,7 +37,7 @@ public partial class MareWizardModule
_logger.LogInformation("{method}:{userId}:{uid}", nameof(SelectionDeleteAccount), Context.Interaction.User.Id, uid);
using var mareDb = GetDbContext();
using var mareDb = await GetDbContext().ConfigureAwait(false);
bool isPrimary = mareDb.Auth.Single(u => u.UserUID == uid).PrimaryUserUID == null;
EmbedBuilder eb = new();
eb.WithTitle($"Are you sure you want to delete {uid}?");
@@ -88,7 +87,7 @@ public partial class MareWizardModule
{
var maxGroupsByUser = _mareClientConfigurationService.GetValueOrDefault(nameof(ServerConfiguration.MaxGroupUserCount), 3);
using var db = GetDbContext();
using var db = await GetDbContext().ConfigureAwait(false);
var user = db.Users.Single(u => u.UID == uid);
await SharedDbFunctions.PurgeUser(_logger, user, db, maxGroupsByUser).ConfigureAwait(false);