Skip to content

Commit

Permalink
update packages
Browse files Browse the repository at this point in the history
  • Loading branch information
AkatGabrielGoncalves committed Oct 26, 2024
1 parent 3917056 commit 8a788d0
Show file tree
Hide file tree
Showing 4 changed files with 86 additions and 37 deletions.
11 changes: 5 additions & 6 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
"main": "index.js",
"license": "MIT",
"engines": {
"node": "16.x"
"node": "18.x"
},
"scripts": {
"local": "ts-node-dev -T src/index.ts ",
Expand All @@ -17,6 +17,8 @@
"@discordjs/opus": "^0.8",
"@discordjs/rest": "^0.1.0-canary.0",
"@discordjs/voice": "^0.16",
"@distube/ytdl-core": "^4.14.4",
"@distube/ytsr": "^2.0.4",
"axios": "^0.21.4",
"discord.js": "^14",
"dotenv": "^10.0.0",
Expand All @@ -27,16 +29,14 @@
"pg": "^8.7.1",
"sequelize": "^6.6.5",
"source-map-support": "^0.5.21",
"ytdl-core": "^4.9.1",
"ytpl": "^2.2.3",
"ytsr": "TimeForANinja/node-ytsr#207/head"
"ytpl": "^2.2.3"
},
"devDependencies": {
"@types/jsdom": "^21.1.1",
"@types/source-map-support": "^0.5.6",
"@typescript-eslint/eslint-plugin": "^4.29.0",
"@typescript-eslint/parser": "^4.29.0",
"discord-api-types": "^0.22.0",
"discord-api-types": "^0.37.93",
"eslint": "^7.32.0",
"eslint-config-airbnb-typescript": "^12.3.1",
"eslint-config-prettier": "^8.3.0",
Expand All @@ -49,4 +49,3 @@
"typescript": "^5"
}
}

2 changes: 1 addition & 1 deletion src/modules/music/PlayerQueue.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ import {
ComponentType,
Message,
} from 'discord.js';
import ytdl from 'ytdl-core';
import ytdl from '@distube/ytdl-core';
import ytpl from 'ytpl';
import { basicReply } from '../../utils/basicReply';
import { createQueueButton, createQueueEmbed } from './embeds/createQueueEmbed';
Expand Down
16 changes: 8 additions & 8 deletions src/modules/music/YoutubeTracks.ts
Original file line number Diff line number Diff line change
@@ -1,8 +1,7 @@
import ytdl from 'ytdl-core';
import ytdl from '@distube/ytdl-core';
import ytpl from 'ytpl';
import ytsr from 'ytsr';
import ytsr from '@distube/ytsr';
import { QueueItem } from './interfaces/QueueItem';
import { YouTubeResultItem } from './interfaces/YoutubeResultItem';
import Logger from '../../logger/Logger';

