diff --git a/.nvmrc b/.nvmrc index d9216d9a..a7ac3d0d 100644 --- a/.nvmrc +++ b/.nvmrc @@ -1 +1 @@ -16.6.1 +21.7.3 diff --git a/package.json b/package.json index e648673b..44308334 100644 --- a/package.json +++ b/package.json @@ -26,7 +26,6 @@ "@discordjs/rest": "2.4.0", "@prisma/client": "5.20.0", "@sentry/node": "8.33.1", - "axios": "1.7.7", "countries-and-timezones": "3.7.0", "country-code-emoji": "2.3.0", "date-fns": "4.1.0", diff --git a/src/common/tools.ts b/src/common/tools.ts index 617af9c1..85abc22e 100644 --- a/src/common/tools.ts +++ b/src/common/tools.ts @@ -1,4 +1,3 @@ -import axios from "axios"; import { Channel, Collection, @@ -158,8 +157,8 @@ class Tools { const apiKey = process.env.GOOGLE_API_KEY; const url = `https://sheets.googleapis.com/v4/spreadsheets/${sheetId}/values/Sheet1?key=${apiKey}`; - const response = await axios.get(url); - const data = await response.data; + const response = await fetch(url); + const data = await response.json(); const rows = data.values; return rows.flatMap((row: string[]) => row); diff --git a/src/event-distribution/events/slash-commands/add-options.ts b/src/event-distribution/events/slash-commands/add-options.ts index f55d0da4..9c15bb18 100644 --- a/src/event-distribution/events/slash-commands/add-options.ts +++ b/src/event-distribution/events/slash-commands/add-options.ts @@ -1,10 +1,10 @@ import { + ApplicationCommandOptionAllowedChannelTypes, SlashCommandBuilder, SlashCommandIntegerOption, SlashCommandNumberOption, SlashCommandStringOption, SlashCommandSubcommandBuilder, - ApplicationCommandOptionAllowedChannelTypes, } from "@discordjs/builders"; import { APIApplicationCommandBasicOption, @@ -141,6 +141,9 @@ const addOption = ( return addMinMax(withChoices, option); }); break; + case ApplicationCommandOptionType.Attachment: + builder.addAttachmentOption(addDefaults); + break; } return builder; diff --git a/src/programs/daily-challenge.ts b/src/programs/daily-challenge.ts index def096c9..72bbf3b9 100644 --- a/src/programs/daily-challenge.ts +++ b/src/programs/daily-challenge.ts @@ -1,5 +1,4 @@ import { Timer } from "@prisma/client"; -import Axios from "axios"; import { ApplicationCommandOptionType, ChatInputCommandInteraction, @@ -140,8 +139,8 @@ class SaveToDB implements CommandHandler { const challenges = interaction.options.getAttachment("challenges")!; try { - const file = await Axios.get(challenges.url); - const bulkChallenges: string[] = file.data.split("\n"); + const file = await fetch(challenges.url).then((res) => res.text()); + const bulkChallenges: string[] = file.split("\n"); const bulkInsert = bulkChallenges.map((challenge) => ({ result: challenge.trim(), })); diff --git a/yarn.lock b/yarn.lock index 94ade92b..faa8263f 100644 --- a/yarn.lock +++ b/yarn.lock @@ -3376,13 +3376,6 @@ __metadata: languageName: node linkType: hard -"asynckit@npm:^0.4.0": - version: 0.4.0 - resolution: "asynckit@npm:0.4.0" - checksum: 10c0/d73e2ddf20c4eb9337e1b3df1a0f6159481050a5de457c55b14ea2e5cb6d90bb69e004c9af54737a5ee0917fcf2c9e25de67777bbe58261847846066ba75bc9d - languageName: node - linkType: hard - "auto-bind@npm:^4.0.0, auto-bind@npm:~4.0.0": version: 4.0.0 resolution: "auto-bind@npm:4.0.0" @@ -3390,17 +3383,6 @@ __metadata: languageName: node linkType: hard -"axios@npm:1.7.7": - version: 1.7.7 - resolution: "axios@npm:1.7.7" - dependencies: - follow-redirects: "npm:^1.15.6" - form-data: "npm:^4.0.0" - proxy-from-env: "npm:^1.1.0" - checksum: 10c0/4499efc89e86b0b49ffddc018798de05fab26e3bf57913818266be73279a6418c3ce8f9e934c7d2d707ab8c095e837fc6c90608fb7715b94d357720b5f568af7 - languageName: node - linkType: hard - "babel-plugin-syntax-trailing-function-commas@npm:^7.0.0-beta.0": version: 7.0.0-beta.0 resolution: "babel-plugin-syntax-trailing-function-commas@npm:7.0.0-beta.0" @@ -3882,15 +3864,6 @@ __metadata: languageName: node linkType: hard -"combined-stream@npm:^1.0.8": - version: 1.0.8 - resolution: "combined-stream@npm:1.0.8" - dependencies: - delayed-stream: "npm:~1.0.0" - checksum: 10c0/0dbb829577e1b1e839fa82b40c07ffaf7de8a09b935cadd355a73652ae70a88b4320db322f6634a4ad93424292fa80973ac6480986247f1734a1137debf271d5 - languageName: node - linkType: hard - "commander@npm:^4.0.0": version: 4.1.1 resolution: "commander@npm:4.1.1" @@ -4072,13 +4045,6 @@ __metadata: languageName: node linkType: hard -"delayed-stream@npm:~1.0.0": - version: 1.0.0 - resolution: "delayed-stream@npm:1.0.0" - checksum: 10c0/d758899da03392e6712f042bec80aa293bbe9e9ff1b2634baae6a360113e708b91326594c8a486d475c69d6259afb7efacdc3537bfcda1c6c648e390ce601b19 - languageName: node - linkType: hard - "dependency-graph@npm:^0.11.0": version: 0.11.0 resolution: "dependency-graph@npm:0.11.0" @@ -4600,16 +4566,6 @@ __metadata: languageName: node linkType: hard -"follow-redirects@npm:^1.15.6": - version: 1.15.9 - resolution: "follow-redirects@npm:1.15.9" - peerDependenciesMeta: - debug: - optional: true - checksum: 10c0/5829165bd112c3c0e82be6c15b1a58fa9dcfaede3b3c54697a82fe4a62dd5ae5e8222956b448d2f98e331525f05d00404aba7d696de9e761ef6e42fdc780244f - languageName: node - linkType: hard - "foreground-child@npm:^3.1.0": version: 3.3.0 resolution: "foreground-child@npm:3.3.0" @@ -4620,17 +4576,6 @@ __metadata: languageName: node linkType: hard -"form-data@npm:^4.0.0": - version: 4.0.0 - resolution: "form-data@npm:4.0.0" - dependencies: - asynckit: "npm:^0.4.0" - combined-stream: "npm:^1.0.8" - mime-types: "npm:^2.1.12" - checksum: 10c0/cb6f3ac49180be03ff07ba3ff125f9eba2ff0b277fb33c7fc47569fc5e616882c5b1c69b9904c4c4187e97dd0419dd03b134174756f296dec62041e6527e2c6e - languageName: node - linkType: hard - "fs-minipass@npm:^2.0.0": version: 2.1.0 resolution: "fs-minipass@npm:2.1.0" @@ -5563,22 +5508,6 @@ __metadata: languageName: node linkType: hard -"mime-db@npm:1.52.0": - version: 1.52.0 - resolution: "mime-db@npm:1.52.0" - checksum: 10c0/0557a01deebf45ac5f5777fe7740b2a5c309c6d62d40ceab4e23da9f821899ce7a900b7ac8157d4548ddbb7beffe9abc621250e6d182b0397ec7f10c7b91a5aa - languageName: node - linkType: hard - -"mime-types@npm:^2.1.12": - version: 2.1.35 - resolution: "mime-types@npm:2.1.35" - dependencies: - mime-db: "npm:1.52.0" - checksum: 10c0/82fb07ec56d8ff1fc999a84f2f217aa46cb6ed1033fefaabd5785b9a974ed225c90dc72fff460259e66b95b73648596dbcc50d51ed69cdf464af2d237d3149b2 - languageName: node - linkType: hard - "mimic-fn@npm:^2.1.0": version: 2.1.0 resolution: "mimic-fn@npm:2.1.0" @@ -6297,13 +6226,6 @@ __metadata: languageName: node linkType: hard -"proxy-from-env@npm:^1.1.0": - version: 1.1.0 - resolution: "proxy-from-env@npm:1.1.0" - checksum: 10c0/fe7dd8b1bdbbbea18d1459107729c3e4a2243ca870d26d34c2c1bcd3e4425b7bcc5112362df2d93cc7fb9746f6142b5e272fd1cc5c86ddf8580175186f6ad42b - languageName: node - linkType: hard - "punycode@npm:^1.3.2": version: 1.4.1 resolution: "punycode@npm:1.4.1" @@ -7135,7 +7057,6 @@ __metadata: "@types/node-cron": "npm:3.0.11" "@types/ws": "npm:8.5.12" "@yestheoryfam/prettier-config": "npm:1.0.0" - axios: "npm:1.7.7" countries-and-timezones: "npm:3.7.0" country-code-emoji: "npm:2.3.0" date-fns: "npm:4.1.0"