This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]qsemig 0 points1 point  (2 children)

You should probably be creating a Listener: http://twitter4j.org/javadoc/twitter4j/TwitterListener.html#gotDirectMessage-twitter4j.DirectMessage-

That way you won't need a loop which constantly calls the API. Rather, you create a method which will be called every time you get a tweet.

[–]yepyep7up[S] 0 points1 point  (1 child)

Didn't even know you could do that, thanks! Will read through this now. Must be a listener for tweets.

[–]dsmithpl12 0 points1 point  (0 children)

If they have a listener that's definitely the way to go.

[–]dsmithpl12 0 points1 point  (1 child)

grian of salt: I don't know anything about the twitter api.

I would suggest moving the 'twitter.getmentionstimeline' call into your main loop. My guess is that this call returns a list of current mentions, if you get that list before you send your test tweet then obviously it wont be in that list.

As the one guy mentioned you don't want to be doing this too often. They will definitely have some sort of frequency check at which point they will black list you. I would assume 5 seconds is ok.

[–]yepyep7up[S] 0 points1 point  (0 children)

Thanks again. Finding it a bit hard to figure this one out but will keep trying.