当前位置: 首页>>代码示例>>C#>>正文


C# TwitterService.Retweet方法代码示例

本文整理汇总了C#中TweetSharp.TwitterService.Retweet方法的典型用法代码示例。如果您正苦于以下问题:C# TwitterService.Retweet方法的具体用法?C# TwitterService.Retweet怎么用?C# TwitterService.Retweet使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在TweetSharp.TwitterService的用法示例。


在下文中一共展示了TwitterService.Retweet方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: DoRetweets

        public static void DoRetweets()
        {
            string CONSUMER_KEY = "R";
            string CONSUMER_SECRET = "R";
            string ACCESS_TOKEN = "R";
            string ACCESS_SECRET = "R";

            var service = new TwitterService(CONSUMER_KEY, CONSUMER_SECRET);
            service.AuthenticateWith(ACCESS_TOKEN, ACCESS_SECRET);

            //WoW
            var currentTweets = service.ListTweetsOnUserTimeline(
                new ListTweetsOnUserTimelineOptions()
                {
                    Count = 5,
                    ExcludeReplies = false,
                    IncludeRts = false,
                    ScreenName = "@" + "blizzpostswow",
                    SinceId = null,
                    MaxId = null
                }).Where(x => (DateTime.UtcNow - x.CreatedDate).TotalHours <= 6 && x.RetweetCount == 0);

            foreach (var tweet in currentTweets)
            {
                if (tweet.InReplyToStatusId == null && !tweet.Text.EndsWith("~!"))
                    service.Retweet(new RetweetOptions { Id = tweet.Id });
                Console.WriteLine("Retweet result: " + service.Response.StatusCode.ToString());
            }

            //D3
            currentTweets = service.ListTweetsOnUserTimeline(
                new ListTweetsOnUserTimelineOptions()
                {
                    Count = 5,
                    ExcludeReplies = false,
                    IncludeRts = false,
                    ScreenName = "@" + "blizzpostsd3",
                    SinceId = null,
                    MaxId = null
                }).Where(x => (DateTime.UtcNow - x.CreatedDate).TotalHours <= 6 && x.RetweetCount == 0);

            foreach (var tweet in currentTweets)
            {
                if (tweet.InReplyToStatusId == null && !tweet.Text.EndsWith("~!"))
                    service.Retweet(new RetweetOptions { Id = tweet.Id });
                Console.WriteLine("Retweet result: " + service.Response.StatusCode.ToString());
            }

            //Hearthstone
            currentTweets = service.ListTweetsOnUserTimeline(
                new ListTweetsOnUserTimelineOptions()
                {
                    Count = 5,
                    ExcludeReplies = false,
                    IncludeRts = false,
                    ScreenName = "@" + "blizzpostshs",
                    SinceId = null,
                    MaxId = null
                }).Where(x => (DateTime.UtcNow - x.CreatedDate).TotalHours <= 6 && x.RetweetCount == 0);

            foreach (var tweet in currentTweets)
            {
                if (tweet.InReplyToStatusId == null && !tweet.Text.EndsWith("~!"))
                    service.Retweet(new RetweetOptions { Id = tweet.Id });
                Console.WriteLine("Retweet result: " + service.Response.StatusCode.ToString());
            }

            //Heroes
            currentTweets = service.ListTweetsOnUserTimeline(
                new ListTweetsOnUserTimelineOptions()
                {
                    Count = 5,
                    ExcludeReplies = false,
                    IncludeRts = false,
                    ScreenName = "@" + "blizzpostshots",
                    SinceId = null,
                    MaxId = null
                }).Where(x => (DateTime.UtcNow - x.CreatedDate).TotalHours <= 6 && x.RetweetCount == 0);

            foreach (var tweet in currentTweets)
            {
                if (tweet.InReplyToStatusId == null && !tweet.Text.EndsWith("~!"))
                    service.Retweet(new RetweetOptions { Id = tweet.Id });
                Console.WriteLine("Retweet result: " + service.Response.StatusCode.ToString());
            }

            //SC2
            currentTweets = service.ListTweetsOnUserTimeline(
                new ListTweetsOnUserTimelineOptions()
                {
                    Count = 5,
                    ExcludeReplies = false,
                    IncludeRts = false,
                    ScreenName = "@" + "blizzpostssc2",
                    SinceId = null,
                    MaxId = null
                }).Where(x => (DateTime.UtcNow - x.CreatedDate).TotalHours <= 6 && x.RetweetCount == 0);

            foreach (var tweet in currentTweets)
            {
//.........这里部分代码省略.........
开发者ID:danellos,项目名称:OldBlizzposts,代码行数:101,代码来源:Program.cs


注:本文中的TweetSharp.TwitterService.Retweet方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。