fix error show

This commit is contained in:
Mylloon 2022-08-07 15:32:54 +02:00
parent eb36ef013b
commit 898e1e03cc
Signed by: Anri
GPG key ID: A82D63DFF8D1317F

12
main.py
View file

@ -155,12 +155,14 @@ class Listener(Stream):
except Exception as error: except Exception as error:
error = loads(error.response.text)["errors"][0] error = loads(error.response.text)["errors"][0]
# https://developer.twitter.com/en/support/twitter-api/error-troubleshooting # https://developer.twitter.com/en/support/twitter-api/error-troubleshooting
show_error = True
if error["code"] == 385: if error["code"] == 385:
error["message"] = "Tweet supprimé ou auteur en privé/bloqué." error["message"] = f"Tweet supprimé ou auteur ({json['user']['screen_name']}) en privé/bloqué."
# Don't show the error 385 if verbose is False show_error = False
if not keys["VERBOSE"]:
pass # Show error only if relevant, always in verbose
print(f"{errorMessage[:-2]} ({error['code']}) ! {error['message']}") if show_error or keys["VERBOSE"]:
print(f"{errorMessage[:-2]} ({error['code']}) ! {error['message']}")
else: else:
if keys["VERBOSE"]: if keys["VERBOSE"]:
print("Annulation car le dernier mot n'est pas intéressant.") print("Annulation car le dernier mot n'est pas intéressant.")