From 6cec1fe5c8e9e36d335829645b80946a3a14a0d4 Mon Sep 17 00:00:00 2001 From: Plerx <50530305+Plerx2493@users.noreply.github.com> Date: Fri, 2 Feb 2024 22:39:04 +0100 Subject: [PATCH] update user ingest --- .../EventListeners/EventListener.GuildDownload.cs | 3 ++- .../Services/DiscordClientService.cs | 6 +++--- .../Services/VoiceAlertService.cs | 3 ++- 3 files changed, 7 insertions(+), 5 deletions(-) diff --git a/ModularAssistentForDiscordServer/EventListeners/EventListener.GuildDownload.cs b/ModularAssistentForDiscordServer/EventListeners/EventListener.GuildDownload.cs index 17db318..d1bc1ec 100644 --- a/ModularAssistentForDiscordServer/EventListeners/EventListener.GuildDownload.cs +++ b/ModularAssistentForDiscordServer/EventListeners/EventListener.GuildDownload.cs @@ -58,7 +58,8 @@ IDbContextFactory dbFactory { Id = user.Id, Username = user.Username, - Discriminator = Convert.ToInt32(user.Discriminator) + Discriminator = Convert.ToInt32(user.Discriminator), + PreferedLanguage = "en-US" }; }); diff --git a/ModularAssistentForDiscordServer/Services/DiscordClientService.cs b/ModularAssistentForDiscordServer/Services/DiscordClientService.cs index 652be34..4306fc1 100644 --- a/ModularAssistentForDiscordServer/Services/DiscordClientService.cs +++ b/ModularAssistentForDiscordServer/Services/DiscordClientService.cs @@ -129,9 +129,9 @@ public async Task StartAsync(CancellationToken cancellationToken) { _logger.Warning("DiscordClientService started"); //Update database to latest migration - using var context = await _dbContextFactory.CreateDbContextAsync(); - if ((await context.Database.GetPendingMigrationsAsync()).Any()) - await context.Database.MigrateAsync(); + await using var context = await _dbContextFactory.CreateDbContextAsync(cancellationToken); + if ((await context.Database.GetPendingMigrationsAsync(cancellationToken)).Any()) + await context.Database.MigrateAsync(cancellationToken); DiscordActivity act = new("Messing with code", ActivityType.Custom); diff --git a/ModularAssistentForDiscordServer/Services/VoiceAlertService.cs b/ModularAssistentForDiscordServer/Services/VoiceAlertService.cs index 236d92e..be480d2 100644 --- a/ModularAssistentForDiscordServer/Services/VoiceAlertService.cs +++ b/ModularAssistentForDiscordServer/Services/VoiceAlertService.cs @@ -106,7 +106,8 @@ public async Task HandleEvent(DiscordClient client, VoiceStateUpdateEventArgs e) user = new UserDbEntity { Id = userId, - VoiceAlerts = new List() + VoiceAlerts = new List(), + PreferedLanguage = "en-US" }; await context.Users.AddAsync(user); }