mirror of
https://github.com/JonnyBro/JaBa.git
synced 2024-11-21 20:54:58 +05:00
Новая команда loop
This commit is contained in:
parent
155df66ddf
commit
702d1617e0
6 changed files with 61 additions and 7 deletions
|
@ -19,7 +19,6 @@ class Back extends Command {
|
|||
|
||||
async run (message, args, data) {
|
||||
const queue = this.client.player.getQueue(message);
|
||||
|
||||
const voice = message.member.voice.channel;
|
||||
|
||||
if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
|
||||
|
@ -39,7 +38,7 @@ class Back extends Command {
|
|||
if (members.size > 1) {
|
||||
m.react("👍");
|
||||
|
||||
const mustVote = Math.floor(members.size/2+1);
|
||||
const mustVote = Math.floor(members.size / 2);
|
||||
|
||||
embed.setDescription(message.translate("music/back:VOTE_CONTENT", { songName: queue.tracks[0].name, voteCount: 0, requiredCount: mustVote }));
|
||||
m.edit(embed);
|
||||
|
|
|
@ -20,8 +20,8 @@ class Filters extends Command {
|
|||
|
||||
async run (message, args, data) {
|
||||
const queue = this.client.player.getQueue(message);
|
||||
|
||||
const voice = message.member.voice.channel;
|
||||
|
||||
if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
|
||||
if (!queue) return message.error("music/play:NOT_PLAYING");
|
||||
|
||||
|
|
47
commands/Music/loop.js
Normal file
47
commands/Music/loop.js
Normal file
|
@ -0,0 +1,47 @@
|
|||
const Command = require("../../base/Command.js");
|
||||
|
||||
class Loop extends Command {
|
||||
constructor (client) {
|
||||
super(client, {
|
||||
name: "loop",
|
||||
dirname: __dirname,
|
||||
enabled: true,
|
||||
guildOnly: true,
|
||||
aliases: [],
|
||||
memberPermissions: [],
|
||||
botPermissions: [ "SEND_MESSAGES" ],
|
||||
nsfw: false,
|
||||
ownerOnly: false,
|
||||
cooldown: 1000
|
||||
});
|
||||
}
|
||||
|
||||
async run (message, args) {
|
||||
const voice = message.member.voice.channel;
|
||||
const queue = this.client.player.getQueue(message);
|
||||
|
||||
if (!args[0]) return message.error("music/loop:NO_ARG");
|
||||
if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
|
||||
if (!queue) return message.error("music/play:NOT_PLAYING");
|
||||
|
||||
if (args[0].toLowerCase() === "queue") {
|
||||
if (!queue.loopMode) {
|
||||
client.player.setLoopMode(message, true);
|
||||
message.success("music:/loop:QUEUE", { loop: "включён" });
|
||||
} else {
|
||||
client.player.setLoopMode(message, false);
|
||||
message.success("music:/loop:QUEUE", { loop: "отключён" });
|
||||
};
|
||||
} else if (args[0].toLowerCase() === "song") {
|
||||
if (!queue.repeatMode) {
|
||||
client.player.setRepeatMode(message, true);
|
||||
message.success("music:/loop:QUEUE", { loop: "включён" });
|
||||
} else if (args[1].toLowerCase() == "off") {
|
||||
client.player.setRepeatMode(message, false);
|
||||
message.success("music:/loop:QUEUE", { loop: "отключён" });
|
||||
};
|
||||
};
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = Loop;
|
|
@ -19,8 +19,8 @@ class Skip extends Command {
|
|||
|
||||
async run (message, args, data) {
|
||||
const queue = this.client.player.getQueue(message);
|
||||
|
||||
const voice = message.member.voice.channel;
|
||||
|
||||
if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
|
||||
if (!queue) return message.error("music/play:NOT_PLAYING");
|
||||
if (!queue.tracks[0]) return message.error("music/skip:NO_NEXT_SONG");
|
||||
|
@ -38,7 +38,7 @@ class Skip extends Command {
|
|||
if (members.size > 1) {
|
||||
m.react("👍");
|
||||
|
||||
const mustVote = Math.floor(members.size/2+1);
|
||||
const mustVote = Math.floor(members.size / 2);
|
||||
|
||||
embed.setDescription(message.translate("music/skip:VOTE_CONTENT", { songName: queue.tracks[0].name, voteCount: 0, requiredCount: mustVote }));
|
||||
m.edit(embed);
|
||||
|
|
|
@ -19,8 +19,8 @@ class Stop extends Command {
|
|||
|
||||
async run (message, args, data) {
|
||||
const queue = await this.client.player.getQueue(message);
|
||||
|
||||
const voice = message.member.voice.channel;
|
||||
|
||||
if (!voice) return message.error("music/play:NO_VOICE_CHANNEL");
|
||||
if (!queue) return message.error("music/play:NOT_PLAYING");
|
||||
|
||||
|
@ -36,7 +36,7 @@ class Stop extends Command {
|
|||
if (members.size > 1) {
|
||||
m.react("👍");
|
||||
|
||||
const mustVote = Math.floor(members.size/2+1);
|
||||
const mustVote = Math.floor(members.size / 2);
|
||||
|
||||
embed.setDescription(message.translate("music/stop:VOTE_CONTENT", { voteCount: 0, requiredCount: mustVote }));
|
||||
m.edit(embed);
|
||||
|
|
8
languages/ru-RU/music/loop.json
Normal file
8
languages/ru-RU/music/loop.json
Normal file
|
@ -0,0 +1,8 @@
|
|||
{
|
||||
"DESCRIPTION": "Включить или отключить повтор очереди/одного трека!",
|
||||
"USAGE": "{{prefix}}loop [queue/song]",
|
||||
"EXAMPLES": "{{prefix}}loop queue\n{{prefix}}loop song",
|
||||
"NO_ARG": "Выберите: `queue` или `song`!",
|
||||
"QUEUE": "Повтор очереди **{{loop}}**!",
|
||||
"SONG": "Повтор очереди **{{loop}}**!"
|
||||
}
|
Loading…
Reference in a new issue