def tweet_mood(sign, mood):
tweet = f"{sign}: {mood}"
if len(tweet) <= 280:
response = client.create_tweet(text=tweet)
tweet_id = response.data.id
else:
tweets = [tweet[i:i+277] + "..." for i in range(0, len(tweet), 277)]
tweet_id = None
for t in tweets:
if tweet_id is None:
response = client.create_tweet(text=t)
tweet_id = response.id
else:
response = client.create_tweet(text=t, in_reply_to_tweet_id=tweet_id)
tweet_id = response.id
return tweet_id
I want it to send tweets that do not fit in 280 characters as a tweet thread. but my code is giving error "[ERROR] AttributeError: 'dict' object has no attribute 'id'"
I don't know how to code or program. I am trying to learn something by developing a project.
I was progressing smoothly until I got to this stage. It sends a tweet but does not create a tweet thread.
The problem is definitely related to "response.id" but I can't find a solution.
The bot I'm trying to do enters a promt on openai and tweets the incoming response. Due to the 280 character limit, I couldn't get the exact result I wanted, so I'm trying to create a tweet thread.