Esempio n. 1
0
        public async Task InfoByName([Remainder] string movieName)
        {
            var movie = await _omdbService.GetMovieByTitle(movieName);

            Console.WriteLine($"Retrieved movie info for \"{movieName}\"; id={movie.ImdbId}");
            await ReplyAsync(movie.ToString());
        }
Esempio n. 2
0
        public async Task AddNominationASync([Remainder] string name)
        {
            Console.WriteLine($"Got nomination request for \"{name}\"");
            if (!_votingService.VotingOpen())
            {
                var movie = await _omdbService.GetMovieByTitle(name);

                if (movie.Title.Equals(null))
                {
                    Console.WriteLine($"Failed to find nominated movie \"{name}\"");
                    await ReplyAsync("Could not find this movie.");
                }
                else
                {
                    if (!_nominationsService.IsNominated(movie.ImdbId))
                    {
                        Console.WriteLine($"Adding nominated movie \"{name}\"");
                        await ReplyAsync(movie.ToString());

                        // If this isnt the right one, specify the year and change the nomination
                        _nominationsService.AddNomination(Context.User, movie.Title, movie.ImdbId);
                        await ReplyAsync("Thanks for nominating!");
                    }
                    else
                    {
                        Console.WriteLine($"Attempted to nominate duplicate movie \"{name}\"");
                        await ReplyAsync($"{movie.Title} is already nominated!");
                    }
                }
            }
            else
            {
                await ReplyAsync("Cannot nominate during open voting session");
            }
        }