fix bug with hashtag tweets
This commit is contained in:
parent
d1ee920d7a
commit
e347f7fcb7
1 changed files with 4 additions and 3 deletions
7
main.py
7
main.py
|
@ -122,7 +122,8 @@ class Listener(StreamingClient):
|
||||||
print(
|
print(
|
||||||
f"Tweet trouvé de {username} ({infoLastWord})...", end=" ")
|
f"Tweet trouvé de {username} ({infoLastWord})...", end=" ")
|
||||||
|
|
||||||
if len(lastWord) > 0:
|
# Hashtag tweet
|
||||||
|
if len(lastWord) == 0:
|
||||||
return
|
return
|
||||||
|
|
||||||
# Fetch the last word of the tweet
|
# Fetch the last word of the tweet
|
||||||
|
@ -163,8 +164,8 @@ class Listener(StreamingClient):
|
||||||
print(f"Envoie d'un {answer[0]}...", end=" ")
|
print(f"Envoie d'un {answer[0]}...", end=" ")
|
||||||
try:
|
try:
|
||||||
# Send the tweet with the answer
|
# Send the tweet with the answer
|
||||||
self.client.create_tweet(
|
""" self.client.create_tweet(
|
||||||
in_reply_to_tweet_id=tweet.id, text=choice(answer))
|
in_reply_to_tweet_id=tweet.id, text=choice(answer)) """
|
||||||
print(f"{username} s'est fait {answer[0]} !")
|
print(f"{username} s'est fait {answer[0]} !")
|
||||||
except Exception as error:
|
except Exception as error:
|
||||||
error = loads(error.response.text)["errors"][0]
|
error = loads(error.response.text)["errors"][0]
|
||||||
|
|
Reference in a new issue