From ca100242527b02d49e89c710717b2e9dbebaa5d1 Mon Sep 17 00:00:00 2001 From: JonnyBro Date: Wed, 22 Dec 2021 21:24:42 +0500 Subject: [PATCH] loop rewrite --- base/JaBa.js | 2 +- commands/Music/clip.js | 3 +-- commands/Music/loop.js | 22 ++++++---------------- languages/ru-RU/music/loop.json | 6 ++++-- 4 files changed, 12 insertions(+), 21 deletions(-) diff --git a/base/JaBa.js b/base/JaBa.js index 024941db..8f5f01ad 100644 --- a/base/JaBa.js +++ b/base/JaBa.js @@ -49,7 +49,7 @@ class JaBa extends Client { this.player = new Player(this, { ytdlDownloadOptions: { - // filter: "audio", + filter: "audio", requestOptions: { headers: { cookie: this.config.youtubeToken, diff --git a/commands/Music/clip.js b/commands/Music/clip.js index ac15e55f..07d8b5a0 100644 --- a/commands/Music/clip.js +++ b/commands/Music/clip.js @@ -30,8 +30,7 @@ class Clip extends Command { const connection = await voice.join(); await connection.voice.setSelfDeaf(true); - connection - .play(`./clips/${args[0]}.mp3`) + connection.play(`./clips/${args[0]}.mp3`) .on("finish", () => { voice.leave(); }) diff --git a/commands/Music/loop.js b/commands/Music/loop.js index 299f3046..717b53cb 100644 --- a/commands/Music/loop.js +++ b/commands/Music/loop.js @@ -25,25 +25,15 @@ class Loop extends Command { if (!queue) return message.error("music/play:NOT_PLAYING"); if (args[0].toLowerCase() === "queue") { - if (!queue.loopMode) { - if (queue.repeatMode) this.client.player.setRepeatMode(message, false); + if (queue.repeatMode) this.client.player.setRepeatMode(message, false); - this.client.player.setLoopMode(message, true); - message.success("music/loop:QUEUE", { loop: "включён" }); - } else { - this.client.player.setLoopMode(message, false); - message.success("music/loop:QUEUE", { loop: "отключён" }); - }; + this.client.player.setLoopMode(message, !queue.loopMode); + message.success(`music/loop:QUEUE_SUCCESS_${queue.loopMode ? "ENABLED" : "DISABLED"}`) } else if (args[0].toLowerCase() === "song") { - if (!queue.repeatMode) { - if (queue.loopMode) this.client.player.setLoopMode(message, false); + if (queue.loopMode) this.client.player.setLoopMode(message, false); - this.client.player.setRepeatMode(message, true); - message.success("music/loop:QUEUE", { loop: "включён" }); - } else { - this.client.player.setRepeatMode(message, false); - message.success("music/loop:QUEUE", { loop: "отключён" }); - }; + this.client.player.setRepeatMode(message, !queue.repeatMode); + message.success(`music/loop:SONG_SUCCESS_${queue.repeatMode ? "ENABLED" : "DISABLED"}`); }; } }; diff --git a/languages/ru-RU/music/loop.json b/languages/ru-RU/music/loop.json index f59db75c..e85eccd9 100644 --- a/languages/ru-RU/music/loop.json +++ b/languages/ru-RU/music/loop.json @@ -3,6 +3,8 @@ "USAGE": "{{prefix}}loop [queue/song]", "EXAMPLES": "{{prefix}}loop queue\n{{prefix}}loop song", "NO_ARG": "Выберите: `queue` или `song`!", - "QUEUE": "Повтор очереди **{{loop}}**!", - "SONG": "Повтор текущего трека **{{loop}}**!" + "QUEUE_SUCCESS_ENABLED": "{{success}} Повтор очереди включён!", + "QUEUE_SUCCESS_DISABLED": "{{success}} Повтор очереди отключён!", + "SONG_SUCCESS_ENABLED" : "{{success}} Повтор текущего трека включён!", + "SONG_SUCCESS_DISABLED" : "{{success}} Повтор текущего трека отключён!" } \ No newline at end of file