1
0
mirror of https://github.com/musix-org/musix-oss synced 2024-11-10 08:10:18 +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) { module.exports = async function (client, reason, guild) {
const serverQueue = client.queue.get(guild.id); const serverQueue = client.queue.get(guild.id);
serverQueue.playing = false; serverQueue.playing = false;
if (reason === "Stream is not generating quickly enough.") { if (reason === "seek") {
console.log("Song ended");
} else if (reason === "seek") {
return; return;
} else {
console.log(reason);
} }
if (!serverQueue.songLooping) { if (!serverQueue.songLooping) {
if (serverQueue.looping) { if (serverQueue.looping) {
serverQueue.songs.push(serverQueue.songs[0]); serverQueue.songs.push(serverQueue.songs[0]);
} }
serverQueue.votes = 0; serverQueue.votes = 0;
serverQueue.voters = []; serverQueue.voters = [];
serverQueue.songs.shift(); 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"); const construct = require("../config/queueConfig.js");
construct.textChannel = msg.channel; construct.textChannel = msg.channel;
construct.voiceChannel = voiceChannel; construct.voiceChannel = voiceChannel;
construct.volume = client.global.db.guilds[msg.guild.id].defaultVolume; construct.volume = client.global.db.guilds[msg.guild.id].defaultVolume;
construct.bass = client.global.db.guilds[msg.guild.id].bass; construct.bass = client.global.db.guilds[msg.guild.id].bass;
construct.songs.push(song); construct.songs.push(song);
client.queue.set(msg.guild.id, construct); client.queue.set(msg.guild.id, construct);
try { try {

View File

@ -5,15 +5,13 @@ module.exports = async function (guild, song, client, seek, play) {
const serverQueue = client.queue.get(guild.id); const serverQueue = client.queue.get(guild.id);
if (!song) { if (!song) {
console.log('No song')
serverQueue.voiceChannel.leave(); serverQueue.voiceChannel.leave();
client.queue.delete(guild.id); client.queue.delete(guild.id);
return; return;
} }
const dispatcher = serverQueue.connection 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 }) .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); client.dispatcher.finish(client, serverQueue.endReason, guild);
}); });
dispatcher.on('start', () => { dispatcher.on('start', () => {