Merge pull request #168 from Alcaro/patch-5

Let's tell what message failed to send
This commit is contained in:
Artem Savkov 2018-07-18 18:22:24 +02:00 committed by GitHub
commit ea210b62c4
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 1 deletions

View File

@ -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);
}
}
}