Updated Bot.cs with a fix that stopped builds

Why was this a glitch? ¯\_(ツ)_/¯
This commit is contained in:
Toastie (DCS Team) 2024-09-14 01:29:48 +12:00
parent 81a6171526
commit 3e35c6ffc7
Signed by: toastie_t0ast
GPG key ID: 27F3B6855AFD40A4

View file

@ -90,21 +90,17 @@ public sealed class Bot : IBot
public IReadOnlyList<ulong> GetCurrentGuildIds() public IReadOnlyList<ulong> GetCurrentGuildIds()
=> Client.Guilds.Select(x => x.Id).ToList().AsReadOnly(); => Client.Guilds.Select(x => x.Id).ToList().AsReadOnly();
=> Client.Guilds.Select(x => x.Id).ToList().AsReadOnly();
private async Task AddServices()
private async Task AddServices() private async Task AddServices()
{ {
var startingGuildIdList = GetCurrentGuildIds().ToList(); var startingGuildIdList = GetCurrentGuildIds().ToList();
var startTime = Stopwatch.GetTimestamp(); var startTime = Stopwatch.GetTimestamp();
var bot = Client.CurrentUser; var bot = Client.CurrentUser;
await using (var uow = _db.GetDbContext())
await using (var uow = _db.GetDbContext()) await using (var uow = _db.GetDbContext())
{ {
AllGuildConfigs = await uow.GuildConfigs.GetAllGuildConfigs(startingGuildIdList); AllGuildConfigs = await uow.GuildConfigs.GetAllGuildConfigs(startingGuildIdList);
uow.EnsureUserCreated(bot.Id, bot.Username, bot.Discriminator, bot.AvatarId); uow.EnsureUserCreated(bot.Id, bot.Username, bot.Discriminator, bot.AvatarId);
AllGuildConfigs = await uow.GuildConfigs.GetAllGuildConfigs(startingGuildIdList);
} }
// var svcs = new StandardKernel(new NinjectSettings() // var svcs = new StandardKernel(new NinjectSettings()
@ -272,7 +268,6 @@ public sealed class Bot : IBot
try try
{ {
await AddServices(); await AddServices();
await AddServices();
} }
catch (Exception ex) catch (Exception ex)
{ {