There is already a TwitterFollowBot modudel for python.
I have added a function to message everyone who has followed you.
My repository: https://github.com/aybakana/TwitterFollowBot
To make this change manuelly, go to C:\Python27\Lib\site-packages\TwitterFollowBot and change the __init__.py file with the one on my repository.
The function I added:
def auto_message_followers(self,message,count=None):
I have added a function to message everyone who has followed you.
My repository: https://github.com/aybakana/TwitterFollowBot
To make this change manuelly, go to C:\Python27\Lib\site-packages\TwitterFollowBot and change the __init__.py file with the one on my repository.
The function I added:
def auto_message_followers(self,message,count=None):
| ||
| """ | ||
| following = self.get_follows_list() | ||
| followers = self.get_followers_list() | ||
| not_following_back = followers - following | ||
| not_following_back = list(not_following_back)[:count] | ||
| for user_id in not_following_back: | ||
| try: | ||
| self.wait_on_action() | ||
| self.TWITTER_CONNECTION.direct_messages.new(user_id=user_id, text=message) | ||
| except TwitterHTTPError as api_error: | ||
| # quit on rate limit errors | ||
| if "unable to message more people at this time" in str(api_error).lower(): | ||
| print("You are unable to message more people at this time. " | ||
| "Wait a while before running the bot again or gain " | ||
| "more followers.", file=sys.stderr) | ||
| return | ||
| # don't print "already requested to follow" errors - they're frequent | ||
| if "already messaged" not in str(api_error).lower(): | ||
| print("Error: %s" % (str(api_error)), file=sys.stderr) |
Comments
Post a Comment