예제 #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
            }
        }
예제 #2
0
        public async Task Delete(CommandContext ctx)
        {
            await ctx.TriggerTypingAsync();

            string response;

            await ctx.RespondAsync("Are you sure you want to delete everything in the turnips table?");

            var interactivityModule = ctx.Client.GetInteractivityModule();

            var message = await interactivityModule.WaitForMessageAsync(m => m.Content.Contains("Yes", StringComparison.InvariantCultureIgnoreCase) || m.Content.Contains("No", StringComparison.InvariantCultureIgnoreCase), TimeSpan.FromSeconds(10));

            if (message.Message.Content.Equals("Yes", StringComparison.InvariantCultureIgnoreCase))
            {
                _turnipRepository.DeleteAllTurnipTableEntries();
                response = "Successfully deleted everything.";
            }
            else
            {
                response = "Nothing has been deleted.";
            }

            await ctx.RespondAsync(response);
        }