~denisebitca/esmeralde

a76ae8a06b9309db08fad75d3422ad370b82cf23 — Rafael Bitca 2 years ago e7ea9a4
Crawler code revamp and return of the commands
6 files changed, 693 insertions(+), 45 deletions(-)

M package-lock.json
M package.json
M src/Crawler.ts
A src/commands/edt.ts
D src/index.js
A src/index.ts
M package-lock.json => package-lock.json +481 -4
@@ 9,19 9,145 @@
      "version": "1.0.0",
      "license": "ISC",
      "dependencies": {
        "@discordjs/rest": "^0.2.0-canary.0",
        "axios": "^0.21.2",
        "cheerio": "^1.0.0-rc.10",
        "dayjs": "^1.10.7",
        "discord-api-types": "^0.26.1",
        "discord.js": "^13.6.0",
        "typescript": "^4.4.2"
      },
      "devDependencies": {
        "@types/node": "^16.7.12"
      }
    },
    "node_modules/@discordjs/builders": {
      "version": "0.11.0",
      "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.11.0.tgz",
      "integrity": "sha512-ZTB8yJdJKrKlq44dpWkNUrAtEJEq0gqpb7ASdv4vmq6/mZal5kOv312hQ56I/vxwMre+VIkoHquNUAfnTbiYtg==",
      "dependencies": {
        "@sindresorhus/is": "^4.2.0",
        "discord-api-types": "^0.26.0",
        "ts-mixer": "^6.0.0",
        "tslib": "^2.3.1",
        "zod": "^3.11.6"
      },
      "engines": {
        "node": ">=16.0.0",
        "npm": ">=7.0.0"
      }
    },
    "node_modules/@discordjs/collection": {
      "version": "0.4.0",
      "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.4.0.tgz",
      "integrity": "sha512-zmjq+l/rV35kE6zRrwe8BHqV78JvIh2ybJeZavBi5NySjWXqN3hmmAKg7kYMMXSeiWtSsMoZ/+MQi0DiQWy2lw==",
      "engines": {
        "node": ">=16.0.0",
        "npm": ">=7.0.0"
      }
    },
    "node_modules/@discordjs/rest": {
      "version": "0.2.0-canary.0",
      "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-0.2.0-canary.0.tgz",
      "integrity": "sha512-jOxz1aqTEzn9N0qaJcZbHz6FbA0oq+vjpXUKkQzgfMihO6gC+kLlpRnFqG25T/aPYbjaR1UM/lGhrGBB1dutqg==",
      "dependencies": {
        "@discordjs/collection": "^0.3.2",
        "@sapphire/async-queue": "^1.1.9",
        "@sapphire/snowflake": "^3.0.0",
        "discord-api-types": "^0.25.2",
        "form-data": "^4.0.0",
        "node-fetch": "^2.6.5",
        "tslib": "^2.3.1"
      },
      "engines": {
        "node": ">=16.0.0"
      }
    },
    "node_modules/@discordjs/rest/node_modules/@discordjs/collection": {
      "version": "0.3.2",
      "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.3.2.tgz",
      "integrity": "sha512-dMjLl60b2DMqObbH1MQZKePgWhsNe49XkKBZ0W5Acl5uVV43SN414i2QfZwRI7dXAqIn8pEWD2+XXQFn9KWxqg==",
      "engines": {
        "node": ">=16.0.0",
        "npm": ">=7.0.0"
      }
    },
    "node_modules/@discordjs/rest/node_modules/discord-api-types": {
      "version": "0.25.2",
      "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.25.2.tgz",
      "integrity": "sha512-O243LXxb5gLLxubu5zgoppYQuolapGVWPw3ll0acN0+O8TnPUE2kFp9Bt3sTRYodw8xFIknOVxjSeyWYBpVcEQ==",
      "engines": {
        "node": ">=12"
      }
    },
    "node_modules/@sapphire/async-queue": {
      "version": "1.1.9",
      "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.1.9.tgz",
      "integrity": "sha512-CbXaGwwlEMq+l1TRu01FJCvySJ1CEFKFclHT48nIfNeZXaAAmmwwy7scUKmYHPUa3GhoMp6Qr1B3eAJux6XgOQ==",
      "engines": {
        "node": ">=v14.0.0",
        "npm": ">=7.0.0"
      }
    },
    "node_modules/@sapphire/snowflake": {
      "version": "3.0.1",
      "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.0.1.tgz",
      "integrity": "sha512-v+wCC2q9DK3OhG7Vcdt/8A/INAYiyhlMD5snakmXGBN1usLBwSGJVJBjDHv4VGI5C9YYl4UdW5Ovr3arvYsJXQ==",
      "engines": {
        "node": ">=v14.0.0",
        "npm": ">=7.0.0"
      }
    },
    "node_modules/@sindresorhus/is": {
      "version": "4.3.0",
      "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.3.0.tgz",
      "integrity": "sha512-wwOvh0eO3PiTEivGJWiZ+b946SlMSb4pe+y+Ur/4S87cwo09pYi+FWHHnbrM3W9W7cBYKDqQXcrFYjYUCOJUEQ==",
      "engines": {
        "node": ">=10"
      },
      "funding": {
        "url": "https://github.com/sindresorhus/is?sponsor=1"
      }
    },
    "node_modules/@types/node": {
      "version": "16.11.21",
      "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.21.tgz",
      "integrity": "sha512-Pf8M1XD9i1ksZEcCP8vuSNwooJ/bZapNmIzpmsMaL+jMI+8mEYU3PKvs+xDNuQcJWF/x24WzY4qxLtB0zNow9A==",
      "dev": true
      "integrity": "sha512-Pf8M1XD9i1ksZEcCP8vuSNwooJ/bZapNmIzpmsMaL+jMI+8mEYU3PKvs+xDNuQcJWF/x24WzY4qxLtB0zNow9A=="
    },
    "node_modules/@types/node-fetch": {
      "version": "2.5.12",
      "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.12.tgz",
      "integrity": "sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw==",
      "dependencies": {
        "@types/node": "*",
        "form-data": "^3.0.0"
      }
    },
    "node_modules/@types/node-fetch/node_modules/form-data": {
      "version": "3.0.1",
      "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz",
      "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==",
      "dependencies": {
        "asynckit": "^0.4.0",
        "combined-stream": "^1.0.8",
        "mime-types": "^2.1.12"
      },
      "engines": {
        "node": ">= 6"
      }
    },
    "node_modules/@types/ws": {
      "version": "8.2.2",
      "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.2.tgz",
      "integrity": "sha512-NOn5eIcgWLOo6qW8AcuLZ7G8PycXu0xTxxkS6Q18VWFxgPUSOwV0pBj2a/4viNZVu25i7RIB7GttdkAIUUXOOg==",
      "dependencies": {
        "@types/node": "*"
      }
    },
    "node_modules/asynckit": {
      "version": "0.4.0",
      "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
      "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
    },
    "node_modules/axios": {
      "version": "0.21.4",


@@ 71,6 197,17 @@
        "url": "https://github.com/sponsors/fb55"
      }
    },
    "node_modules/combined-stream": {
      "version": "1.0.8",
      "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
      "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
      "dependencies": {
        "delayed-stream": "~1.0.0"
      },
      "engines": {
        "node": ">= 0.8"
      }
    },
    "node_modules/css-select": {
      "version": "4.2.1",
      "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.2.1.tgz",


@@ 97,6 234,47 @@
        "url": "https://github.com/sponsors/fb55"
      }
    },
    "node_modules/dayjs": {
      "version": "1.10.7",
      "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.10.7.tgz",
      "integrity": "sha512-P6twpd70BcPK34K26uJ1KT3wlhpuOAPoMwJzpsIWUxHZ7wpmbdZL/hQqBDfz7hGurYSa5PhzdhDHtt319hL3ig=="
    },
    "node_modules/delayed-stream": {
      "version": "1.0.0",
      "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
      "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk=",
      "engines": {
        "node": ">=0.4.0"
      }
    },
    "node_modules/discord-api-types": {
      "version": "0.26.1",
      "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.26.1.tgz",
      "integrity": "sha512-T5PdMQ+Y1MEECYMV5wmyi9VEYPagEDEi4S0amgsszpWY0VB9JJ/hEvM6BgLhbdnKky4gfmZEXtEEtojN8ZKJQQ==",
      "engines": {
        "node": ">=12"
      }
    },
    "node_modules/discord.js": {
      "version": "13.6.0",
      "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.6.0.tgz",
      "integrity": "sha512-tXNR8zgsEPxPBvGk3AQjJ9ljIIC6/LOPjzKwpwz8Y1Q2X66Vi3ZqFgRHYwnHKC0jC0F+l4LzxlhmOJsBZDNg9g==",
      "dependencies": {
        "@discordjs/builders": "^0.11.0",
        "@discordjs/collection": "^0.4.0",
        "@sapphire/async-queue": "^1.1.9",
        "@types/node-fetch": "^2.5.12",
        "@types/ws": "^8.2.2",
        "discord-api-types": "^0.26.0",
        "form-data": "^4.0.0",
        "node-fetch": "^2.6.1",
        "ws": "^8.4.0"
      },
      "engines": {
        "node": ">=16.6.0",
        "npm": ">=7.0.0"
      }
    },
    "node_modules/dom-serializer": {
      "version": "1.3.2",
      "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz",


@@ 175,6 353,19 @@
        }
      }
    },
    "node_modules/form-data": {
      "version": "4.0.0",
      "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
      "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
      "dependencies": {
        "asynckit": "^0.4.0",
        "combined-stream": "^1.0.8",
        "mime-types": "^2.1.12"
      },
      "engines": {
        "node": ">= 6"
      }
    },
    "node_modules/htmlparser2": {
      "version": "6.1.0",
      "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz",


@@ 193,6 384,44 @@
        "entities": "^2.0.0"
      }
    },
    "node_modules/mime-db": {
      "version": "1.51.0",
      "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz",
      "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g==",
      "engines": {
        "node": ">= 0.6"
      }
    },
    "node_modules/mime-types": {
      "version": "2.1.34",
      "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz",
      "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==",
      "dependencies": {
        "mime-db": "1.51.0"
      },
      "engines": {
        "node": ">= 0.6"
      }
    },
    "node_modules/node-fetch": {
      "version": "2.6.7",
      "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
      "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
      "dependencies": {
        "whatwg-url": "^5.0.0"
      },
      "engines": {
        "node": "4.x || >=6.0.0"
      },
      "peerDependencies": {
        "encoding": "^0.1.0"
      },
      "peerDependenciesMeta": {
        "encoding": {
          "optional": true
        }
      }
    },
    "node_modules/nth-check": {
      "version": "2.0.1",
      "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.1.tgz",


@@ 217,6 446,16 @@
        "parse5": "^6.0.1"
      }
    },
    "node_modules/tr46": {
      "version": "0.0.3",
      "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
      "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
    },
    "node_modules/ts-mixer": {
      "version": "6.0.0",
      "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.0.tgz",
      "integrity": "sha512-nXIb1fvdY5CBSrDIblLn73NW0qRDk5yJ0Sk1qPBF560OdJfQp9jhl+0tzcY09OZ9U+6GpeoI9RjwoIKFIoB9MQ=="
    },
    "node_modules/tslib": {
      "version": "2.3.1",
      "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",


@@ 233,14 472,147 @@
      "engines": {
        "node": ">=4.2.0"
      }
    },
    "node_modules/webidl-conversions": {
      "version": "3.0.1",
      "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
      "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
    },
    "node_modules/whatwg-url": {
      "version": "5.0.0",
      "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
      "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
      "dependencies": {
        "tr46": "~0.0.3",
        "webidl-conversions": "^3.0.0"
      }
    },
    "node_modules/ws": {
      "version": "8.4.2",
      "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.2.tgz",
      "integrity": "sha512-Kbk4Nxyq7/ZWqr/tarI9yIt/+iNNFOjBXEWgTb4ydaNHBNGgvf2QHbS9fdfsndfjFlFwEd4Al+mw83YkaD10ZA==",
      "engines": {
        "node": ">=10.0.0"
      },
      "peerDependencies": {
        "bufferutil": "^4.0.1",
        "utf-8-validate": "^5.0.2"
      },
      "peerDependenciesMeta": {
        "bufferutil": {
          "optional": true
        },
        "utf-8-validate": {
          "optional": true
        }
      }
    },
    "node_modules/zod": {
      "version": "3.11.6",
      "resolved": "https://registry.npmjs.org/zod/-/zod-3.11.6.tgz",
      "integrity": "sha512-daZ80A81I3/9lIydI44motWe6n59kRBfNzTuS2bfzVh1nAXi667TOTWWtatxyG+fwgNUiagSj/CWZwRRbevJIg==",
      "funding": {
        "url": "https://github.com/sponsors/colinhacks"
      }
    }
  },
  "dependencies": {
    "@discordjs/builders": {
      "version": "0.11.0",
      "resolved": "https://registry.npmjs.org/@discordjs/builders/-/builders-0.11.0.tgz",
      "integrity": "sha512-ZTB8yJdJKrKlq44dpWkNUrAtEJEq0gqpb7ASdv4vmq6/mZal5kOv312hQ56I/vxwMre+VIkoHquNUAfnTbiYtg==",
      "requires": {
        "@sindresorhus/is": "^4.2.0",
        "discord-api-types": "^0.26.0",
        "ts-mixer": "^6.0.0",
        "tslib": "^2.3.1",
        "zod": "^3.11.6"
      }
    },
    "@discordjs/collection": {
      "version": "0.4.0",
      "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.4.0.tgz",
      "integrity": "sha512-zmjq+l/rV35kE6zRrwe8BHqV78JvIh2ybJeZavBi5NySjWXqN3hmmAKg7kYMMXSeiWtSsMoZ/+MQi0DiQWy2lw=="
    },
    "@discordjs/rest": {
      "version": "0.2.0-canary.0",
      "resolved": "https://registry.npmjs.org/@discordjs/rest/-/rest-0.2.0-canary.0.tgz",
      "integrity": "sha512-jOxz1aqTEzn9N0qaJcZbHz6FbA0oq+vjpXUKkQzgfMihO6gC+kLlpRnFqG25T/aPYbjaR1UM/lGhrGBB1dutqg==",
      "requires": {
        "@discordjs/collection": "^0.3.2",
        "@sapphire/async-queue": "^1.1.9",
        "@sapphire/snowflake": "^3.0.0",
        "discord-api-types": "^0.25.2",
        "form-data": "^4.0.0",
        "node-fetch": "^2.6.5",
        "tslib": "^2.3.1"
      },
      "dependencies": {
        "@discordjs/collection": {
          "version": "0.3.2",
          "resolved": "https://registry.npmjs.org/@discordjs/collection/-/collection-0.3.2.tgz",
          "integrity": "sha512-dMjLl60b2DMqObbH1MQZKePgWhsNe49XkKBZ0W5Acl5uVV43SN414i2QfZwRI7dXAqIn8pEWD2+XXQFn9KWxqg=="
        },
        "discord-api-types": {
          "version": "0.25.2",
          "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.25.2.tgz",
          "integrity": "sha512-O243LXxb5gLLxubu5zgoppYQuolapGVWPw3ll0acN0+O8TnPUE2kFp9Bt3sTRYodw8xFIknOVxjSeyWYBpVcEQ=="
        }
      }
    },
    "@sapphire/async-queue": {
      "version": "1.1.9",
      "resolved": "https://registry.npmjs.org/@sapphire/async-queue/-/async-queue-1.1.9.tgz",
      "integrity": "sha512-CbXaGwwlEMq+l1TRu01FJCvySJ1CEFKFclHT48nIfNeZXaAAmmwwy7scUKmYHPUa3GhoMp6Qr1B3eAJux6XgOQ=="
    },
    "@sapphire/snowflake": {
      "version": "3.0.1",
      "resolved": "https://registry.npmjs.org/@sapphire/snowflake/-/snowflake-3.0.1.tgz",
      "integrity": "sha512-v+wCC2q9DK3OhG7Vcdt/8A/INAYiyhlMD5snakmXGBN1usLBwSGJVJBjDHv4VGI5C9YYl4UdW5Ovr3arvYsJXQ=="
    },
    "@sindresorhus/is": {
      "version": "4.3.0",
      "resolved": "https://registry.npmjs.org/@sindresorhus/is/-/is-4.3.0.tgz",
      "integrity": "sha512-wwOvh0eO3PiTEivGJWiZ+b946SlMSb4pe+y+Ur/4S87cwo09pYi+FWHHnbrM3W9W7cBYKDqQXcrFYjYUCOJUEQ=="
    },
    "@types/node": {
      "version": "16.11.21",
      "resolved": "https://registry.npmjs.org/@types/node/-/node-16.11.21.tgz",
      "integrity": "sha512-Pf8M1XD9i1ksZEcCP8vuSNwooJ/bZapNmIzpmsMaL+jMI+8mEYU3PKvs+xDNuQcJWF/x24WzY4qxLtB0zNow9A==",
      "dev": true
      "integrity": "sha512-Pf8M1XD9i1ksZEcCP8vuSNwooJ/bZapNmIzpmsMaL+jMI+8mEYU3PKvs+xDNuQcJWF/x24WzY4qxLtB0zNow9A=="
    },
    "@types/node-fetch": {
      "version": "2.5.12",
      "resolved": "https://registry.npmjs.org/@types/node-fetch/-/node-fetch-2.5.12.tgz",
      "integrity": "sha512-MKgC4dlq4kKNa/mYrwpKfzQMB5X3ee5U6fSprkKpToBqBmX4nFZL9cW5jl6sWn+xpRJ7ypWh2yyqqr8UUCstSw==",
      "requires": {
        "@types/node": "*",
        "form-data": "^3.0.0"
      },
      "dependencies": {
        "form-data": {
          "version": "3.0.1",
          "resolved": "https://registry.npmjs.org/form-data/-/form-data-3.0.1.tgz",
          "integrity": "sha512-RHkBKtLWUVwd7SqRIvCZMEvAMoGUp0XU+seQiZejj0COz3RI3hWP4sCv3gZWWLjJTd7rGwcsF5eKZGii0r/hbg==",
          "requires": {
            "asynckit": "^0.4.0",
            "combined-stream": "^1.0.8",
            "mime-types": "^2.1.12"
          }
        }
      }
    },
    "@types/ws": {
      "version": "8.2.2",
      "resolved": "https://registry.npmjs.org/@types/ws/-/ws-8.2.2.tgz",
      "integrity": "sha512-NOn5eIcgWLOo6qW8AcuLZ7G8PycXu0xTxxkS6Q18VWFxgPUSOwV0pBj2a/4viNZVu25i7RIB7GttdkAIUUXOOg==",
      "requires": {
        "@types/node": "*"
      }
    },
    "asynckit": {
      "version": "0.4.0",
      "resolved": "https://registry.npmjs.org/asynckit/-/asynckit-0.4.0.tgz",
      "integrity": "sha1-x57Zf380y48robyXkLzDZkdLS3k="
    },
    "axios": {
      "version": "0.21.4",


@@ 281,6 653,14 @@
        "domutils": "^2.7.0"
      }
    },
    "combined-stream": {
      "version": "1.0.8",
      "resolved": "https://registry.npmjs.org/combined-stream/-/combined-stream-1.0.8.tgz",
      "integrity": "sha512-FQN4MRfuJeHf7cBbBMJFXhKSDq+2kAArBlmRBvcvFE5BB1HZKXtSFASDhdlz9zOYwxh8lDdnvmMOe/+5cdoEdg==",
      "requires": {
        "delayed-stream": "~1.0.0"
      }
    },
    "css-select": {
      "version": "4.2.1",
      "resolved": "https://registry.npmjs.org/css-select/-/css-select-4.2.1.tgz",


@@ 298,6 678,37 @@
      "resolved": "https://registry.npmjs.org/css-what/-/css-what-5.1.0.tgz",
      "integrity": "sha512-arSMRWIIFY0hV8pIxZMEfmMI47Wj3R/aWpZDDxWYCPEiOMv6tfOrnpDtgxBYPEQD4V0Y/958+1TdC3iWTFcUPw=="
    },
    "dayjs": {
      "version": "1.10.7",
      "resolved": "https://registry.npmjs.org/dayjs/-/dayjs-1.10.7.tgz",
      "integrity": "sha512-P6twpd70BcPK34K26uJ1KT3wlhpuOAPoMwJzpsIWUxHZ7wpmbdZL/hQqBDfz7hGurYSa5PhzdhDHtt319hL3ig=="
    },
    "delayed-stream": {
      "version": "1.0.0",
      "resolved": "https://registry.npmjs.org/delayed-stream/-/delayed-stream-1.0.0.tgz",
      "integrity": "sha1-3zrhmayt+31ECqrgsp4icrJOxhk="
    },
    "discord-api-types": {
      "version": "0.26.1",
      "resolved": "https://registry.npmjs.org/discord-api-types/-/discord-api-types-0.26.1.tgz",
      "integrity": "sha512-T5PdMQ+Y1MEECYMV5wmyi9VEYPagEDEi4S0amgsszpWY0VB9JJ/hEvM6BgLhbdnKky4gfmZEXtEEtojN8ZKJQQ=="
    },
    "discord.js": {
      "version": "13.6.0",
      "resolved": "https://registry.npmjs.org/discord.js/-/discord.js-13.6.0.tgz",
      "integrity": "sha512-tXNR8zgsEPxPBvGk3AQjJ9ljIIC6/LOPjzKwpwz8Y1Q2X66Vi3ZqFgRHYwnHKC0jC0F+l4LzxlhmOJsBZDNg9g==",
      "requires": {
        "@discordjs/builders": "^0.11.0",
        "@discordjs/collection": "^0.4.0",
        "@sapphire/async-queue": "^1.1.9",
        "@types/node-fetch": "^2.5.12",
        "@types/ws": "^8.2.2",
        "discord-api-types": "^0.26.0",
        "form-data": "^4.0.0",
        "node-fetch": "^2.6.1",
        "ws": "^8.4.0"
      }
    },
    "dom-serializer": {
      "version": "1.3.2",
      "resolved": "https://registry.npmjs.org/dom-serializer/-/dom-serializer-1.3.2.tgz",


@@ 341,6 752,16 @@
      "resolved": "https://registry.npmjs.org/follow-redirects/-/follow-redirects-1.14.7.tgz",
      "integrity": "sha512-+hbxoLbFMbRKDwohX8GkTataGqO6Jb7jGwpAlwgy2bIz25XtRm7KEzJM76R1WiNT5SwZkX4Y75SwBolkpmE7iQ=="
    },
    "form-data": {
      "version": "4.0.0",
      "resolved": "https://registry.npmjs.org/form-data/-/form-data-4.0.0.tgz",
      "integrity": "sha512-ETEklSGi5t0QMZuiXoA/Q6vcnxcLQP5vdugSpuAyi6SVGi2clPPp+xgEhuMaHC+zGgn31Kd235W35f7Hykkaww==",
      "requires": {
        "asynckit": "^0.4.0",
        "combined-stream": "^1.0.8",
        "mime-types": "^2.1.12"
      }
    },
    "htmlparser2": {
      "version": "6.1.0",
      "resolved": "https://registry.npmjs.org/htmlparser2/-/htmlparser2-6.1.0.tgz",


@@ 352,6 773,27 @@
        "entities": "^2.0.0"
      }
    },
    "mime-db": {
      "version": "1.51.0",
      "resolved": "https://registry.npmjs.org/mime-db/-/mime-db-1.51.0.tgz",
      "integrity": "sha512-5y8A56jg7XVQx2mbv1lu49NR4dokRnhZYTtL+KGfaa27uq4pSTXkwQkFJl4pkRMyNFz/EtYDSkiiEHx3F7UN6g=="
    },
    "mime-types": {
      "version": "2.1.34",
      "resolved": "https://registry.npmjs.org/mime-types/-/mime-types-2.1.34.tgz",
      "integrity": "sha512-6cP692WwGIs9XXdOO4++N+7qjqv0rqxxVvJ3VHPh/Sc9mVZcQP+ZGhkKiTvWMQRr2tbHkJP/Yn7Y0npb3ZBs4A==",
      "requires": {
        "mime-db": "1.51.0"
      }
    },
    "node-fetch": {
      "version": "2.6.7",
      "resolved": "https://registry.npmjs.org/node-fetch/-/node-fetch-2.6.7.tgz",
      "integrity": "sha512-ZjMPFEfVx5j+y2yF35Kzx5sF7kDzxuDj6ziH4FFbOp87zKDZNx8yExJIb05OGF4Nlt9IHFIMBkRl41VdvcNdbQ==",
      "requires": {
        "whatwg-url": "^5.0.0"
      }
    },
    "nth-check": {
      "version": "2.0.1",
      "resolved": "https://registry.npmjs.org/nth-check/-/nth-check-2.0.1.tgz",


@@ 373,6 815,16 @@
        "parse5": "^6.0.1"
      }
    },
    "tr46": {
      "version": "0.0.3",
      "resolved": "https://registry.npmjs.org/tr46/-/tr46-0.0.3.tgz",
      "integrity": "sha1-gYT9NH2snNwYWZLzpmIuFLnZq2o="
    },
    "ts-mixer": {
      "version": "6.0.0",
      "resolved": "https://registry.npmjs.org/ts-mixer/-/ts-mixer-6.0.0.tgz",
      "integrity": "sha512-nXIb1fvdY5CBSrDIblLn73NW0qRDk5yJ0Sk1qPBF560OdJfQp9jhl+0tzcY09OZ9U+6GpeoI9RjwoIKFIoB9MQ=="
    },
    "tslib": {
      "version": "2.3.1",
      "resolved": "https://registry.npmjs.org/tslib/-/tslib-2.3.1.tgz",


@@ 382,6 834,31 @@
      "version": "4.5.5",
      "resolved": "https://registry.npmjs.org/typescript/-/typescript-4.5.5.tgz",
      "integrity": "sha512-TCTIul70LyWe6IJWT8QSYeA54WQe8EjQFU4wY52Fasj5UKx88LNYKCgBEHcOMOrFF1rKGbD8v/xcNWVUq9SymA=="
    },
    "webidl-conversions": {
      "version": "3.0.1",
      "resolved": "https://registry.npmjs.org/webidl-conversions/-/webidl-conversions-3.0.1.tgz",
      "integrity": "sha1-JFNCdeKnvGvnvIZhHMFq4KVlSHE="
    },
    "whatwg-url": {
      "version": "5.0.0",
      "resolved": "https://registry.npmjs.org/whatwg-url/-/whatwg-url-5.0.0.tgz",
      "integrity": "sha1-lmRU6HZUYuN2RNNib2dCzotwll0=",
      "requires": {
        "tr46": "~0.0.3",
        "webidl-conversions": "^3.0.0"
      }
    },
    "ws": {
      "version": "8.4.2",
      "resolved": "https://registry.npmjs.org/ws/-/ws-8.4.2.tgz",
      "integrity": "sha512-Kbk4Nxyq7/ZWqr/tarI9yIt/+iNNFOjBXEWgTb4ydaNHBNGgvf2QHbS9fdfsndfjFlFwEd4Al+mw83YkaD10ZA==",
      "requires": {}
    },
    "zod": {
      "version": "3.11.6",
      "resolved": "https://registry.npmjs.org/zod/-/zod-3.11.6.tgz",
      "integrity": "sha512-daZ80A81I3/9lIydI44motWe6n59kRBfNzTuS2bfzVh1nAXi667TOTWWtatxyG+fwgNUiagSj/CWZwRRbevJIg=="
    }
  }
}

