private void EnsureTableIsClear() { UpdateWeekNum(); TurnipInfo firstEntry = _turnipRepository.GetAllTurnipsTableEntries().FirstOrDefault(); if (firstEntry != null && firstEntry.WeekNum != _weekNum) //New week has started and we must clean out the table { _turnipRepository.DeleteAllTurnipTableEntries(); //Delete all entries for a new week } }
public async Task Prices(CommandContext ctx) { await ctx.TriggerTypingAsync(); List <TurnipInfo> entries = _turnipRepository.GetAllTurnipsTableEntries(); StringBuilder sb = new StringBuilder(); if (entries.Count == 0) { sb.AppendLine("Couldn't find any prices. Get on it, nerds!"); } else { foreach (TurnipInfo entry in entries) { sb.AppendLine($"{entry.Name}: {UriConstructorService.GenerateTurnipUrl(entry)}"); } } await ctx.RespondAsync(sb.ToString()); }