'How can I find mentions of my account and reply to tweets that mention me using tweepy and twitter API v2?

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) 


Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source