Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Reply method #55

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 13 additions & 0 deletions TwitterFollowBot/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -451,3 +451,16 @@ def send_tweet(self, message):
"""

return self.TWITTER_CONNECTION.statuses.update(status=message)

def reply(self, keyword, message, count):
"""
Reply to people who tweeted a message with the keyword given.
Count is the number of people to tweet to.
"""

result = self.search_tweets(keyword, 2)
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please edit this line to take the count parameter instead of 2.

for tweets in result["statuses"]:
id = tweets["id_str"]
user = tweets["user"]["screen_name"]
final_message = "@" + user + " " + message
self.TWITTER_CONNECTION.statuses.update(status=final_message, in_reply_to_status_id=id)