diff --git a/src/NadekoBot/Modules/Searches/Commands/OMDB/OmdbProvider.cs b/src/NadekoBot/Modules/Searches/Commands/OMDB/OmdbProvider.cs new file mode 100644 index 00000000..12032805 --- /dev/null +++ b/src/NadekoBot/Modules/Searches/Commands/OMDB/OmdbProvider.cs @@ -0,0 +1,46 @@ +using Newtonsoft.Json; +using System; +using System.Collections.Generic; +using System.Linq; +using System.Net.Http; +using System.Text; +using System.Threading.Tasks; + +namespace NadekoBot.Modules.Searches.Commands.OMDB +{ + public static class OmdbProvider + { + private const string queryUrl = "http://www.omdbapi.com/?t={0}&y=&plot=full&r=json"; + + public static async Task FindMovie(string name) + { + using (var http = new HttpClient()) + { + var res = await http.GetStringAsync(String.Format(queryUrl,name.Trim().Replace(' ','+'))).ConfigureAwait(false); + var movie = JsonConvert.DeserializeObject(res); + + movie.Poster = await NadekoBot.Google.ShortenUrl(movie.Poster); + return movie; + } + } + } + + public class OmdbMovie + { + public string Title { get; set; } + public string Year { get; set; } + public string ImdbRating { get; set; } + public string ImdbId { get; set; } + public string Genre { get; set; } + public string Plot { get; set; } + public string Poster { get; set; } + + public override string ToString() => +$@"`Title:` {Title} +`Year:` {Year} +`Rating:` {ImdbRating} +`Genre:` {Genre} +`Link:` http://www.imdb.com/title/{ImdbId}/ +`Plot:` {Plot}"; + } +} diff --git a/src/NadekoBot/Resources/CommandStrings.Designer.cs b/src/NadekoBot/Resources/CommandStrings.Designer.cs index 0dfd896a..b2e6fb09 100644 --- a/src/NadekoBot/Resources/CommandStrings.Designer.cs +++ b/src/NadekoBot/Resources/CommandStrings.Designer.cs @@ -5550,7 +5550,7 @@ namespace NadekoBot.Resources { } /// - /// Looks up a localized string similar to List all roles on this server or a single user if specified.. + /// Looks up a localized string similar to List roles on this server or a roles of a specific user if specified. Paginated. 20 roles per page.. /// public static string roles_desc { get { @@ -5559,7 +5559,7 @@ namespace NadekoBot.Resources { } /// - /// Looks up a localized string similar to `.roles`. + /// Looks up a localized string similar to `.roles 2` or `.roles @Someone`. /// public static string roles_usage { get { diff --git a/src/NadekoBot/Resources/CommandStrings.resx b/src/NadekoBot/Resources/CommandStrings.resx index 753dea51..26a09eb1 100644 --- a/src/NadekoBot/Resources/CommandStrings.resx +++ b/src/NadekoBot/Resources/CommandStrings.resx @@ -940,10 +940,10 @@ roles - List all roles on this server or a single user if specified. + List roles on this server or a roles of a specific user if specified. Paginated. 20 roles per page. - `.roles` + `.roles 2` or `.roles @Someone` channeltopic ct