fix bug with hashtag tweets

This commit is contained in:
Mylloon 2022-08-08 02:29:40 +02:00
parent d1ee920d7a
commit e347f7fcb7
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

View file

@ -122,7 +122,8 @@ class Listener(StreamingClient):
print(
f"Tweet trouvé de {username} ({infoLastWord})...", end=" ")
if len(lastWord) > 0:
# Hashtag tweet
if len(lastWord) == 0:
return
# Fetch the last word of the tweet
@ -163,8 +164,8 @@ class Listener(StreamingClient):
print(f"Envoie d'un {answer[0]}...", end=" ")
try:
# Send the tweet with the answer
self.client.create_tweet(
in_reply_to_tweet_id=tweet.id, text=choice(answer))
""" self.client.create_tweet(
in_reply_to_tweet_id=tweet.id, text=choice(answer)) """
print(f"{username} s'est fait {answer[0]} !")
except Exception as error:
error = loads(error.response.text)["errors"][0]