public ImdbMovie GetMovieData(string movieName) { string API_KEY = _configuration.GetSection("AppSettings")["ImdbApiKey"]; var imdb = new Imdb(API_KEY); var movie = imdb.GetMovieAsync(movieName); return(movie.Result); }
public async Task <string> GetImdbRating(string movieId) { try { var imdb = new Imdb("8c75101"); var movie = await imdb.GetMovieAsync(movieId); return(movie.ImdbRating); } catch (Exception) { throw; } }
public async Task ImdbAsync([Remainder, Name("movie_name")] string args) { // TODO: Show more info about the movie in the embed try { var movie = await _imdb.GetMovieAsync(args); if (movie.Error != null) { await ReplyAsync(movie.Error); return; } var embed = new EmbedBuilder { Color = new Color(ConfigHandler.Config.EmbedColor), Title = movie.Title, Description = $"{movie.ImdbId}\n{movie.Plot}", ThumbnailUrl = movie.Poster }.Build(); await ReplyAsync("", embed : embed); } catch (Exception e) { var embed = new EmbedBuilder { Color = new Color(0xFF0000), Description = e.Message }; await ReplyAsync("", embed : embed.Build()); throw; } }