M package.json => package.json +4 -0
@@ 12,8 12,12 @@
  "author": "",
  "license": "ISC",
  "dependencies": {
    "@discordjs/rest": "^0.2.0-canary.0",
    "axios": "^0.21.2",
    "cheerio": "^1.0.0-rc.10",
    "dayjs": "^1.10.7",
    "discord-api-types": "^0.26.1",
    "discord.js": "^13.6.0",
    "typescript": "^4.4.2"
  },
  "devDependencies": {

M src/Crawler.ts => src/Crawler.ts +36 -7
@@ 1,20 1,51 @@
import { CheerioAPI } from 'cheerio';
interface Group {
import cheerio, { CheerioAPI } from 'cheerio';
import https from 'https';
import { Snowflake } from 'discord.js';

var groups : Group[] = [];
var crawler : Crawler;
var $ : CheerioAPI;

export interface userInfo {
    id: Snowflake;
    group: Group;
    subGroup: SubGroup;
}

export interface Group {
    name: string;
    id: number;
}

interface SubGroup {
export interface SubGroup {
    name: string;
    id: number;
}

class Crawler{
export class Crawler{
    private DOM: CheerioAPI
    constructor(dom: CheerioAPI){
        this.DOM = dom;
    }

    public static async newCrawler() : Promise<Crawler>{
        return new Promise((resolve, reject) => {
            const req = https.get("https://edt.iut-orsay.fr/edt_invite.php", (res) => {
                let data = "";
                res.on("data", (chunk) => {
                    data += chunk;
                });
                res.on("end", () => {
                    let $ = cheerio.load(data);
                    resolve(new Crawler($));
                });
            });
            req.on("error", (err) => {
                reject(err);
            });
        });
    }

    public getGroups(): Group[] {
        let groups: Group[] = [];
        this.DOM("select[name='selec_groupe'] option").each((i, elem) => {


@@ 56,6 87,4 @@ class Crawler{
    public getImage(group: Group, sub: SubGroup) : string | null{
        return this.DOM("img")[0].attribs.src;
    }
}

export default Crawler;
\ No newline at end of file
}
\ No newline at end of file

A src/commands/edt.ts => src/commands/edt.ts +86 -0
@@ 0,0 1,86 @@
import {Crawler, Group, userInfo, SubGroup} from "../Crawler";
import cheerio, {CheerioAPI} from "cheerio";
import https from "https";
import { CommandInteraction, MessageActionRow, MessageButton, MessageEmbed, MessageSelectMenu, MessageSelectOptionData } from "discord.js";
import { SlashCommandBuilder } from '@discordjs/builders';
import { Command } from '../index';
import fs from 'fs';
import config from '../config.json';
import dayjs from 'dayjs';
import weekOfYear from 'dayjs/plugin/weekOfYear';
dayjs.extend(weekOfYear);

function edtLink(subGroupId?: SubGroup["id"]) : string{
    let now = dayjs()
    let week = now.week()-1;
    let year = now.year();
    if(now.day() === 6){
        if(week === 52){
            week = 0;
            year += 1;
        } else {
            week += 1;
        }
    }
    return "https://edt.iut-orsay.fr/vue_invite_horizontale.php?current_year=" + year + "&current_week=" + week + "&groupes_multi%5B%5D=" + subGroupId + "&lar=1920&hau=1200";
}



let obj : Command = {
	data: new SlashCommandBuilder()
		.setName('edt')
		.setDescription('Trouver ton emploi du temps ou l`emploi du temps de ton groupe.')
		.addIntegerOption(option => option.setName('id-etudiant').setDescription('l`identifiant de l`étudiant')),
	async execute(interaction : CommandInteraction) {
        if(config.userList.filter((user : userInfo) => user.id === interaction.user.id).length === 0){
            config.userList.forEach((user : userInfo) => {
                if(user.id === interaction.user.id){
                   return interaction.reply(edtLink(user.subGroup.id));
                }
            });
        }

        let crawler = await Crawler.newCrawler();
        let groups : Group[] = crawler.getGroups();

        if(groups.length > 0){

            const row = new MessageActionRow();
            let options : MessageSelectOptionData[] = [];
            let options2 : MessageSelectOptionData[] = [];
            groups.forEach(group => {
                if(options.length < 25){
                    options.push({
                        label: "Groupe " + group.name,
                        value: String(group.id)
                    });
                } else {
                    options2.push({
                        label: "Groupe " + group.name,
                        value: String(group.id)
                    })
                }
            });

            const embed = new MessageEmbed()
            .setColor('#0099ff')
            .setTitle('Esmeralde')
            .setDescription('Je suis le bot EDT de l`IUT.\nPour commencer, tu dois selectionner ton groupe.\nPour cela, clique sur le bouton correspondant.');

            row.addComponents(new MessageSelectMenu().setCustomId("select").setPlaceholder("Pas de groupe selectionné").addOptions(options).setMinValues(1).setMaxValues(1));

            if(options2.length > 0){
                const row2 = new MessageActionRow();
                row2.addComponents(new MessageSelectMenu().setCustomId("select2").setPlaceholder("Pas de groupe selectionné").addOptions(options2));
                return interaction.reply({ content: 'Saluuuut uwu', ephemeral: true, embeds: [embed], components: [row, row2] });
            }
            
            return interaction.reply({ content: 'Saluuuut uwu', ephemeral: true, embeds: [embed], components: [row] });
        } else {
            return interaction.reply('Ouin, il y a un problème ! Contacte Denise !');
        }
	},
};

module.exports = obj;
\ No newline at end of file

D src/index.js => src/index.js +0 -34
@@ 1,34 0,0 @@
import Crawler from "./Crawler";
import cheerio from "cheerio";
import https from "https";

https.get("https://edt.iut-orsay.fr/edt_invite.php", (res) => {
    let data = "";
    res.on("data", (chunk) => {
        data += chunk;
    });
    res.on("end", () => {
        const $ = cheerio.load(data);
        const crawler = new Crawler($);
        let myGroups = crawler.getGroups();
        for(let group of myGroups){
            https.get(crawler.updateDOMUrl(group), (res2) => {
                let data2 = "";
                res2.on("data", (chunk) => {
                    data2 += chunk;
                });
                res2.on("end", () => {
                    const $2 = cheerio.load(data2);
                    crawler.updateDOM($2);
                    console.log("\n");
                    console.log("Groupe : " + group.name);
                    console.log("\n");
                    let subGroups = crawler.getSubGroups(group);
                    for(let subGroup of subGroups){
                        console.log(subGroup.name);
                    }
                });
            });
        }
    });
})
\ No newline at end of file

A src/index.ts => src/index.ts +86 -0
@@ 0,0 1,86 @@
//node
import fs from 'fs';
import path from 'path';

//config
import config from './config.json';

//discord
import * as Discord from 'discord.js';
import { SlashCommandBuilder } from '@discordjs/builders';
import { REST } from '@discordjs/rest';
import { Routes } from 'discord-api-types/v9';
const wait = require('util').promisify(setTimeout);

export interface Command {
	data: Omit<SlashCommandBuilder, "addSubcommand" | "addSubcommandGroup">,
	execute(interaction : Discord.CommandInteraction) : Promise<void>;
}

class ClientMod extends Discord.Client{
	public constructor(options: Discord.ClientOptions, comm: Discord.Collection<string, Command>){
		super(options);
		this.commands = comm;
	}
	public commands: Discord.Collection<string, Command>;
}

const rest = new REST({ version: '9' }).setToken(config.token);

const client = new ClientMod({ intents: [Discord.Intents.FLAGS.GUILDS] }, new Discord.Collection());

//import commands

const commands = [];
client.commands = new Discord.Collection();
const commandFiles = fs.readdirSync(path.join(__dirname,'./commands')).filter(file => file.endsWith('.js'));

for (const file of commandFiles) {
	const command = require(`./commands/${file}`);
	console.log(command);
	commands.push(command.data.toJSON());
	client.commands.set(command.data.name, command);
}

(async () => {
	try {
		for(var element of config.GUILDID){
			await rest.put(
				Routes.applicationGuildCommands(config.CLIENTID, element),
				{ body: commands },
			);

			console.log('Registered for guild ' + element);
		}

		console.log('Successfully registered application commands.');
	} catch (error) {
		console.error(error);
	}
})();

client.once('ready', () => {
	console.log('Ready!');
});

client.on('interactionCreate', async interaction => {
	if (interaction.isSelectMenu()){
		if (interaction.customId === 'select' || interaction.customId === 'select2') {
			console.log(interaction.values[0]);
			await interaction.update({content: "test", embeds: [], components: []});
		}
    } else if(interaction.isCommand()){
        const command = client.commands.get(interaction.commandName);

        if (!command) return;
    
        try {
            await command.execute(interaction);
        } catch (error) {
            console.error(error);
            return interaction.reply({ content: 'Kyaaaa !!! J`ai eu un petit souci, désowée >.<', ephemeral: true });
        }
    }
});

client.login(config.token);
\ No newline at end of file