Exemple #1
0
        public async Task ShowLeaderboard(string id)
        {
            var c = await _challenges.FuzzyFindChallenge(id).Take(2).ToArrayAsync();

            if (c.Length > 1)
            {
                await ReplyAsync("Found more than one challenge matching that search string, please be more specific");
            }
            else if (c.Length == 0)
            {
                await ReplyAsync("Could not find a challenge matching that searching string");
            }
            else
            {
                await DisplayChallengeLeaderboard(c[0]);
            }
        }
Exemple #2
0
        public async Task GetCompetition(string search)
        {
            var results = await _challenges.FuzzyFindChallenge(search).ToArrayAsync();

            if (results.Length == 1)
            {
                await ReplyAsync(embed : results[0].ToEmbed().Build());
            }
            else
            {
                await DisplayItemList(
                    results.ToAsyncEnumerable(),
                    () => "No challenges",
                    (c, i) => $"`[{((uint)c.Id).BalderHash()}]` {c.Name}" + (c.EndTime.HasValue && c.EndTime > DateTime.UtcNow ? " (Current)" : "")
                    );
            }
        }
Exemple #3
0
        public async Task SubmitSolution(string id, [Remainder] string input)
        {
            var c = await _challenges.FuzzyFindChallenge(id, true).Take(5).ToArrayAsync();

            if (c.Length > 1)
            {
                await ReplyAsync("Found more than one challenge matching that search string, please be more specific");
            }
            else if (c.Length == 0)
            {
                await ReplyAsync("Could not find a challenge matching that searching string");
            }
            else
            {
                var current = await _challenges.GetCurrentChallenge();
                await SubmitSolution(c[0], input, current?.Id == c[0].Id);
            }
        }