Skip to content

Commit

Permalink
update user ingest
Browse files Browse the repository at this point in the history
  • Loading branch information
Plerx2493 committed Feb 2, 2024
1 parent 3360598 commit 6cec1fe
Show file tree
Hide file tree
Showing 3 changed files with 7 additions and 5 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -58,7 +58,8 @@ IDbContextFactory<MadsContext> dbFactory
{
Id = user.Id,
Username = user.Username,
Discriminator = Convert.ToInt32(user.Discriminator)
Discriminator = Convert.ToInt32(user.Discriminator),
PreferedLanguage = "en-US"
};
});

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,8 @@ public async Task HandleEvent(DiscordClient client, VoiceStateUpdateEventArgs e)
user = new UserDbEntity
{
Id = userId,
VoiceAlerts = new List<VoiceAlert>()
VoiceAlerts = new List<VoiceAlert>(),
PreferedLanguage = "en-US"
};
await context.Users.AddAsync(user);
}
Expand Down

0 comments on commit 6cec1fe

Please sign in to comment.