There seems to be little to no support so far for the newer versions of Tweepy and the new Twitter API and I would like to reply to tweets based on mention of my account but I'm not sure how to retrieve a tweet id that mentions me so I can reply to it.
mention_id = 1
# The actual bot
while True:
mentions = tweepy.Client.get_users_mentions(mention_id)
for mention in mentions:
print("Mention tweet found")
print(f"{mention.author.screen_name} - {mention.text}")
mention_id = mention.id
if mention.in_reply_to_status_id is True:
try:
print("Attempting to reply...")
response = client.create_tweet(text='tweet response text here',
in_reply_to_tweet_id=mention_id)
print(response)
print("Successfully replied :)")
except Exception as exc:
print(exc)
time.sleep(90)