fix unban issue. silly edges cases discord api has

This commit is contained in:
Skillz
2020-09-06 18:01:45 -04:00
parent d1bc0af761
commit 1f1df4e513
2 changed files with 7 additions and 3 deletions
+1 -1
View File
@@ -2,7 +2,7 @@ name: Discordeno
description: >-
Discord Deno TypeScript API library wrapper(Officially vetted library by
Discord Team) https://discordeno.netlify.app
version: 8.7.0
version: 8.7.1
stable: true
files:
- ./src/**/*
+6 -2
View File
@@ -142,17 +142,20 @@ function createRequestBody(body: any, method: RequestMethod) {
Authorization: authorization,
"User-Agent":
`DiscordBot (https://github.com/skillz4killz/discordeno, 6.0.0)`,
"X-Audit-Log-Reason": body ? encodeURIComponent(body.reason) : "",
};
if (method === "get") body = undefined;
if (body?.reason) {
headers["X-Audit-Log-Reason"] = encodeURIComponent(body.reason);
}
if (body?.file) {
const form = new FormData();
form.append("file", body.file.blob, body.file.name);
form.append("payload_json", JSON.stringify({ ...body, file: undefined }));
body.file = form;
} else {
} else if (body) {
headers["Content-Type"] = "application/json";
}
@@ -283,6 +286,7 @@ function handleStatusCode(response: Response) {
return true;
}
console.error(response);
logRed(response);
switch (status) {