1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-10 05:10:17 +00:00

Revert "Updated looping function"

This reverts commit 6ebbf0216d.
This commit is contained in:
MatteZ02 2019-10-12 11:14:12 +03:00
parent fc2d513694
commit 6ef55d2255
6 changed files with 155 additions and 1279 deletions

View File

@ -14,10 +14,12 @@ module.exports = {
} }
} }
if (!serverQueue.looping) { if (!serverQueue.looping) {
client.secondaryQueue = [...serverQueue.songs]
serverQueue.looping = true; serverQueue.looping = true;
message.channel.send(':repeat: Looping the queue now!'); message.channel.send(':repeat: Looping the queue now!');
} else { } else {
serverQueue.looping = false; serverQueue.looping = false;
client.secondaryQueue = [];
message.channel.send(':repeat: No longer looping the queue!'); message.channel.send(':repeat: No longer looping the queue!');
} }
} else { } else {

View File

@ -35,6 +35,9 @@ module.exports = async function (video, message, voiceChannel, client, playlist
} }
} else { } else {
serverQueue.songs.push(song); serverQueue.songs.push(song);
if (serverQueue.looping) {
client.secondaryQueue.push(song);
}
if (playlist) return undefined; if (playlist) return undefined;
return message.channel.send(`:white_check_mark: **${song.title}** has been added to the queue!`); return message.channel.send(`:white_check_mark: **${song.title}** has been added to the queue!`);
} }

View File

@ -17,10 +17,10 @@ module.exports = async function (guild, song, client, message, seek) {
} else { } else {
console.log(reason); console.log(reason);
} }
if (serverQueue.looping) {
serverQueue.songs.push(serverQueue.songs[0]);
}
serverQueue.songs.shift(); serverQueue.songs.shift();
if (serverQueue.looping && serverQueue.songs.length === 0) {
serverQueue.songs = [...client.secondaryQueue];
}
client.funcs.play(guild, serverQueue.songs[0], client, message); client.funcs.play(guild, serverQueue.songs[0], client, message);
}); });
dispatcher.setVolume(serverQueue.volume / 10); dispatcher.setVolume(serverQueue.volume / 10);

View File

@ -25,6 +25,7 @@ client.commands = new Discord.Collection();
client.events = new Discord.Collection(); client.events = new Discord.Collection();
client.cooldowns = new Discord.Collection(); client.cooldowns = new Discord.Collection();
client.queue = new Map(); client.queue = new Map();
client.secondaryQueue = [];
client.funcs = {}; client.funcs = {};
client.funcs.handleVideo = require('./funcs/handleVideo.js'); client.funcs.handleVideo = require('./funcs/handleVideo.js');
@ -33,7 +34,7 @@ client.funcs.msToTime = require('./funcs/msToTime.js');
client.funcs.dbget = require('./funcs/dbget.js'); client.funcs.dbget = require('./funcs/dbget.js');
client.config = { client.config = {
token: process.env.TESTTOKEN, token: process.env.TOKEN,
apikey: process.env.API_KEY, apikey: process.env.API_KEY,
prefix: '>', prefix: '>',
test: 'success', test: 'success',

1413
package-lock.json generated

File diff suppressed because it is too large Load Diff

View File

@ -15,12 +15,11 @@
"discord.js": "^11.5.1", "discord.js": "^11.5.1",
"dotenv": "^8.1.0", "dotenv": "^8.1.0",
"ffmpeg": "0.0.4", "ffmpeg": "0.0.4",
"ffmpeg-binaries": "^4.0.0", "firebase": "^6.6.0",
"firebase": "^6.6.2", "firebase-admin": "^8.5.0",
"firebase-admin": "^8.6.0",
"fs": "0.0.1-security", "fs": "0.0.1-security",
"he": "^1.2.0", "he": "^1.2.0",
"ms": "^2.1.2", "ms": "^2.1.1",
"node-opus": "^0.3.2", "node-opus": "^0.3.2",
"request": "^2.88.0", "request": "^2.88.0",
"simple-youtube-api": "^5.2.1", "simple-youtube-api": "^5.2.1",