I have put together a very simple twitter bot using the "python-twitter" library. Basically, it waits for a user to tweet something to respond to it. To do this, I used a while loop which compares every minute the last tweet the user posted with the one stored when the program was launched. If the tweet is different, then we perform the action on it (a response in my case), otherwise we wait. And in both cases we update the tweet in memory with the most recent one to be ready to wait for the next tweet.
This method works but I was wondering if there isn't a more general way, which consists instead of doing loops, to wait for the reception of a single tweet with an event in order to solve problems like: The user tweets twice within a minute, in which case only the most recent tweet is considered. Or the maximum request amount for consulting a tweet is exeeded (which is 100 000 I think in the twitter API)
I am not trying to apply the solution particularly on this program but to learn about the subject (if it is possible only using Java Script or other for example) being unable to find more precise resources on the internet
Thanks