@@ -81,7 +81,7 @@ public async Task<MovieSelection> GetMovieSelectionAsync(IReadOnlyList<Movie> mo
81
81
var movieRow = new StringBuilder ( ) ;
82
82
movieRow . Append ( $ "{ i + 1 } ) { arrayMovies [ i ] . Title } ") ;
83
83
84
- if ( ! string . IsNullOrWhiteSpace ( arrayMovies [ i ] . ReleaseDate ) )
84
+ if ( ! string . IsNullOrWhiteSpace ( arrayMovies [ i ] . ReleaseDate ) && arrayMovies [ i ] . ReleaseDate . Length >= 4 )
85
85
movieRow . Append ( $ "({ arrayMovies [ i ] . ReleaseDate . Substring ( 0 , 4 ) } ) ") ;
86
86
87
87
movieRow . Append ( $ "[[TheMovieDb](https://www.themoviedb.org/movie/{ arrayMovies [ i ] . TheMovieDbId } )]") ;
@@ -147,13 +147,17 @@ public async Task DisplayMovieDetails(Movie movie)
147
147
public static async Task < Embed > GenerateMovieDetailsAsync ( Movie movie , SocketUser user , IMovieSearcher movieSearcher = null )
148
148
{
149
149
var embedBuilder = new EmbedBuilder ( )
150
- . WithTitle ( $ "{ movie . Title } { ( ! string . IsNullOrWhiteSpace ( movie . ReleaseDate ) ? $ "({ movie . ReleaseDate . Split ( "T" ) [ 0 ] . Substring ( 0 , 4 ) } )" : string . Empty ) } ")
151
- . WithDescription ( movie . Overview . Substring ( 0 , Math . Min ( movie . Overview . Length , 255 ) ) + "(...)" )
150
+ . WithTitle ( $ "{ movie . Title } { ( ! string . IsNullOrWhiteSpace ( movie . ReleaseDate ) && movie . ReleaseDate . Length >= 4 ? $ "({ movie . ReleaseDate . Split ( "T" ) [ 0 ] . Substring ( 0 , 4 ) } )" : string . Empty ) } ")
152
151
. WithFooter ( user . Username , $ "https://cdn.discordapp.com/avatars/{ user . Id . ToString ( ) } /{ user . AvatarId } .png")
153
152
. WithTimestamp ( DateTime . Now )
154
153
. WithUrl ( $ "https://www.themoviedb.org/movie/{ movie . TheMovieDbId } ")
155
154
. WithThumbnailUrl ( "https://i.imgur.com/44ueTES.png" ) ;
156
155
156
+ if ( ! string . IsNullOrWhiteSpace ( movie . Overview ) )
157
+ {
158
+ embedBuilder . WithDescription ( movie . Overview . Substring ( 0 , Math . Min ( movie . Overview . Length , 255 ) ) + "(...)" ) ;
159
+ }
160
+
157
161
if ( ! string . IsNullOrEmpty ( movie . PosterPath ) && movie . PosterPath . StartsWith ( "http" , StringComparison . InvariantCultureIgnoreCase ) ) embedBuilder . WithImageUrl ( movie . PosterPath ) ;
158
162
if ( ! string . IsNullOrWhiteSpace ( movie . Quality ) ) embedBuilder . AddField ( "__Quality__" , $ "{ movie . Quality } p", true ) ;
159
163
if ( ! string . IsNullOrWhiteSpace ( movie . PlexUrl ) ) embedBuilder . AddField ( "__Plex__" , $ "[Watch now]({ movie . PlexUrl } )", true ) ;
0 commit comments