fix (imdb): better toString
This commit is contained in:
parent
df05e84754
commit
a49b1066d3
@ -43,11 +43,35 @@ namespace NadekoBot.Classes.IMDB
|
|||||||
|
|
||||||
public Dictionary<string, string> Aka { get; set; }
|
public Dictionary<string, string> Aka { get; set; }
|
||||||
|
|
||||||
public string ToString
|
public override string ToString()
|
||||||
|
{
|
||||||
|
return "`Title:` **" + EnglishTitle + " (" + OriginalTitle + ")" +
|
||||||
|
"**\n`Year:` " + Year +
|
||||||
|
"**\n`Rating:` " + Rating +
|
||||||
|
"**\n`Genre:` " + GenresAsString +
|
||||||
|
"\n`Link:` " + ImdbURL +
|
||||||
|
"\n`Plot:` " + Plot.Substring(0, Plot.Length > 500 ? 500 : Plot.Length) + "..."
|
||||||
|
//"\n`img:` " + Poster //imdb url do it for us I think its a discord auto thing
|
||||||
|
;
|
||||||
|
}
|
||||||
|
|
||||||
|
public string EnglishTitle
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
return ImdbURL + "\n" + OriginalTitle + " (" + Year + ") - " + Rating;
|
return Aka.ContainsKey("USA") ? Aka["USA"] :
|
||||||
|
(Aka.ContainsKey("UK") ? Aka["UK"] :
|
||||||
|
(Aka.ContainsKey("(original title)") ? Aka["(original title)"] :
|
||||||
|
(Aka.ContainsKey("(original)") ? Aka["(original)"] : OriginalTitle)));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
public string GenresAsString
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
string ret = "";
|
||||||
|
Genres.ForEach(g => ret = ret + " " + g);
|
||||||
|
return ret;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -96,8 +96,8 @@ $@"🌍 **Weather for** 【{obj["target"]}】
|
|||||||
string result;
|
string result;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
var movie = ImdbScraper.ImdbScrape(e.GetArg("query"), false);
|
var movie = ImdbScraper.ImdbScrape(e.GetArg("query"), true);
|
||||||
if (movie.status) result = movie.ToString;
|
if (movie.status) result = movie.ToString();
|
||||||
else result = "Failed to find that movie.";
|
else result = "Failed to find that movie.";
|
||||||
}
|
}
|
||||||
catch
|
catch
|
||||||
|
Loading…
Reference in New Issue
Block a user