add auto nitro redeeming

This commit is contained in:
TheDevYellowy
2022-07-09 05:07:01 -05:00
parent 6e20cbb592
commit 4e52655c08
9 changed files with 6963 additions and 18 deletions

View File

@@ -346,7 +346,11 @@ class RequestHandler {
} catch (err) {
throw new HTTPError(err.message, err.constructor.name, err.status, request);
}
/**
* If the response code is 10038 or UNKNOWN_GIFT_CODE then return the data object instead of throwing the error. *continues on next line*
* [].includes() adds better scaleability instead of stacking if statements (Yellowy)
*/
if ([10038].includes(data.code)) return data;
throw new DiscordAPIError(data, res.status, request);
}