loop rewrite

This commit is contained in:
JonnyBro 2021-12-22 21:24:42 +05:00
parent 8f5c5aceee
commit ca10024252
4 changed files with 12 additions and 21 deletions

View file

@ -49,7 +49,7 @@ class JaBa extends Client {
this.player = new Player(this, { this.player = new Player(this, {
ytdlDownloadOptions: { ytdlDownloadOptions: {
// filter: "audio", filter: "audio",
requestOptions: { requestOptions: {
headers: { headers: {
cookie: this.config.youtubeToken, cookie: this.config.youtubeToken,

View file

@ -30,8 +30,7 @@ class Clip extends Command {
const connection = await voice.join(); const connection = await voice.join();
await connection.voice.setSelfDeaf(true); await connection.voice.setSelfDeaf(true);
connection connection.play(`./clips/${args[0]}.mp3`)
.play(`./clips/${args[0]}.mp3`)
.on("finish", () => { .on("finish", () => {
voice.leave(); voice.leave();
}) })

View file

@ -25,25 +25,15 @@ class Loop extends Command {
if (!queue) return message.error("music/play:NOT_PLAYING"); if (!queue) return message.error("music/play:NOT_PLAYING");
if (args[0].toLowerCase() === "queue") { 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); this.client.player.setLoopMode(message, !queue.loopMode);
message.success("music/loop:QUEUE", { loop: "включён" }); message.success(`music/loop:QUEUE_SUCCESS_${queue.loopMode ? "ENABLED" : "DISABLED"}`)
} else {
this.client.player.setLoopMode(message, false);
message.success("music/loop:QUEUE", { loop: "отключён" });
};
} else if (args[0].toLowerCase() === "song") { } 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); this.client.player.setRepeatMode(message, !queue.repeatMode);
message.success("music/loop:QUEUE", { loop: "включён" }); message.success(`music/loop:SONG_SUCCESS_${queue.repeatMode ? "ENABLED" : "DISABLED"}`);
} else {
this.client.player.setRepeatMode(message, false);
message.success("music/loop:QUEUE", { loop: "отключён" });
};
}; };
} }
}; };

View file

@ -3,6 +3,8 @@
"USAGE": "{{prefix}}loop [queue/song]", "USAGE": "{{prefix}}loop [queue/song]",
"EXAMPLES": "{{prefix}}loop queue\n{{prefix}}loop song", "EXAMPLES": "{{prefix}}loop queue\n{{prefix}}loop song",
"NO_ARG": "Выберите: `queue` или `song`!", "NO_ARG": "Выберите: `queue` или `song`!",
"QUEUE": "Повтор очереди **{{loop}}**!", "QUEUE_SUCCESS_ENABLED": "{{success}} Повтор очереди включён!",
"SONG": "Повтор текущего трека **{{loop}}**!" "QUEUE_SUCCESS_DISABLED": "{{success}} Повтор очереди отключён!",
"SONG_SUCCESS_ENABLED" : "{{success}} Повтор текущего трека включён!",
"SONG_SUCCESS_DISABLED" : "{{success}} Повтор текущего трека отключён!"
} }