private async Task AnnounceFile(UploadedFile file, ModCase modCase, IUser actor, RestAction action) { using var scope = _serviceProvider.CreateScope(); _logger.LogInformation($"Announcing file {modCase.GuildId}/{modCase.CaseId}/{file.Name}."); GuildConfig guildConfig = await GuildConfigRepository.CreateDefault(scope.ServiceProvider).GetGuildConfig(modCase.GuildId); if (!string.IsNullOrEmpty(guildConfig.ModInternalNotificationWebhook)) { _logger.LogInformation($"Sending internal webhook for file {modCase.GuildId}/{modCase.CaseId}/{file.Name} to {guildConfig.ModInternalNotificationWebhook}."); try { EmbedBuilder embed = await file.CreateFileEmbed(modCase, action, actor, scope.ServiceProvider); await _discordAPI.ExecuteWebhook(guildConfig.ModInternalNotificationWebhook, embed.Build()); } catch (Exception e) { _logger.LogError(e, $"Error while announcing file {modCase.GuildId}/{modCase.CaseId}/{file.Name} to {guildConfig.ModInternalNotificationWebhook}."); } } }