Skip to content

Commit

Permalink
Merge pull request #52 from kyranb/master
Browse files Browse the repository at this point in the history
Added the ability to unfollow all followers.
  • Loading branch information
Randy Olson committed Jul 6, 2015
2 parents 78270ce + 65dc75c commit 91a7374
Show file tree
Hide file tree
Showing 2 changed files with 27 additions and 2 deletions.
11 changes: 11 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -167,8 +167,19 @@ By default, the bot looks up the 100 most recent tweets. You can change this num
my_bot = TwitterBot()
my_bot.auto_unfollow_nonfollowers()

If there are certain users that you would like to not unfollow, add their user id to the USERS_KEEP_FOLLOWING list.

You will need to manually edit the code if you want to add special users that you will keep following even if they don't follow you back.

####Automatically unfollow all users.

from TwitterFollowBot import TwitterBot

my_bot = TwitterBot()
my_bot.auto_unfollow_all_followers()



####Automatically mute all users that you have followed

from TwitterFollowBot import TwitterBot
Expand Down
18 changes: 16 additions & 2 deletions TwitterFollowBot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -398,9 +398,23 @@ def auto_unfollow_nonfollowers(self,count=None):

for user_id in not_following_back:
if user_id not in self.BOT_CONFIG["USERS_KEEP_FOLLOWING"]:

self.wait_on_action()


self.TWITTER_CONNECTION.friendships.destroy(user_id=user_id)
print("Unfollowed %d" % (user_id), file=sys.stdout)

def auto_unfollow_all_followers(self,count=None):
"""
Unfollows everyone that you are following(except those who you have specified not to)
"""
following = self.get_follows_list()

for user_id in following:
if user_id not in self.BOT_CONFIG["USERS_KEEP_FOLLOWING"]:

self.wait_on_action()

self.TWITTER_CONNECTION.friendships.destroy(user_id=user_id)
print("Unfollowed %d" % (user_id), file=sys.stdout)

Expand Down

0 comments on commit 91a7374

Please sign in to comment.