public async Task ExecuteSessionWebhooksAsync(List <DPSReportJSON> reportsJSON, LogSessionSettings logSessionSettings) { if (logSessionSettings.UseSelectedWebhooksInstead) { foreach (var webhook in logSessionSettings.SelectedWebhooks) { var discordEmbeds = SessionTextConstructor.ConstructSessionEmbeds(reportsJSON.Where(x => webhook.Team.IsSatisfied(x.ExtraJSON)).ToList(), logSessionSettings); await SendDiscordMessageWebhooksAsync(webhook, discordEmbeds, logSessionSettings.ContentText); } } else { foreach (var webhook in allWebhooks.Values.Where(x => x.Active)) { var discordEmbeds = SessionTextConstructor.ConstructSessionEmbeds(reportsJSON.Where(x => webhook.Team.IsSatisfied(x.ExtraJSON)).ToList(), logSessionSettings); await SendDiscordMessageWebhooksAsync(webhook, discordEmbeds, logSessionSettings.ContentText); } } if (logSessionSettings.UseSelectedWebhooksInstead && logSessionSettings.SelectedWebhooks.Count > 0) { mainLink.AddToText(">:> All selected webhooks successfully executed with finished log session."); } else if (allWebhooks.Count > 0) { mainLink.AddToText(">:> All active webhooks successfully executed with finished log session."); } }
public async Task ExecuteSessionWebhooksAsync(List <DPSReportJSON> reportsJSON, LogSessionSettings logSessionSettings) { SessionTextConstructor.DiscordEmbeds discordEmbeds = SessionTextConstructor.ConstructSessionEmbeds(reportsJSON, logSessionSettings); if (logSessionSettings.UseSelectedWebhooksInstead) { await SendDiscordMessageToSelectedWebhooksAsync(logSessionSettings.SelectedWebhooks, discordEmbeds, logSessionSettings.ContentText); } else { await SendDiscordMessageToAllActiveWebhooksAsync(discordEmbeds, logSessionSettings.ContentText); } if (logSessionSettings.UseSelectedWebhooksInstead && logSessionSettings.SelectedWebhooks.Count > 0) { mainLink.AddToText(">:> All selected webhooks successfully executed with finished log session."); } else if (allWebhooks.Count > 0) { mainLink.AddToText(">:> All active webhooks successfully executed with finished log session."); } }