new "quoi" message and refresh friends list
This commit is contained in:
parent
bb8cfb47b0
commit
ec27cc5aec
1 changed files with 14 additions and 4 deletions
18
main.py
18
main.py
|
@ -19,9 +19,10 @@ def load(variables):
|
||||||
return keys
|
return keys
|
||||||
|
|
||||||
class Listener(StreamListener):
|
class Listener(StreamListener):
|
||||||
def __init__(self, api = None):
|
def __init__(self, api = None, user = None):
|
||||||
super(Listener, self).__init__()
|
super(Listener, self).__init__()
|
||||||
self.api = api
|
self.api = api
|
||||||
|
self.user = user
|
||||||
|
|
||||||
def on_status(self, status):
|
def on_status(self, status):
|
||||||
"""Answer to tweets."""
|
"""Answer to tweets."""
|
||||||
|
@ -31,6 +32,10 @@ class Listener(StreamListener):
|
||||||
if status._json["user"]["screen_name"] in friends:
|
if status._json["user"]["screen_name"] in friends:
|
||||||
try:
|
try:
|
||||||
self.api.update_status(status = choice(feur), in_reply_to_status_id = status._json["id"], auto_populate_reply_metadata = True)
|
self.api.update_status(status = choice(feur), in_reply_to_status_id = status._json["id"], auto_populate_reply_metadata = True)
|
||||||
|
try:
|
||||||
|
getFriends(self.api, self.user)
|
||||||
|
except:
|
||||||
|
pass
|
||||||
print(f"{status._json['user']['screen_name']} est passé au coiffeur !")
|
print(f"{status._json['user']['screen_name']} est passé au coiffeur !")
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
print(f"Error happens! {error}")
|
print(f"Error happens! {error}")
|
||||||
|
@ -70,15 +75,19 @@ def main(accessToken, accessTokenSecret, consumerKey, consumerSecret, user):
|
||||||
|
|
||||||
api = API(auth)
|
api = API(auth)
|
||||||
|
|
||||||
listener = Listener(api)
|
listener = Listener(api, user)
|
||||||
stream = Stream(auth = api.auth, listener = listener)
|
stream = Stream(auth = api.auth, listener = listener)
|
||||||
|
|
||||||
for friend in api.friends(user, skip_status = True):
|
getFriends(api, user)
|
||||||
friends.append(friend._json["screen_name"])
|
|
||||||
|
|
||||||
print(f"Scroll sur Twitter avec les abonnements de @{user}...")
|
print(f"Scroll sur Twitter avec les abonnements de @{user}...")
|
||||||
stream.filter(track = quoi, languages = ["fr"], is_async = True)
|
stream.filter(track = quoi, languages = ["fr"], is_async = True)
|
||||||
|
|
||||||
|
def getFriends(api, user):
|
||||||
|
for friend in api.friends(user, skip_status = True):
|
||||||
|
if "screen_name" not in friends:
|
||||||
|
friends.append(friend._json["screen_name"])
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
"""
|
"""
|
||||||
TOKEN is the Access Token available in the Authentication Tokens section under Access Token and Secret sub-heading.
|
TOKEN is the Access Token available in the Authentication Tokens section under Access Token and Secret sub-heading.
|
||||||
|
@ -89,6 +98,7 @@ if __name__ == '__main__':
|
||||||
PSEUDO is the PSEUDO of the account you want to listen to snipe. A proportion of who s.he follow will be targeted.
|
PSEUDO is the PSEUDO of the account you want to listen to snipe. A proportion of who s.he follow will be targeted.
|
||||||
"""
|
"""
|
||||||
quoi = permute(["quoi", "koi"])
|
quoi = permute(["quoi", "koi"])
|
||||||
|
quoi.append("https://twitter.com/shukuzi62/status/1422611919538724868/video/1")
|
||||||
feur = ["feur", "(feur)", "FEUR", "feur lol"]
|
feur = ["feur", "(feur)", "FEUR", "feur lol"]
|
||||||
friends = []
|
friends = []
|
||||||
keys = load(["TOKEN", "TOKEN_SECRET", "CONSUMER_KEY", "CONSUMER_SECRET", "PSEUDO"])
|
keys = load(["TOKEN", "TOKEN_SECRET", "CONSUMER_KEY", "CONSUMER_SECRET", "PSEUDO"])
|
||||||
|
|
Reference in a new issue