refactor(rest): improve unauthorized readability (#2946)

Currently we use a double negation in the code which makes it harder to understand what it actually does.

Therefore the check has been changed to be understood easier.
This commit is contained in:
ITOH
2023-04-02 16:54:36 +00:00
committed by GitHub
parent 7b5d99e5dd
commit 7c51f731cb
+1 -1
View File
@@ -694,7 +694,7 @@ export function createRestManager(options: CreateRestManagerOptions): RestManage
'user-agent': `DiscordBot (https://github.com/discordeno/discordeno, v${version})`,
}
if (!options?.unauthorized) headers.authorization = `Bot ${rest.token}`
if (options?.unauthorized !== false) headers.authorization = `Bot ${rest.token}`
// IF A REASON IS PROVIDED ENCODE IT IN HEADERS
if (options?.reason !== undefined) {