Let's tell what message failed to send
This helps avoid wasted time in the other Discord client looking for which message is missing - especially in the case where the HTTP server reports failure, but the message actually arrived.
This commit is contained in:
parent
fb58d48b79
commit
898302e99d
|
@ -317,7 +317,12 @@ static void discord_http_send_msg_cb(struct http_request *req)
|
|||
|
||||
if (req->status_code != 200) {
|
||||
if (discord_http_check_retry(req) == 0) {
|
||||
imcb_error(ic, "Failed to send message (%d).", req->status_code);
|
||||
char *json_text = strstr(req->request, "{\"content\":\"");
|
||||
json_value *js = json_parse(json_text, strlen(json_text));
|
||||
const char *message = json_o_str(js, "content");
|
||||
|
||||
imcb_error(ic, "Failed to send message (%d; %s).", req->status_code, message);
|
||||
json_value_free(js);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue