From c1d212440a823898387f296f748568d251cd2f18 Mon Sep 17 00:00:00 2001 From: GoodGradesBoy <> Date: Sun, 18 Jul 2021 18:48:37 +0000 Subject: [PATCH] Fixed register command --- package.json | 7 +++---- src/commands/register.js | 8 ++++---- yarn.lock | 2 +- 3 files changed, 8 insertions(+), 9 deletions(-) diff --git a/package.json b/package.json index db59178..08086ba 100644 --- a/package.json +++ b/package.json @@ -18,14 +18,13 @@ "dependencies": { "@babel/cli": "^7.14.5", "@babel/core": "^7.14.6", - "axios": "^0.21.1", "chalk": "^4.0.0", "discord.js": "^12.4.1", "dotenv": "^10.0.0", "format-duration": "^1.3.1", + "fsevents": "^2.3.2", "moment": "^2.24.0", - "mongoose": "^5.13.2", - "node-fetch": "^2.6.0" + "mongoose": "^5.13.2" }, "devDependencies": { "@babel/node": "^7.14.7", @@ -42,4 +41,4 @@ "jest": "^27.0.6", "nodemon": "^2.0.12" } -} \ No newline at end of file +} diff --git a/src/commands/register.js b/src/commands/register.js index 9a29472..d82e228 100644 --- a/src/commands/register.js +++ b/src/commands/register.js @@ -1,9 +1,9 @@ import { User } from '../models/user.model'; -const fetch = require(`node-fetch`); +const cloudscraper = require(`cloudscraper`); -const urlExists = async url => await fetch(url) - .then((res) => res.text()) - .then((res) => res.includes(`RACER_INFO`)); +const urlExists = async url => await cloudscraper.get(url) + .then((res) => res.includes(`RACER_INFO`)) + .catch((err) => false); // apparently it returns a captcha error if the racer doens't exist const registerUser = (msg, ntLink) => { const user = new User({ diff --git a/yarn.lock b/yarn.lock index 2578657..d3a40a9 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4253,7 +4253,7 @@ node-environment-flags@^1.0.5: object.getownpropertydescriptors "^2.0.3" semver "^5.7.0" -node-fetch@^2.6.0, node-fetch@^2.6.1: +node-fetch@^2.6.1: version "2.6.1" resolved "https://registry.yarnpkg.com/node-fetch/-/node-fetch-2.6.1.tgz#045bd323631f76ed2e2b55573394416b639a0052" integrity sha512-V4aYg89jEoVRxRb2fJdAg8FHvI7cEyYdVAh94HH0UIK8oJxUfkjlDQN9RbMx+bEjP7+ggMiFRprSti032Oipxw==