twitools/twitools/streaming.py

15 lines
391 B
Python
Raw Normal View History

2017-03-24 12:08:47 +00:00
import bottools.methods, dbtools, html, tweepy
2017-03-23 13:18:52 +00:00
class BotStreamListener(tweepy.StreamListener):
2017-03-23 16:01:05 +00:00
def __init__(self, bot, cid, *args, **kwargs):
tweepy.StreamListener.__init__(self, *args, **kwargs)
2017-03-23 13:18:52 +00:00
self.bot = bot
self.cid = cid
def on_status(self, status):
2017-03-24 12:08:47 +00:00
bottools.methods.tweetMessage(status, self.cid, self.bot)
2017-03-23 13:18:52 +00:00
def on_error(self, status):
if status == 420:
return False