/// <summary>
        /// Processes an Instagram story.
        /// Doesnt work with highlights.
        /// </summary>
        /// <param name="url">Link to the story.</param>
        /// <param name="premiumTier">Discord Nitro tier. For max file upload size.</param>
        /// <returns>Instagram processor response with related information.</returns>
        public async Task <InstagramProcessorResponse> StoryProcessorAsync(string url, int premiumTier)
        {
            Uri    link     = new Uri(url);
            string userName = link.Segments[2].Replace("/", "");
            string storyID  = link.Segments[3].Replace("/", "");

            //get user:
            var user = await instaApi.UserProcessor.GetUserAsync(userName);

            // On failed to get user:
            if (!user.Succeeded)
            {
                return(HandleFailure(user));
            }
            else if (user.Value.IsPrivate)
            {
                return(new InstagramProcessorResponse("The account is private."));
            }

            //Get user data:
            long userId = user.Value.Pk;

            //Get the story:
            var stories = await instaApi.StoryProcessor.GetUserStoryAsync(userId);

            if (!stories.Succeeded)
            {
                return(new InstagramProcessorResponse("Failed to load stories for the user."));
            }
            if (stories.Value.Items.Count == 0)
            {
                return(new InstagramProcessorResponse("No stories exist for that user."));
            }
            foreach (var story in stories.Value.Items)
            {
                //find story:
                if (story.Id.Contains(storyID))
                {
                    long   maxUploadSize = DiscordTools.MaxUploadSize(premiumTier);
                    bool   isVideo       = story.VideoList.Count > 0;
                    string downloadUrl   = "";

                    if (isVideo)
                    {
                        //process video:
                        downloadUrl = story.VideoList[0].Uri;
                    }
                    else if (story.ImageList.Count > 0)
                    {
                        //Image:
                        downloadUrl = story.ImageList[0].Uri;
                    }
                    else
                    {
                        return(new InstagramProcessorResponse("This story uses a format that we do not support."));
                    }
                    //Return downloaded content (if possible):
                    try
                    {
                        using (HttpClient client = new HttpClient())
                        {
                            client.MaxResponseContentBufferSize = maxUploadSize;
                            var response = await client.GetAsync(downloadUrl);

                            byte[] data = await response.Content.ReadAsByteArrayAsync();

                            //If statement to double check size.
                            if (data.Length < maxUploadSize)
                            {
                                return(new InstagramProcessorResponse(isVideo, "", story.User.FullName, story.User.UserName, new Uri(story.User.ProfilePicture), downloadUrl, url, story.TakenAt, data, 1));
                            }
                        }
                    }
                    catch (HttpRequestException e)
                    {
                        if (e.Message.Contains("Cannot write more bytes to the buffer than the configured maximum buffer size"))
                        {
                            //File too big to upload to discord. Just ignore the error.
                        }
                        else
                        {
                            //Unexpected error:
                            Console.WriteLine("HttpRequestException Error:\n" + e);
                        }
                    }
                    catch (Exception e)
                    {
                        //Log Error:
                        Console.WriteLine(e);
                    }
                    //Fallback to URL:
                    return(new InstagramProcessorResponse(true, "", story.User.FullName, story.User.UserName, new Uri(story.User.ProfilePicture), downloadUrl, url, story.TakenAt, null, 1));
                }
            }
            return(new InstagramProcessorResponse("Could not find story."));
        }
        /// <summary>
        /// Gets information about the account.
        /// </summary>
        /// <param name="url"></param>
        /// <param name="premiumTier"></param>
        /// <returns>An InstagramProcessorResponse with just profile data.</returns>
        public async Task <InstagramProcessorResponse> ProcessAccountAsync(Uri url, int premiumTier)
        {
            string username = url.Segments[1].TrimEnd('/');
            var    user     = await instaApi.UserProcessor.GetUserInfoByUsernameAsync(username);

            if (!user.Succeeded)
            {
                //Handle the failed case:
                return(HandleFailure(user));
            }
            return(new InstagramProcessorResponse(user.Value.FullName, username, new Uri(user.Value.ProfilePicUrl), user.Value.FollowerCount, user.Value.FollowingCount, user.Value.MediaCount, (string.IsNullOrEmpty(user.Value.Biography)) ? ("No bio") : DiscordTools.Truncate(user.Value.Biography, 4000, cutAtNewLine: false), user.Value.ExternalUrl));
        }
        /// <summary>
        /// Processes an Instagram post.
        /// </summary>
        /// <param name="url">Link to the post</param>
        /// <param name="index">Post number in carousel</param>
        /// <param name="premiumTier">Discord Nitro tier. For max file upload size.</param>
        /// <returns>Instagram processor response with related information.</returns>
        public async Task <InstagramProcessorResponse> PostProcessorAsync(string url, int index, int premiumTier, InstagramApiSharp.Classes.Models.InstaMedia media = null)
        {
            //Arrays start at zero:
            index--;

            //Check for 'prefed' media
            if (media == null)
            {
                //parse url:
                InstagramApiSharp.Classes.IResult <string> mediaId;
                InstagramApiSharp.Classes.IResult <InstagramApiSharp.Classes.Models.InstaMedia> mediaSource;

                //Get the media ID:
                mediaId = await instaApi.MediaProcessor.GetMediaIdFromUrlAsync(new Uri(url));

                //Check to see if it worked:
                if (!mediaId.Succeeded)
                {
                    return(HandleFailure(mediaId));
                }
                else if (mediaId.Value == null)
                {
                    return(new InstagramProcessorResponse("No post information returned."));
                }
                else
                {
                    mediaSource = (await instaApi.MediaProcessor.GetMediaByIdAsync(mediaId.Value));
                    //Check for failure:
                    if (!mediaSource.Succeeded)
                    {
                        return(HandleFailure(mediaSource));
                    }
                }

                media = mediaSource.Value;
            }
            //Create URL if it isnt already sent.
            if (string.IsNullOrEmpty(url))
            {
                url = "https://www.instagram.com/p/" + media.Code;
            }

            string caption = "";

            //check caption value (ensure not null)
            if (media.Caption != null)
            {
                caption = media.Caption.Text;
            }

            int postCount = 1;

            //inject image from carousel:
            if (media.Carousel != null && media.Carousel.Count > 0)
            {
                if (media.Carousel.Count <= index)
                {
                    return(new InstagramProcessorResponse("Index out of bounds. There is only " + media.Carousel.Count + " Posts."));
                }
                if (media.Carousel[index].Videos.Count > 0)
                {
                    var video = media.Carousel[index].Videos[0];
                    media.Videos.Add(video);
                }
                else
                {
                    var image = media.Carousel[index].Images[0];
                    media.Images.Add(image);
                }
                // Set amount of posts:
                postCount = media.Carousel.Count;
            }
            //get upload tier:
            long maxUploadSize = DiscordTools.MaxUploadSize(premiumTier);

            bool   isVideo     = media.Videos.Count > 0;
            string downloadUrl = "";

            //Video or image:
            if (isVideo)
            {
                //video:
                downloadUrl = media.Videos[0].Uri;
            }
            else
            {
                //Image:
                downloadUrl = media.Images[0].Uri;
            }

            //Return downloaded content (if possible):
            try
            {
                using (HttpClient client = new HttpClient())
                {
                    client.MaxResponseContentBufferSize = maxUploadSize;
                    var response = await client.GetAsync(downloadUrl);

                    byte[] data = await response.Content.ReadAsByteArrayAsync();

                    //If statement to double check size.
                    if (data.Length < maxUploadSize)
                    {
                        //No account information avaliable:
                        return(new InstagramProcessorResponse(isVideo, caption, media.User.FullName, media.User.UserName, new Uri(media.User.ProfilePicture), downloadUrl, url, media.TakenAt, data, postCount));
                    }
                }
            }
            catch (HttpRequestException e)
            {
                if (e.Message.Contains("Cannot write more bytes to the buffer than the configured maximum buffer size"))
                {
                    //File too big to upload to discord. Just ignore the error.
                }
                else
                {
                    //Unexpected error:
                    Console.WriteLine("HttpRequestException Error:\n" + e);
                }
            }
            catch (Exception e)
            {
                //Log Error:
                Console.WriteLine(e);
            }
            //Fallback to URL:
            //No account information avaliable:
            return(new InstagramProcessorResponse(true, caption, media.User.FullName, media.User.UserName, new Uri(media.User.ProfilePicture), downloadUrl, url, media.TakenAt, null, postCount));
        }
        /// <summary>
        /// Builds an embed for IG posts
        /// </summary>
        /// <returns></returns>
        public Embed PostEmbed()
        {
            var embed = BaseEmbed();

            //Embeds:
            //Account Name:
            var account = new EmbedAuthorBuilder();

            account.IconUrl = Response.iconURL.ToString();
            account.Name    = (string.IsNullOrEmpty(Response.accountName)) ? Response.username : Response.accountName;
            account.Url     = Response.accountUrl.ToString();

            embed.Author      = account;
            embed.Timestamp   = new DateTimeOffset(Response.postDate);
            embed.Description = (Response.caption != null) ? (DiscordTools.Truncate(Response.caption)) : ("");
            // Check to see if requester is known:
            if (RequesterIsKnown)
            {
                embed.Title = "Content from " + Requester + "'s linked post.";
                embed.Url   = Response.postURL.ToString();
            }
            if (Response.postCount > 1)
            {
                embed.Description += "\n\nThere ";

                // Plural or singular?
                if ((Response.postCount - 1) != 1)
                {
                    embed.Description += "are ";
                }
                else
                {
                    embed.Description += "is ";
                }

                embed.Description += (Response.postCount - 1) + " other ";

                // Plural or singular?
                if ((Response.postCount - 1) != 1)
                {
                    embed.Description += "images/videos";
                }
                else
                {
                    embed.Description += "image/video";
                }
                embed.Description += " in this post.";
            }
            if (!Response.isVideo)
            {
                if (Response.stream != null)
                {
                    embed.ImageUrl = "attachment://IGMedia.jpg";
                }
                else
                {
                    embed.ImageUrl = Response.contentURL.ToString();
                }
            }
            if (IsSpoiler)
            {
                embed.Description = "||" + embed.Description + "||";
            }
            return(embed.Build());
        }