Added more debug messages

This commit is contained in:
Frisk 2018-12-30 14:06:09 +01:00
parent 9b0cb59af4
commit b67181e7de
No known key found for this signature in database
GPG key ID: 0E9A7D3C0A01586C

View file

@ -111,7 +111,7 @@ def send_to_discord_webhook(data):
logging.warning("Connection error while sending the data to a webhook")
return 3
else:
return handle_discord_http(result.status_code, data)
return handle_discord_http(result.status_code, data, result)
def send_to_discord(data):
@ -508,13 +508,14 @@ def webhook_formatter(action, STATIC, **params):
send_to_discord(formatted_embed)
def handle_discord_http(code, formatted_embed):
def handle_discord_http(code, formatted_embed, result):
if 300 > code > 199: # message went through
return 0
elif code == 400: # HTTP BAD REQUEST
logging.error(
"Following message has been rejected by Discord, please submit a bug on our bugtracker adding it:")
logging.error(formatted_embed)
logging.error(result.text)
return 1
elif code == 401 or code == 404: # HTTP UNAUTHORIZED AND NOT FOUND
logging.error("Webhook URL is invalid or no longer in use, please replace it with proper one.")