Пример #1
0
        /// <summary>
        /// Recibe una lista de usuarios y si estos no me siguen deja de seguirlos.
        /// </summary>
        /// <param name="listUsers"></param>
        /// <returns>JarvisResponse</returns>
        public static JarvisResponse unfollowBadUsers(List <TwitterUser> listUsers)
        {
            int            counter   = 0;
            JarvisResponse jResponse = new JarvisResponse();
            StringBuilder  aux       = new StringBuilder();

            foreach (var item in listUsers)
            {
                counter++;
                // Para manejar el Rate limit de Twitter usamos contador.
                // 15 Requests cada 15 Minutos.
                if (counter < 50)
                {
                    TwitterFriendship test = mainService.GetFriendshipInfo(new GetFriendshipInfoOptions {
                        TargetId = item.Id.ToString()
                    });

                    if (test.Relationship.Target.FollowedBy == true && test.Relationship.Target.Following == false)
                    {
                        jResponse.count++;
                        mainService.UnfollowUser(new UnfollowUserOptions {
                            UserId = item.Id
                        });
                        aux.AppendLine("@" + item.ScreenName + " - ID: " + item.Id);
                        aux.AppendLine("Relationship state = " + test.Relationship.Target.Following);
                    }
                }
            }
            aux.AppendLine("Cantidad de usuarios seguidos: " + jResponse.count);
            Jarvis.unfollowCount += jResponse.count;
            jResponse.message     = aux.ToString();
            return(jResponse);
        }
Пример #2
0
        /// <summary>
        /// This method AutoFollow new users that not follows our Account
        /// </summary>
        /// <param name="listUsers"></param>
        /// <returns>JarvisResponse</returns>
        public static JarvisResponse followNewUsers(List <long> idList)
        {
            int            counter   = 0;
            JarvisResponse jResponse = new JarvisResponse();
            StringBuilder  aux       = new StringBuilder();

            foreach (var item in idList)
            {
                counter++;
                // Para manejar el Rate limit de Twitter usamos contador.
                // 15 Requests cada 15 Minutos.
                if (counter < 30)
                {
                    jResponse.count++;
                    mainService.FollowUser(new FollowUserOptions {
                        UserId = item
                    });
                    aux.AppendLine("ID: " + item);
                }
            }
            aux.AppendLine("Cantidad de usuarios seguidos: " + jResponse.count);
            Jarvis.followCount += jResponse.count;
            jResponse.message   = aux.ToString();
            return(jResponse);
        }
Пример #3
0
        public static JarvisResponse getRelationInformation(long userId)
        {
            JarvisResponse    jResponse = new JarvisResponse();
            StringBuilder     sBuilder  = new StringBuilder();
            TwitterFriendship rs        = mainService.GetFriendshipInfo(new GetFriendshipInfoOptions {
                TargetId = userId.ToString()
            });

            sBuilder.AppendLine("FollowedBy: " + rs.Relationship.Target.FollowedBy.ToString());
            sBuilder.AppendLine("Following: " + rs.Relationship.Target.Following.ToString());
            jResponse.message = sBuilder.ToString();
            return(jResponse);
        }
Пример #4
0
        /// <summary>
        /// This method GETS a collection of "Following" users and unfollow them if the user isnt in a Friendship
        /// </summary>
        /// <returns>JarvisResponse - This method returns a JarvisResponse Object with a Message and Counting info.</returns>
        public static JarvisResponse autoUnfollowNoFriendshipsUsers()
        {
            StringBuilder aux = new StringBuilder();

            Jarvis.jResponse = new JarvisResponse();
            jResponse.count  = 0;
            aux.AppendLine("Unfollowed Users:");
            // Collection with all followers.
            var colectionOfFollowers = Jarvis.getAllFollowingUsers();

            // Travel all collection

            // Append message footer.
            aux.AppendLine("Users: " + jResponse.count + "/" + colectionOfFollowers.Count);
            jResponse.message = aux.ToString();
            return(jResponse);
        }