redouane59 / twittered

Twitter API client for Java developers
Apache License 2.0
236 stars 64 forks source link

Can't post a Tweet two times #346

Closed n0eL1405 closed 2 years ago

n0eL1405 commented 2 years ago

Hi, I'm trying to make a bot that tweets something after a specific time. Right now I'm using a Timer that executes a TimeTask every minute. In the TimerTask I'm trying to tweet a text and print something in the console for debugging. Everything looks like this: Main:

TwitterClient twitterClient = new TwitterClient(TwitterClient.OBJECT_MAPPER.readValue(new File("AuthKeys.json"), TwitterCredentials.class))
Timer timer = new Timer()
timer.schedule(new TweetTask(twitterClient), Date.from(LocalDateTime.now().atZone(ZoneId.systemDefault()).toInstant()), 1000 * 60);

TimerTask:

twitterClient.postTweet("Text");
System.out.println("Bot tweeted!");

For the first Tweet everything works fine, but it will not tweet any more Tweets. In the console it prints the text every time it should, I don't get any Exceptions or something and the TwitterClient looks fine with the Debugger (as far as I can say).

Thx for the help in advance. Leon

redouane59 commented 2 years ago

Hey, Can you try to do the same thing from the app ? I think twitter app doesn't let a user tweet twice the same content. It should be the same using the API.

n0eL1405 commented 2 years ago

Thx for the reply, you're right. I could have thought of this by my self, but I didn't expected something like this.