From dc6a9d23e5073dbd3165041c36a65d752a7aa3b9 Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Tue, 13 Sep 2022 22:19:51 +0500 Subject: [PATCH] =?UTF-8?q?v4.1.4=20=D0=A4=D0=B8=D0=BA=D1=81=20=D0=BE?= =?UTF-8?q?=D1=88=D0=B8=D0=B1=D0=BE=D0=BA=20=D0=B2=20clips,=20loop,=20nowp?= =?UTF-8?q?laying=20=D0=B8=20play?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- commands/Music/clips.js | 7 ++++++- commands/Music/loop.js | 4 ++-- commands/Music/nowplaying.js | 3 ++- commands/Music/play.js | 6 +++--- package-lock.json | 18 +++++++++--------- package.json | 4 ++-- 6 files changed, 24 insertions(+), 18 deletions(-) diff --git a/commands/Music/clips.js b/commands/Music/clips.js index 1d57ab58..4e3abef5 100644 --- a/commands/Music/clips.js +++ b/commands/Music/clips.js @@ -36,7 +36,12 @@ class Clips extends BaseCommand { fs.readdir("./clips", async function (err, files) { await interaction.deferReply(); - if (err) return console.log("Unable to read directory: " + err); + if (err) { + interaction.editReply({ + content: "```js\n" + err + "```" + }); + return console.log("Unable to read directory: " + err); + } const clips = files.map(file => { const fileName = file.substring(0, file.length - 4); diff --git a/commands/Music/loop.js b/commands/Music/loop.js index c07d7281..7a14fbc5 100644 --- a/commands/Music/loop.js +++ b/commands/Music/loop.js @@ -35,9 +35,9 @@ class Loop extends BaseCommand { await interaction.deferReply(); const voice = interaction.member.voice.channel; - if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL"); + if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL", null, { edit: true }); const queue = client.player.getQueue(interaction.guildId); - if (!queue) return interaction.error("music/play:NOT_PLAYING"); + if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { edit: true }); const row = new ActionRowBuilder() .addComponents( diff --git a/commands/Music/nowplaying.js b/commands/Music/nowplaying.js index e9b6463e..ae6797f2 100644 --- a/commands/Music/nowplaying.js +++ b/commands/Music/nowplaying.js @@ -33,8 +33,9 @@ class Nowplaying extends BaseCommand { */ async execute(client, interaction) { await interaction.deferReply(); + const queue = client.player.getQueue(interaction.guildId); - if (!queue) return interaction.error("music/play:NOT_PLAYING"); + if (!queue) return interaction.error("music/play:NOT_PLAYING", null, { edit: true }); const progressBar = queue.createProgressBar(); const track = queue.current; diff --git a/commands/Music/play.js b/commands/Music/play.js index 2ea93072..ad04fa25 100644 --- a/commands/Music/play.js +++ b/commands/Music/play.js @@ -38,10 +38,10 @@ class Play extends BaseCommand { await interaction.deferReply(); const voice = interaction.member.voice.channel; - if (!voice) return interaction.editReply({ content: interaction.translate("music/play:NO_VOICE_CHANNEL") }); + if (!voice) return interaction.error("music/play:NO_VOICE_CHANNEL", null, { edit: true }); const query = interaction.options.getString("query"); const perms = voice.permissionsFor(client.user); - if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return interaction.editReply({ content: interaction.translate("music/play:VOICE_CHANNEL_CONNECT") }); + if (!perms.has(PermissionsBitField.Flags.Connect) || !perms.has(PermissionsBitField.Flags.Speak)) return interaction.error("music/play:VOICE_CHANNEL_CONNECT", null, { edit: true }); try { var searchResult = await client.player.search(query, { @@ -50,7 +50,7 @@ class Play extends BaseCommand { }); if (!searchResult.tracks[0] || !searchResult) - return interaction.editReply({ content: interaction.translate("music/play:NO_RESULT", { query, error: "Скорее всего видео заблокировано по региону" }) }); + return interaction.error("music/play:NO_RESULT", { query, error: "Скорее всего видео заблокировано по региону" }, { edit: true }); } catch (error) { console.log(error); return interaction.editReply({ diff --git a/package-lock.json b/package-lock.json index b4b9d8a9..08278862 100644 --- a/package-lock.json +++ b/package-lock.json @@ -1,12 +1,12 @@ { "name": "jaba", - "version": "4.1.3", + "version": "4.1.4", "lockfileVersion": 2, "requires": true, "packages": { "": { "name": "jaba", - "version": "4.1.3", + "version": "4.1.4", "license": "ISC", "dependencies": { "@discord-player/extractor": "^3.0.2", @@ -20,7 +20,7 @@ "cron": "^2.1.0", "discord-api-types": "^0.37.5", "discord-giveaways": "^6.0.1", - "discord-player-play-dl": "^5.3.5", + "discord-player-play-dl": "^5.3.6", "discord.js": "^14.3.0", "ejs": "^3.1.3", "express": "^4.17.1", @@ -1480,9 +1480,9 @@ } }, "node_modules/discord-player-play-dl": { - "version": "5.3.5", - "resolved": "https://registry.npmjs.org/discord-player-play-dl/-/discord-player-play-dl-5.3.5.tgz", - "integrity": "sha512-A11TzAl7fEl9TQilgT4v6i3bxKh+zZUmnYOncun1+jNoQu9H8O7BpSXGafuGlNcAEGNyK2ZG1AZf64e8i09Q5g==", + "version": "5.3.6", + "resolved": "https://registry.npmjs.org/discord-player-play-dl/-/discord-player-play-dl-5.3.6.tgz", + "integrity": "sha512-xHcGl5RvyEP85FqN3EBJT4Ws/D1oA3yhCrbxNhhNI8BTX6eNS7Y0EY1pSTP9GLae/ql6nq106CWr18krj+r0ZA==", "dependencies": { "@discordjs/voice": "^0.11.0", "libsodium-wrappers": "^0.7.10", @@ -5837,9 +5837,9 @@ } }, "discord-player-play-dl": { - "version": "5.3.5", - "resolved": "https://registry.npmjs.org/discord-player-play-dl/-/discord-player-play-dl-5.3.5.tgz", - "integrity": "sha512-A11TzAl7fEl9TQilgT4v6i3bxKh+zZUmnYOncun1+jNoQu9H8O7BpSXGafuGlNcAEGNyK2ZG1AZf64e8i09Q5g==", + "version": "5.3.6", + "resolved": "https://registry.npmjs.org/discord-player-play-dl/-/discord-player-play-dl-5.3.6.tgz", + "integrity": "sha512-xHcGl5RvyEP85FqN3EBJT4Ws/D1oA3yhCrbxNhhNI8BTX6eNS7Y0EY1pSTP9GLae/ql6nq106CWr18krj+r0ZA==", "requires": { "@discordjs/voice": "^0.11.0", "libsodium-wrappers": "^0.7.10", diff --git a/package.json b/package.json index fc5ecb5b..3e29f277 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "jaba", - "version": "4.1.3", + "version": "4.1.4", "description": "My Discord Bot", "main": "index.js", "private": true, @@ -23,7 +23,7 @@ "cron": "^2.1.0", "discord-api-types": "^0.37.5", "discord-giveaways": "^6.0.1", - "discord-player-play-dl": "^5.3.5", + "discord-player-play-dl": "^5.3.6", "discord.js": "^14.3.0", "ejs": "^3.1.3", "express": "^4.17.1",