From 42bb347bbf3a027a50f4204ef47d50a1dd3a176e Mon Sep 17 00:00:00 2001 From: Emily J Date: Mon, 1 Mar 2021 11:56:33 +1100 Subject: [PATCH] update dependencies --- package.json | 14 ++++++-------- src/modules/music.js | 10 +++++----- 2 files changed, 11 insertions(+), 13 deletions(-) diff --git a/package.json b/package.json index 23c9cbf..d8c80bb 100644 --- a/package.json +++ b/package.json @@ -4,26 +4,24 @@ "description": "Woomy is a all-purpose discord bot built off the guidebot base and coded in node.js using discord.js.", "main": "index.js", "dependencies": { - "@discordjs/opus": "^0.3.2", - "better-sqlite3": "^7.1.1", + "@discordjs/opus": "^0.4.0", + "better-sqlite3": "^7.1.2", "chalk": "^4.0.0", "dblapi.js": "^2.4.1", - "discord.js": "^12.4.0", - "enmap": "^5.8.0", + "discord.js": "^12.5.1", + "enmap": "^5.8.4", + "ffmpeg-static": "^4.2.7", "hastebin-gen": "^2.0.5", "moment": "^2.29.1", "moment-duration-format": "^2.3.2", "nekos.life": "^2.0.5", "node-fetch": "^2.6.1", - "prism-media": "^1.2.1", "randomcolor": "^0.6.2", "relevant-urban": "^2.0.0", - "request": "^2.88.2", "to-zalgo": "^1.0.1", "urban": "^0.3.2", "weather-js": "^2.0.0", - "ytdl-core": "^3.4.2", - "ytdl-core-discord": "^1.2.3" + "ytdl-core": "^4.4.5" }, "devDependencies": {}, "scripts": { diff --git a/src/modules/music.js b/src/modules/music.js index ad3a0fc..7100568 100644 --- a/src/modules/music.js +++ b/src/modules/music.js @@ -1,6 +1,6 @@ // Copyright 2020 Emily J. / mudkipscience and contributors. Subject to the AGPLv3 license. -const ytdl = require('ytdl-core-discord') +const ytdl = require('ytdl-core') const fetch = require('node-fetch') const { MessageEmbed } = require('discord.js') const { utc } = require('moment') @@ -54,6 +54,8 @@ exports.getVideoByQuery = async function (client, query, message) { return message.channel.send('<:error:466995152976871434> An error has occured: ' + e) }) + console.log(parsed) + if (parsed) { const videos = parsed if (videos) { @@ -194,15 +196,13 @@ exports.play = async function (client, message, query, playNext, ignoreQueue) { const v = guild.queue[0] try { - let link = exports.getLinkFromID(v.video.videoId); - let y = null; /*setTimeout(() => { if(y == null) { console.log('[MUSIC DEBUG] y is still null'); }; }, 5000);*/ - y = await ytdl(link, { highWaterMark: 1024 * 1024 * 32 }); + y = await ytdl(exports.getLinkFromID(v.video.videoId) || v.video.videoId, { highWaterMark: 1024 * 1024 * 32 }); guild.dispatcher = connection.play(y, { type: 'opus' }); } catch (err) { @@ -212,7 +212,7 @@ exports.play = async function (client, message, query, playNext, ignoreQueue) { guild.queue.pop() } - client.logger.error('(YT API change, disregard) ' + err) + client.logger.error(err.stack) return message.channel.send(`<:error:466995152976871434> An error has occured: \n\`${err}\``) // return message.channel.send('<:error:466995152976871434> YouTube have made changes to their site that break Woomy\'s music module. An announcement will be made in the development server when this issue is resolved.') }