Remove nulled properties from GET /channels/#id/messages for improved compatibility with some client ( discord.js )

This commit is contained in:
Madeline 2022-02-04 19:59:13 +11:00
parent 038094769c
commit b512fa49b0

View File

@ -126,6 +126,13 @@ router.get("/", async (req: Request, res: Response) => {
y.proxy_url = `${endpoint == null ? "" : endpoint}${new URL(uri).pathname}`;
});
//Some clients ( discord.js ) only check if a property exists within the response,
//which causes erorrs when, say, the `application` property is `null`.
for (var curr in x) {
if (x[curr] === null)
delete x[curr];
}
return x;
})
);