示例#1
0
 /// <summary>
 /// Follow a new user
 /// </summary>
 /// <returns>Boolean</returns>
 public static void followUser(TwitterUser user)
 {
     try
     {
         mainService.FollowUser(new FollowUserOptions {
             UserId = user.Id
         });
     }
     catch (Exception)
     {
     }
 }
示例#2
0
        public static IEnumerable <TwitterUser> FollowList(long?userId = null, string scrrenName = null)
        {
            if (userId == null && scrrenName == null)
            {
                return(new List <TwitterUser>());
            }

            FollowUserOptions option = new FollowUserOptions
            {
            };


            var follows = service.FollowUser(option);

            /*
             * while (follows?.NextCursor != null)
             * {
             *  option.Cursor = followers.NextCursor;
             *
             *  followers = service.ListFollowers(option);
             *
             *  if (followers != null)
             *  {
             *      returns = returns.Concat(followers.ToList());
             *  }
             * }
             *
             * return returns;
             */
            return(new List <TwitterUser>());
        }
示例#3
0
 /// <summary>
 /// follows specified user
 /// </summary>
 /// <param name="targetName">user to be followed</param>
 public void followUser(string targetName)
 {
     twitter.FollowUser(new FollowUserOptions()
     {
         ScreenName = targetName
     });
 }
        public static void FollowBackNotFollowed()
        {
            string _consumerKey       = ConfigurationManager.AppSettings["consumerKey"];
            string _consumerSecret    = ConfigurationManager.AppSettings["consumerSecret"];
            string _accessToken       = ConfigurationManager.AppSettings["accessToken"];
            string _accessTokenSecret = ConfigurationManager.AppSettings["accessTokenSecret"];

            var service = new TwitterService(_consumerKey, _consumerSecret);

            service.AuthenticateWith(_accessToken, _accessTokenSecret);

            TwitterUser self = service.GetUserProfile(new GetUserProfileOptions()
            {
                IncludeEntities = false, SkipStatus = false
            });

            ListFollowersOptions options = new ListFollowersOptions();

            options.UserId = self.Id;
            options.IncludeUserEntities = true;
            TwitterCursorList <TwitterUser> followers = service.ListFollowers(options);

            foreach (var follow in followers)
            {
                service.FollowUser(new FollowUserOptions {
                    UserId = follow.Id
                });                                                              //seems to work w/ no errors, even if already followed
            }
        }
示例#5
0
        public string Follow(string userName, string Nick, string screenName)
        {
            var twitterSecret = new TwitterSecretData(userName, Nick);
            var service       = new TwitterService(twitterSecret._OAuthConsumerKey, twitterSecret._OAuthConsumerSecret);

            service.AuthenticateWith(twitterSecret._OAuthAccessToken, twitterSecret._OAuthAccessTokenSecret);
            FollowUserOptions _FollowUserOptions = new TweetSharp.FollowUserOptions();

            _FollowUserOptions.ScreenName = screenName;
            service.FollowUser(_FollowUserOptions);
            return("Followed successfully!");
        }
 public override bool ExecuteCommand()
 {
     if (Arguments.Length == 0)
     {
         throw new InvalidOperationException("Follow who?");
     }
     TweetSharp.TwitterService svc = new TwitterService(GetClientInfo());
     svc.AuthenticateWith(ConfigurationManager.AppSettings["User.Token"],
                          ConfigurationManager.AppSettings["User.TokenSecret"]);
     svc.FollowUser(Arguments[0]);
     Bot.PrivateReply(Message.FromUser, "Ok -- I'm following " + Arguments[0]);
     return(true);
 }
        public static void FollowPoetryHashtaggers(int cnt)
        {
            string _consumerKey       = ConfigurationManager.AppSettings["consumerKey"];
            string _consumerSecret    = ConfigurationManager.AppSettings["consumerSecret"];
            string _accessToken       = ConfigurationManager.AppSettings["accessToken"];
            string _accessTokenSecret = ConfigurationManager.AppSettings["accessTokenSecret"];

            var service = new TwitterService(_consumerKey, _consumerSecret);

            service.AuthenticateWith(_accessToken, _accessTokenSecret);

            var tweets = service.Search(new SearchOptions {
                Q = "#poetry", Count = cnt, Resulttype = TwitterSearchResultType.Popular, IncludeEntities = false
            });

            foreach (var tweet in tweets.Statuses)
            {
//                Console.WriteLine(tweet.User.ScreenName);
                service.FollowUser(new FollowUserOptions {
                    UserId = tweet.User.Id
                });
            }
        }
示例#8
0
文件: Jarvis.cs 项目: oslboreal/twsc
 /// <summary>
 /// Follow a new user
 /// </summary>
 /// <returns>Boolean</returns>
 public static void followUser(long id)
 {
     mainService.FollowUser(new FollowUserOptions {
         UserId = id, Follow = false
     });
 }