Ejemplo n.º 1
0
        internal void DisplayTweet(Tweetinvi.Models.ITweet tweet)
        {
            Console.WriteLine();

            Console.Write($"{tweet.CreatedBy.Name} ".Pastel(colors.titleColor));
            if (tweet.IsRetweet)
            {
                Console.Write($"[RT] ".Pastel(colors.subTitleColor));
            }
            Console.WriteLine($"[{getTimeElapsed(tweet.CreatedAt)}]".Pastel(colors.subTitleColor));
            Console.WriteLine("---------------------------------------------------------".Pastel(colors.seperatorColor));
            Console.WriteLine();
            if (tweet.IsRetweet)
            {
                Console.WriteLine(FormatTweetBody(tweet.RetweetedTweet.FullText.Pastel(colors.mainTextColor)));
            }
            else
            {
                Console.WriteLine(FormatTweetBody(tweet.FullText.Pastel(colors.mainTextColor)));
            }

            if (tweet.Media.Count > 0)
            {
                foreach (var image in tweet.Media)
                {
                    Console.WriteLine($"[{image.MediaURLHttps}]".Pastel(urlColor));
                }
            }
            string replyCount = tweet.RetweetCount.ToString() ?? "0";

            Console.WriteLine();
            Console.WriteLine($"💬 {replyCount}    🔁 {tweet.RetweetCount}     💙 {tweet.FavoriteCount}");
            Console.WriteLine("---------------------------------------------------------".Pastel(colors.seperatorColor));
            Console.WriteLine();
        }
Ejemplo n.º 2
0
 private static Boolean TweetWithImage(string text, string imgPath)
 {
     if (imgPath.Length > 0)
     {
         if (File.Exists(imgPath))
         {
             byte[] imgdata = System.IO.File.ReadAllBytes(imgPath);
             Tweetinvi.Models.IMedia media = Upload.UploadBinary(imgdata);
             if (media.IsReadyToBeUsed)
             {
                 Tweetinvi.Models.ITweet tweet = Tweet.PublishTweet(text, new PublishTweetOptionalParameters
                 {
                     Medias = { media }
                 });
                 if (tweet != null)
                 {
                     return(true);
                 }
             }
         }
     }
     return(false);
 }
        private async Task <bool> _sendReply(Tweetinvi.Models.ITweet tweet, string message)
        {
            var result = await TweetAsync.PublishTweetInReplyTo(message, tweet.Id);

            return(result != null);
        }