mirror of
https://github.com/MCV-Software/TWBlue.git
synced 2024-11-23 03:38:08 -06:00
Hide replies to users the current account doesn't follow in streaming API
This commit is contained in:
parent
84cbf5c497
commit
c926355048
@ -1,6 +1,7 @@
|
|||||||
# -*- coding: utf-8 -*-
|
# -*- coding: utf-8 -*-
|
||||||
""" Streaming support for TWBlue. """
|
""" Streaming support for TWBlue. """
|
||||||
import time
|
import time
|
||||||
|
import sys
|
||||||
import six
|
import six
|
||||||
import requests
|
import requests
|
||||||
import urllib3
|
import urllib3
|
||||||
@ -30,9 +31,12 @@ class StreamListener(tweepy.StreamListener):
|
|||||||
|
|
||||||
def on_status(self, status):
|
def on_status(self, status):
|
||||||
""" Checks data arriving as a tweet. """
|
""" Checks data arriving as a tweet. """
|
||||||
|
# Hide replies to users not followed by current account.
|
||||||
|
if status.in_reply_to_user_id_str != None and status.in_reply_to_user_id_str not in self.users:
|
||||||
|
return
|
||||||
if status.user.id_str in self.users:
|
if status.user.id_str in self.users:
|
||||||
pub.sendMessage("newStatus", status=status, user=self.user)
|
pub.sendMessage("newStatus", status=status, user=self.user)
|
||||||
# print(status.text)
|
|
||||||
|
|
||||||
|
|
||||||
class Stream(tweepy.Stream):
|
class Stream(tweepy.Stream):
|
||||||
|
Loading…
Reference in New Issue
Block a user