Exemplo n.º 1
0
    def on_mention(self, tweet, prefix):
        tweet_time = tweet.created_at # tweet timestamp
        now = datetime.datetime.utcnow()
        diff = now - tweet_time # tweet age

        # only reply to mentions in last 2 mins
        if diff.seconds <= 120:
            tweet_text = re.sub(r'^@(\w{1,15})\b', "", tweet.text).replace("@snailify", "")
            text = snailify(tweet_text)
            self.post_tweet(prefix + ' ' + text, reply_to=tweet)
Exemplo n.º 2
0
 def on_timeline(self, tweet, prefix):
     if random.random() < 0.2:
         tweet_text = re.sub(r'^@(\w{1,15})\b', "", tweet.text).replace("@snailify", "")
         text = snailify(tweet_text)
         self.post_tweet(prefix + ' ' + text, reply_to=tweet)