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, {
ytdlDownloadOptions: {
// filter: "audio",
filter: "audio",
requestOptions: {
headers: {
cookie: this.config.youtubeToken,

View file

@ -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();
})

View file

@ -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);
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);
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"}`);
};
}
};

View file

@ -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}} Повтор текущего трека отключён!"
}