public async Task AskForSeasonNotificationRequestAsync(TvShow tvShow, TvSeason selectedSeason) { var message = Language.Current.DiscordCommandTvNotificationRequestSeason.ReplaceTokens(tvShow, selectedSeason.SeasonNumber); if (selectedSeason is FutureTvSeasons) { if (tvShow.AllSeasonsAvailable()) { message = Language.Current.DiscordCommandTvNotificationRequestFutureSeasonAvailable; } else if (tvShow.AllSeasonsFullyRequested()) { message = Language.Current.DiscordCommandTvNotificationRequestFutureSeasonRequested; } else { message = Language.Current.DiscordCommandTvNotificationRequestFutureSeasonMissing; } } var requestButton = new DiscordButtonComponent(ButtonStyle.Primary, $"TNR/{_interactionContext.User.Id}/{tvShow.TheTvDbId}/{selectedSeason.GetType().Name.First()}/{selectedSeason.SeasonNumber}", Language.Current.DiscordCommandNotifyMe, false, new DiscordComponentEmoji(DiscordEmoji.FromUnicode("🔔"))); var embed = GenerateTvShowDetailsAsync(tvShow); var builder = (await AddPreviousDropdownsAsync(tvShow, new DiscordWebhookBuilder().AddEmbed(embed))).AddComponents(requestButton).WithContent(message); await _interactionContext.EditOriginalResponseAsync(builder); }
public async Task WarnAlreadySeasonAlreadyRequestedAsync(TvShow tvShow, TvSeason requestedSeason) { var messageContent = Language.Current.DiscordCommandTvRequestAlreadyExistSeason.ReplaceTokens(tvShow, requestedSeason.SeasonNumber); var buttonMessage = Language.Current.DiscordCommandRequestedButton; if (requestedSeason is FutureTvSeasons) { if (tvShow.AllSeasonsAvailable()) { messageContent = Language.Current.DiscordCommandTvRequestAlreadyExistFutureSeasonAvailable; buttonMessage = Language.Current.DiscordCommandAvailableButton; } else if (tvShow.AllSeasonsFullyRequested()) { messageContent = Language.Current.DiscordCommandTvRequestAlreadyExistFutureSeasonRequested; } else { messageContent = Language.Current.DiscordCommandTvRequestAlreadyExistFutureSeasonFound; } } var embed = GenerateTvShowDetailsAsync(tvShow); var requestButton = new DiscordButtonComponent(ButtonStyle.Primary, $"TTT/{_interactionContext.User.Id}/{tvShow.TheTvDbId}/999", buttonMessage, true); var builder = (await AddPreviousDropdownsAsync(tvShow, new DiscordWebhookBuilder().AddEmbed(embed))).WithContent(messageContent).AddComponents(requestButton); await _interactionContext.EditOriginalResponseAsync(builder); }
public async Task HandleSelectionAsync(TvShowRequest request, TvShow tvShow, AllTvSeasons selectedSeason) { if (tvShow.AllSeasonsFullyRequested()) { await _userInterface.WarnAlreadySeasonAlreadyRequestedAsync(tvShow, new FutureTvSeasons()); } else { await _userInterface.DisplayTvShowDetailsForSeasonAsync(request, tvShow, selectedSeason); } }
private string GetFormattedSeasonName(TvShow tvShow, TvSeason season) { var seasonName = season is AllTvSeasons ? $"{Language.Current.DiscordEmbedTvAllSeasons}" : season is FutureTvSeasons ? $"{Language.Current.DiscordEmbedTvFutureSeasons}" : $"{Language.Current.DiscordEmbedTvSeason.ReplaceTokens(LanguageTokens.SeasonNumber, season.SeasonNumber.ToString())}"; if (season is AllTvSeasons) { seasonName += tvShow.AllSeasonsFullyRequested() ? $" ({Language.Current.DiscordEmbedTvFullyRequested})" : season.IsRequested == RequestedState.Partial ? string.Empty : string.Empty; } else { seasonName += season.IsRequested == RequestedState.Full ? $" ({Language.Current.DiscordEmbedTvFullyRequested})" : season.IsRequested == RequestedState.Partial ? $" ({Language.Current.DiscordEmbedTvPartiallyRequested})" : string.Empty; } return(seasonName); }