class YoutubeTracks {
Expand All @@ -28,11 +27,11 @@ class YoutubeTracks {
thumbnail: song.videoDetails.thumbnails[0].url,
}),
// ytsr format
ytSearch: (song: YouTubeResultItem): QueueItem => ({
ytSearch: (song: ytsr.Video): QueueItem => ({
url: song.url,
title: song.title,
title: song.name,
duration: song.duration,
thumbnail: song.bestThumbnail.url,
thumbnail: song.thumbnails[0].url!,
}),
};

Expand Down Expand Up @@ -66,13 +65,14 @@ class YoutubeTracks {

while (retryCount < maxRetries) {
try {
// eslint-disable-next-line no-await-in-loop
const { items } = await ytsr(search, this.searchOptions);
const track = items.find((item) => item.type === 'video') as YouTubeResultItem;
const track = items.find((item) => item.type === 'video')!;

return {
track: this.songObject.ytSearch(track),
url: track.url,
title: track.title,
title: track.name,
};
} catch (error) {
Logger.error(`Attempt ${retryCount + 1} failed. Retrying...`);
Expand Down
94 changes: 72 additions & 22 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,25 @@
tslib "^2.6.1"
ws "^8.13.0"

"@distube/ytdl-core@^4.14.4":
version "4.14.4"
resolved "https://registry.yarnpkg.com/@distube/ytdl-core/-/ytdl-core-4.14.4.tgz#6ecb7e70f6eea691a562ccb7920d5d334b383d0f"
integrity sha512-dHb4GW3qATIjRsS6VIhm3Pop7FdUcDFhsnyQlsPeXW7UhTPuNS0BmraKiTpFbpp0Ky+rxBQjJBfPRFsM+dT1fg==
dependencies:
http-cookie-agent "^6.0.5"
m3u8stream "^0.8.6"
miniget "^4.2.3"
sax "^1.4.1"
tough-cookie "^4.1.4"
undici five

"@distube/ytsr@^2.0.4":
version "2.0.4"
resolved "https://registry.yarnpkg.com/@distube/ytsr/-/ytsr-2.0.4.tgz#873b7ca767b5ff362bc0e136ae0d9ca5cbde8f7b"
integrity sha512-OiSWgARQ9LTj+dXt3jmMFzUH4l86VVCD4dVC4hEHNXdqp+DyU4QEzc+W6YY6//kWkvzTaUxOo7JUY7lBzwIF0A==
dependencies:
undici "^6.18.2"

"@eslint/eslintrc@^0.4.3":
version "0.4.3"
resolved "https://registry.yarnpkg.com/@eslint/eslintrc/-/eslintrc-0.4.3.tgz#9e42981ef035beb3dd49add17acb96e8ff6f394c"
Expand All @@ -163,6 +182,11 @@
minimatch "^3.0.4"
strip-json-comments "^3.1.1"

"@fastify/busboy@^2.0.0":
version "2.1.1"
resolved "https://registry.yarnpkg.com/@fastify/busboy/-/busboy-2.1.1.tgz#b9da6a878a371829a0502c9b6c1c143ef6663f4d"
integrity sha512-vBZP4NlzfOlerQTnba4aqZoMhE/a9HY7HRqoOPaETQcSQuWEIyZMHGfVu6w9wGtGK5fED5qRs2DteVCjOH60sA==

"@humanwhocodes/config-array@^0.5.0":
version "0.5.0"
resolved "https://registry.yarnpkg.com/@humanwhocodes/config-array/-/config-array-0.5.0.tgz#1407967d4c6eecd7388f83acf1eaf4d0c6e58ef9"
Expand Down Expand Up @@ -458,6 +482,13 @@ agent-base@6:
dependencies:
debug "4"

agent-base@^7.1.1:
version "7.1.1"
resolved "https://registry.yarnpkg.com/agent-base/-/agent-base-7.1.1.tgz#bdbded7dfb096b751a2a087eeeb9664725b2e317"
integrity sha512-H0TSyFNDMomMNJQBn8wFV5YC/2eJ+VXECwOadZJT554xP6cODZHPX3H9QMQECxvrgiSOP1pHjy1sMWQVYJOUOA==
dependencies:
debug "^4.3.4"

ajv@^6.10.0, ajv@^6.12.4:
version "6.12.6"
resolved "https://registry.yarnpkg.com/ajv/-/ajv-6.12.6.tgz#baf5a62e802b07d977034586f8c3baf5adf26df4"
Expand Down Expand Up @@ -929,16 +960,16 @@ discord-api-types@^0.18.1:
resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.18.1.tgz#5d08ed1263236be9c21a22065d0e6b51f790f492"
integrity sha512-hNC38R9ZF4uaujaZQtQfm5CdQO58uhdkoHQAVvMfIL0LgOSZeW575W8H6upngQOuoxWd8tiRII3LLJm9zuQKYg==

discord-api-types@^0.22.0:
version "0.22.0"
resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.22.0.tgz#34dc57fe8e016e5eaac5e393646cd42a7e1ccc2a"
integrity sha512-l8yD/2zRbZItUQpy7ZxBJwaLX/Bs2TGaCthRppk8Sw24LOIWg12t9JEreezPoYD0SQcC2htNNo27kYEpYW/Srg==

discord-api-types@^0.37.37, discord-api-types@^0.37.41, discord-api-types@^0.37.50:
version "0.37.51"
resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.37.51.tgz#a9fe2ceddde1c9c2e4d29987d45241cd746b9319"
integrity sha512-tdmdH98t3zgjQF6zwOHl0OB/PCBiE4aVsNTuN7m0PfU2jOLx3lNoU6xTeFALntUtlIxN80GTr9RPQR4t7msjSg==

discord-api-types@^0.37.93:
version "0.37.93"
resolved "https://registry.yarnpkg.com/discord-api-types/-/discord-api-types-0.37.93.tgz#fd2d34738ec2984cc5f904fe245dccf1cc35ffcd"
integrity sha512-M5jn0x3bcXk8EI2c6F6V6LeOWq10B/cJf+YJSyqNmg7z4bdXK+Z7g9zGJwHS0h9Bfgs0nun2LQISFOzwck7G9A==

discord.js@^14:
version "14.12.1"
resolved "https://registry.yarnpkg.com/discord.js/-/discord.js-14.12.1.tgz#f3073d6fedaaf4948209311165c574dffa417df4"
Expand Down Expand Up @@ -1684,6 +1715,13 @@ html-encoding-sniffer@^3.0.0:
dependencies:
whatwg-encoding "^2.0.0"

http-cookie-agent@^6.0.5:
version "6.0.5"
resolved "https://registry.yarnpkg.com/http-cookie-agent/-/http-cookie-agent-6.0.5.tgz#23b490439464424a689d80ea7f3a560a4a893ab8"
integrity sha512-sfZ8fDgDP3B1YB+teqSnAK1aPgBu8reUUGxSsndP2XnYN6cM29EURXWXZqQQiaRdor3B4QjpkUNfv21syaO4DA==
dependencies:
agent-base "^7.1.1"

http-proxy-agent@^5.0.0:
version "5.0.0"
resolved "https://registry.yarnpkg.com/http-proxy-agent/-/http-proxy-agent-5.0.0.tgz#5129800203520d434f142bc78ff3c170800f2b43"
Expand Down Expand Up @@ -2144,7 +2182,7 @@ mime-types@^2.1.12:
dependencies:
mime-db "1.52.0"

miniget@^4.2.2:
miniget@^4.2.2, miniget@^4.2.3:
version "4.2.3"
resolved "https://registry.yarnpkg.com/miniget/-/miniget-4.2.3.tgz#3707a24c7c11c25d359473291638ab28aab349bd"
integrity sha512-SjbDPDICJ1zT+ZvQwK0hUcRY4wxlhhNpHL9nJOB2MEAXRGagTljsO8MEDzQMTFf0Q8g4QNi8P9lEm/g7e+qgzA==
Expand Down Expand Up @@ -2694,11 +2732,16 @@ safe-regex-test@^1.0.0:
resolved "https://registry.yarnpkg.com/safer-buffer/-/safer-buffer-2.1.2.tgz#44fa161b0187b9549dd84bb91802f9bd8385cd6a"
integrity sha512-YZo3K82SD7Riyi0E1EQPojLz7kpepnSQI9IyPbHHg1XXXevb5dJI7tpyN2ADxGcQbHG7vcyRHk0cbwqcQriUtg==

sax@^1.1.3, sax@^1.2.4:
sax@^1.2.4:
version "1.2.4"
resolved "https://registry.yarnpkg.com/sax/-/sax-1.2.4.tgz#2816234e2378bddc4e5354fab5caa895df7100d9"
integrity sha512-NqVDv9TpANUjFm0N8uM5GxL36UgKi9/atZw+x7YFnQ8ckwFGKrl4xX4yWtrey3UJm5nP1kUbnYgLopqWNSRhWw==

sax@^1.4.1:
version "1.4.1"
resolved "https://registry.yarnpkg.com/sax/-/sax-1.4.1.tgz#44cc8988377f126304d3b3fc1010c733b929ef0f"
integrity sha512-+aWOz7yVScEGoKNd4PA10LZ8sk0A/z5+nXQG5giUO5rprX9jgYsTdov9qCchZiPIZezbZH+jRut8nPodFAX4Jg==

saxes@^6.0.0:
version "6.0.0"
resolved "https://registry.yarnpkg.com/saxes/-/saxes-6.0.0.tgz#fe5b4a4768df4f14a201b1ba6a65c1f3d9988cc5"
Expand Down Expand Up @@ -2997,6 +3040,16 @@ tough-cookie@^4.1.2:
universalify "^0.2.0"
url-parse "^1.5.3"

tough-cookie@^4.1.4:
version "4.1.4"
resolved "https://registry.yarnpkg.com/tough-cookie/-/tough-cookie-4.1.4.tgz#945f1461b45b5a8c76821c33ea49c3ac192c1b36"
integrity sha512-Loo5UUvLD9ScZ6jh8beX1T6sO1w2/MpCRpEP7V280GKMVUQ0Jzar2U3UJPsrdbziLEMMhu3Ujnq//rhiFuIeag==
dependencies:
psl "^1.1.33"
punycode "^2.1.1"
universalify "^0.2.0"
url-parse "^1.5.3"

tr46@^4.1.1:
version "4.1.1"
resolved "https://registry.yarnpkg.com/tr46/-/tr46-4.1.1.tgz#281a758dcc82aeb4fe38c7dfe4d11a395aac8469"
Expand Down Expand Up @@ -3193,6 +3246,18 @@ undici@^5.22.1:
dependencies:
busboy "^1.6.0"

undici@^6.18.2:
version "6.20.1"
resolved "https://registry.yarnpkg.com/undici/-/undici-6.20.1.tgz#fbb87b1e2b69d963ff2d5410a40ffb4c9e81b621"
integrity sha512-AjQF1QsmqfJys+LXfGTNum+qw4S88CojRInG/6t31W/1fk6G59s92bnAvGz5Cmur+kQv2SURXEvvudLmbrE8QA==

undici@five:
version "5.28.4"
resolved "https://registry.yarnpkg.com/undici/-/undici-5.28.4.tgz#6b280408edb6a1a604a9b20340f45b422e373068"
integrity sha512-72RFADWFqKmUb2hmmvNODKL3p9hcB6Gt2DOQMis1SEBaV6a4MH8soBvzg+95CYhCKPFedut2JY9bMfrDl9D23g==
dependencies:
"@fastify/busboy" "^2.0.0"

universalify@^0.1.0:
version "0.1.2"
resolved "https://registry.yarnpkg.com/universalify/-/universalify-0.1.2.tgz#b646f69be3942dabcecc9d6639c80dc105efaa66"
Expand Down Expand Up @@ -3403,24 +3468,9 @@ [email protected]:
resolved "https://registry.yarnpkg.com/yn/-/yn-3.1.1.tgz#1e87401a09d767c1d5eab26a6e4c185182d2eb50"
integrity sha512-Ux4ygGWsu2c7isFWe8Yu1YluJmqVhxqK2cLXNQA5AcC3QfbGNpM7fu0Y8b/z16pXLnFxZYvWhd3fhBY9DLmC6Q==

ytdl-core@^4.9.1:
version "4.11.5"
resolved "https://registry.yarnpkg.com/ytdl-core/-/ytdl-core-4.11.5.tgz#8cc3dc9e4884e24e8251250cfb56313a300811f0"
integrity sha512-27LwsW4n4nyNviRCO1hmr8Wr5J1wLLMawHCQvH8Fk0hiRqrxuIu028WzbJetiYH28K8XDbeinYW4/wcHQD1EXA==
dependencies:
m3u8stream "^0.8.6"
miniget "^4.2.2"
sax "^1.1.3"

ytpl@^2.2.3:
version "2.3.0"
resolved "https://registry.yarnpkg.com/ytpl/-/ytpl-2.3.0.tgz#74633b6e582e22ff03e409dfb65d200c1a4ca0d2"
integrity sha512-Cfw2rxq3PFK6qgWr2Z8gsRefVahEzbn9XEuiJldqdXHE6GhO7kTfEvbZKdfXing1SmgW635uJ/UL2g8r0fvu2Q==
dependencies:
miniget "^4.2.2"

ytsr@TimeForANinja/node-ytsr#207/head:
version "0.0.0-development"
resolved "https://codeload.github.com/TimeForANinja/node-ytsr/tar.gz/ef107f87f6c7d2addad01db7187bb763a0a7e6dd"
dependencies:
miniget "^4.2.2"

0 comments on commit 8a788d0

Please sign in to comment.