python - Twitter reply bot replies to its own replies (infinite feedback loop) -


new tweepy api.

i'm using github script here: https://github.com/twitterdev/sample-python-autoreply

        if retweeted not none , not retweeted , not from_self:              tweetid = tweet.get('id_str')             screenname = tweet.get('user',{}).get('screen_name')             tweettext = tweet.get('text')              chatresponse = chatbot.respond(tweettext)              replytext = '@' + screenname + ' ' + chatresponse              #check if repsonse on 140 char             if len(replytext) > 140:                 replytext = replytext[0:139] + '…'              print('tweet id: ' + tweetid)             print('from: ' + screenname)             print('tweet text: ' + tweettext)             print('reply text: ' + replytext)              # if rate limited, status posts should queued , sent on interval             twitterapi.update_status(status=replytext, in_reply_to_status_id=tweetid)      def on_error(self, status):         print status 

i managed working seems reply infinitely. there way limit this? or fix doesn't reply itself? i'm assuming it's checking @botusername , replying tweets. rest of code available in github link (it's autoreply.py).


Comments