1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-09-20 04:31:56 +00:00

voiceStateUpdate

This commit is contained in:
MatteZ02 2020-03-04 22:27:14 +02:00
parent 4583917947
commit 6bf3ffdfc9
3 changed files with 5 additions and 8 deletions

View File

@ -1,17 +1,14 @@
module.exports = async function (client, reason, guild) {
const serverQueue = client.queue.get(guild.id);
serverQueue.playing = false;
if (reason === "Stream is not generating quickly enough.") {
console.log("Song ended");
} else if (reason === "seek") {
if (reason === "seek") {
return;
} else {
console.log(reason);
}
if (!serverQueue.songLooping) {
if (serverQueue.looping) {
serverQueue.songs.push(serverQueue.songs[0]);
}
serverQueue.votes = 0;
serverQueue.voters = [];
serverQueue.songs.shift();

View File

@ -16,12 +16,14 @@ module.exports = async function (video, msg, voiceChannel, client, playlist = fa
}
const construct = require("../config/queueConfig.js");
construct.textChannel = msg.channel;
construct.voiceChannel = voiceChannel;
construct.volume = client.global.db.guilds[msg.guild.id].defaultVolume;
construct.bass = client.global.db.guilds[msg.guild.id].bass;
construct.songs.push(song);
client.queue.set(msg.guild.id, construct);
try {

View File

@ -5,15 +5,13 @@ module.exports = async function (guild, song, client, seek, play) {
const serverQueue = client.queue.get(guild.id);
if (!song) {
console.log('No song')
serverQueue.voiceChannel.leave();
client.queue.delete(guild.id);
return;
}
const dispatcher = serverQueue.connection
.play(await ytdl(song.url, { filter: "audio", highWaterMark: 1 << 25, volume: false }), { seek: seek, bitrate: 1024, passes: 10, volume: 1, bassboost: serverQueue.bass })
.on("end", () => {
.on("finish", () => {
client.dispatcher.finish(client, serverQueue.endReason, guild);
});
dispatcher.on('start', () => {