Exemplo n.º 1
0
        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
            }
        }
Exemplo n.º 2
0
        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());
        }