示例#1
0
 private void Tweet_PublishTweetWithGeoInReplyToAnotherTweet(string text, long tweetIdtoRespondTo, double longitude, double latitude)
 {
     if (!TextEmpty(text))
     {
         var substringed = "";
         try
         {
             var    tweeto = Tweet.GetTweet(tweetIdtoRespondTo);
             string texto  = "@" + tweeto.Creator.ScreenName + " " + text;
             if (texto.Length > 140)
             {
                 texto       = texto.Substring(0, 136);
                 texto      += "...";
                 substringed = " BUT tweet text was cropped because the reply Id was too long.";
             }
             var newTweet = Tweet.CreateTweet(texto);
             newTweet.PublishWithGeoInReplyTo(longitude, latitude, tweetIdtoRespondTo);
             GetPublishedResult(newTweet, "Tweet in reply to " + tweetIdtoRespondTo.ToString() + " published!(with f*****g coordinates)" + substringed);
         }
         catch
         {
             FActionStatus[0] = "Tweet Id to reply to is not a published tweet!";
             FLogger.Log(LogType.Debug, "Tweet Id to reply to is not a published tweet!");
         }
     }
 }
示例#2
0
 private void Tweet_PublishTweetWithGeo(string text, double longitude, double latitude)
 {
     if (!TextEmpty(text))
     {
         var newTweet = Tweet.CreateTweet(text);
         newTweet.PublishWithGeo(longitude, latitude);
         GetPublishedResult(newTweet, "Tweet published!(with f*****g coordinates)");
     }
 }
示例#3
0
 public void Tweet_PublishTweet(string text)
 {
     if (!TextEmpty(text))
     {
         var newTweet = Tweet.CreateTweet(text);
         newTweet.Publish();
         GetPublishedResult(newTweet, "Tweet published!");
     }
 }
示例#4
0
        static void Main(string[] args)
        {
            TwitterCredentials.ApplicationCredentials = TwitterCredentials.CreateCredentials(
                "3004124297-RR9ZNwofkwnt7ATF3fefQllHtDGgNH3u442QUWo",
                "0XymIsK4bTDvzmz2xw4snubmLlvHp9oHeZa8EapWEVL9S",
                "dQPcIhiNdtHAchfx7ZbsjeDAW",
                "V53RXnrRhpq6ReHa6qtRKi5J5IhLz5HzYCyXAJP031krCzreur");

            Console.Write("PollName: ");
            string pollName = Console.ReadLine();

            Console.Write("Options: ");
            string[] options = Console.ReadLine().Split(',');
            Console.Write("Votes for each: ");
            String[] voteNumS = Console.ReadLine().Split(',');
            int[]    voteNum  = new int[voteNumS.Length];
            for (int i = 0; i < voteNum.Length; i++)
            {
                voteNum[i] = Convert.ToInt32(voteNumS[i]);
            }
            int[] count = new int[options.Length];
            for (int i = 0; i < options.Length; i++)
            {
                count[i] = 0;
            }
            while (voteNum.Sum() != 0)
            {
                for (int i = 0; i < voteNum.Length; i++)
                {
                    if (voteNum[i] != 0)
                    {
                        string text = "@TwitPollPP #" + pollName + " ";
                        for (int j = 0; j < voteNum[i]; j++)
                        {
                            text = text + " ";
                        }
                        text = text + options[i];
                        var tweet = Tweet.CreateTweet(text);
                        tweet.Publish();
                        if (tweet.IsTweetPublished)
                        {
                            count[i] = count[i] + 1;
                        }
                        voteNum[i] = voteNum[i] - 1;
                    }
                }
            }
            foreach (int i in count)
            {
                Console.WriteLine(i);
            }
            Console.ReadKey();
        }
示例#5
0
        private void Post()
        {
            // クソコードっぽさ
            SetDefaultNotifyIcon();

            var mine = Tweet.CreateTweet(textBoxTweet.Text);

            if (_selectedReplyId == NO_SELECTION)
            {
                Tweet.PublishTweet(mine);
                textBoxTweet.Text = "";
            }
            else
            {
                Tweet.PublishTweetInReplyTo(mine, _replypool[_selectedReplyId]);
                DeleteFromReplyList(_selectedReplyId);
                textBoxTweet.Text = "";
            }
        }
示例#6
0
        private List <Tweetinvi.Core.Interfaces.IMention> MuiFilter(
            IEnumerable <Tweetinvi.Core.Interfaces.IMention> newreplys)
        {
            var meaningful_replys = new List <Tweetinvi.Core.Interfaces.IMention>();

            foreach (var tweet in newreplys)
            {
                switch (GetContents(tweet.Text))
                {
                case "Yo":
                    var target    = GetReplyTargets(tweet.Text, tweet.Creator.ScreenName);
                    var autoreply = Tweet.CreateTweet(target + "Yo");
                    Tweet.PublishTweetInReplyTo(autoreply, tweet);
                    break;

                default:
                    meaningful_replys.Add(tweet);
                    break;
                }
            }

            return(meaningful_replys);
        }
示例#7
0
        private void onSend(object sender, EventArgs e)
        {
            /*
             * Checks the message length and return a Dialog Error if it's over than 140 chars
             */
            if (message_box.TextLength > 140)
            {
                MessageBox.Show("Tweet is too long",
                                "Max character is 140",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
            }
            var tweet = Tweet.CreateTweet(message_box.Text);

            if (tweet.Publish())
            {
                BaloonShowed = true; //if you send the Tweet it prevent to show "Tweet sent" on the first minimize
                notifyIcon1.BalloonTipText = "Tweet Sent";
                notifyIcon1.ShowBalloonTip(1000);
                if (hide_checkbox.Checked)
                {
                    this.Hide();
                }
                //Reset the message box
                message_box.Text = "";
            }
            else
            {
                MessageBox.Show("Error",
                                "Failed to Send",
                                MessageBoxButtons.OK,
                                MessageBoxIcon.Exclamation,
                                MessageBoxDefaultButton.Button1);
            }
        }