public async Task <List <string> > GetAreasResult(List <string> validAreas) { var message = (await _context.RespondEmbed($"Enter the areas to get notifications from separated by a comma (i.e. `city1,city2`):\n**Available Areas:**\n{string.Join("\n- ", validAreas)}\n- All", DiscordColor.Blurple)).FirstOrDefault(); var cities = await _context.WaitForUserChoice(true); // Check if gender is a valid gender provided var areas = SubscriptionAreas.GetAreas(cities, validAreas); if (areas.Count == 0) { // No valid areas provided await _context.RespondEmbed($"Invalid areas provided."); return(new List <string>()); } await message.DeleteAsync(); return(areas); }
/// <summary> /// Gets the areas list from the Discord interacitivity from the user /// </summary> /// <param name="guildId">Discord server guild id to lookup valid areas</param> /// <returns>Returns a list of valid areas specified</returns> public async Task <List <string> > GetAreasResult(ulong guildId) { var deps = _context.Dependencies.GetDependency <Dependencies>(); var server = deps.WhConfig.Servers[guildId]; var validAreas = server.Geofences.Select(g => g.Name).ToList(); var message = (await _context.RespondEmbed($"Enter the areas to get notifications from separated by a comma (i.e. `city1,city2`):\n**Available Areas:**\n{string.Join("\n- ", validAreas)}\n- All", DiscordColor.Blurple)).FirstOrDefault(); var cities = await _context.WaitForUserChoice(true); await message.DeleteAsync(); // Check if provided areas are valid and only return valid areas var areas = SubscriptionAreas.GetAreas(server, cities); if (areas.Count == 0) { // No valid areas provided return(new List <string>()); } return(areas); }