Beispiel #1
0
 def on_status(self, tweet):
     if tweet.user.screen_name.lower() in self.relevant_users:
         if not tweet.text.startswith(
                 'RT '
         ) and tweet.in_reply_to_screen_name is None:
             tw = tweet_prettify_urls(tweet)
             self.bot.say(
                 'Volcania New tweet from {0}: {1}'.format(
                     tweet.user.screen_name,
                     tw.replace('\n', ' ')))
Beispiel #2
0
    def get_last_tweet(self, username):
        if self.twitter_client:
            try:
                public_tweets = self.twitter_client.user_timeline(username)
                for tweet in public_tweets:
                    if not tweet.text.startswith('RT ') and tweet.in_reply_to_screen_name is None:
                        tw = tweet_prettify_urls(tweet)
                        return '{0} ({1} ago)'.format(tw.replace('\n', ' '), time_since(datetime.now().timestamp(), tweet.created_at.timestamp(), format='short'))
            except Exception:
                log.exception('Exception caught while getting last tweet')
                return 'FeelsBadMan'
        else:
            return 'Twitter not set up FeelsBadMan'

        return 'FeelsBadMan'
Beispiel #3
0
    def get_last_tweet(self, username):
        if self.twitter_client:
            try:
                public_tweets = self.twitter_client.user_timeline(username)
                for tweet in public_tweets:
                    if not tweet.text.startswith(
                            'RT ') and tweet.in_reply_to_screen_name is None:
                        tw = tweet_prettify_urls(tweet)
                        return '{0} ({1} ago)'.format(
                            tw.replace('\n', ' '),
                            time_since(datetime.now().timestamp(),
                                       tweet.created_at.timestamp(),
                                       format='short'))
            except Exception:
                log.exception('Exception caught while getting last tweet')
                return 'FeelsBadMan'
        else:
            return 'Twitter not set up FeelsBadMan'

        return 'FeelsBadMan'
Beispiel #4
0
 def on_status(self, tweet):
     if tweet.user.screen_name.lower() in self.relevant_users:
         if not tweet.text.startswith('RT ') and tweet.in_reply_to_screen_name is None:
             tw = tweet_prettify_urls(tweet)
             self.bot.say('Volcania New tweet from {0}: {1}'.format(tweet.user.screen_name, tw.replace('\n', ' ')))