public async Task HandleAsync(string rawDestinationName) { if (string.IsNullOrWhiteSpace(rawDestinationName)) { await ReplyAsync(Messages.InvalidCommand); return; } var cat = _currentOwner.Cat; if (cat == null) { await ReplyAsync(Messages.CatNotOwned); return; } var existingAdventureEntry = await _adventureEntryRepository.FindByCatIdAsync(cat.Id); if (existingAdventureEntry != null) { await ReplyAsync(Messages.AdventureNotNull); return; } var destinationName = rawDestinationName.Trim().ToLowerInvariant(); switch (destinationName) { case "explore-neighbourhood": var adventure = new AdventureExploreNeighbourhood(); await RegisterAdventureAsync(cat, adventure); Console.WriteLine($"Adding adventure {adventure.AdventureRef} for cat {cat.Id}"); // Track event _telemetryService.TrackGoCommand(_currentOwner, cat, adventure); await ReplyAsync($"{cat.Name} embarks on {adventure.Name}. {cat.Pronoun} will return in {adventure.Duration.TotalMinutes} minutes."); return; default: await ReplyAsync($"There is no adventure with the name '{destinationName}'"); return; } }
public async Task <ResultMessage> GetOverviewAsync(ICurrentOwner currentOwner, Cat cat) { Embed embed; var adventureEntry = await _adventureEntryRepository.FindByCatIdAsync(cat.Id); if (adventureEntry != null) { var adventure = _adventureRepository.FindByAdventureRef(adventureEntry.AdventureRef); embed = CatSheet.GetSheet(currentOwner, cat, string.Empty, adventure, adventureEntry.End); } else { embed = CatSheet.GetSheet(currentOwner, cat); } return(new ResultMessage(string.Empty, embed)); }