mirror of
https://github.com/musix-org/musix-oss
synced 2025-06-16 18:56:00 +00:00
fixed queue conflict
This commit is contained in:
@ -1,40 +1,48 @@
|
||||
module.exports = async function (video, msg, voiceChannel, client, playlist = false) {
|
||||
const Discord = require('discord.js');
|
||||
const song = {
|
||||
title: Discord.Util.escapeMarkdown(video.title),
|
||||
url: video.url,
|
||||
author: msg.author
|
||||
}
|
||||
module.exports = async function (
|
||||
video,
|
||||
msg,
|
||||
voiceChannel,
|
||||
client,
|
||||
playlist = false
|
||||
) {
|
||||
const Discord = require("discord.js");
|
||||
const song = {
|
||||
title: Discord.Util.escapeMarkdown(video.title),
|
||||
url: video.url,
|
||||
author: msg.author,
|
||||
};
|
||||
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
const queue = client.queue.get(msg.guild.id);
|
||||
|
||||
if (queue) {
|
||||
queue.songs.push(song);
|
||||
if (playlist) return;
|
||||
let message;
|
||||
message = client.messages.songAdded.replace("%TITLE%", song.title);
|
||||
return msg.channel.send(message);
|
||||
}
|
||||
if (queue) {
|
||||
queue.songs.push(song);
|
||||
if (playlist) return;
|
||||
let message;
|
||||
message = client.messages.songAdded.replace("%TITLE%", song.title);
|
||||
return msg.channel.send(message);
|
||||
}
|
||||
|
||||
const construct = require("../config/queueConfig.ts");
|
||||
const construct = { ...require("../config/queueConfig.ts") };
|
||||
|
||||
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.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);
|
||||
construct.songs.push(song);
|
||||
|
||||
client.queue.set(msg.guild.id, construct);
|
||||
client.queue.set(msg.guild.id, construct);
|
||||
|
||||
try {
|
||||
const connection = await voiceChannel.join();
|
||||
construct.connection = connection;
|
||||
client.funcs.play(msg.guild, construct.songs[0], client, 0, true);
|
||||
} catch (error) {
|
||||
client.queue.delete(msg.guild.id);
|
||||
client.users.cache.get(client.config.devId).send(client.messages.errorConnecting + error);
|
||||
return msg.channel.send(client.messages.error);
|
||||
}
|
||||
return;
|
||||
}
|
||||
try {
|
||||
const connection = await voiceChannel.join();
|
||||
construct.connection = connection;
|
||||
client.funcs.play(msg.guild, construct.songs[0], client, 0, true);
|
||||
} catch (error) {
|
||||
client.queue.delete(msg.guild.id);
|
||||
client.users.cache
|
||||
.get(client.config.devId)
|
||||
.send(client.messages.errorConnecting + error);
|
||||
return msg.channel.send(client.messages.error);
|
||||
}
|
||||
return;
|
||||
};
|
||||
|
@ -37,7 +37,7 @@ module.exports = async function (guild, song, client, seek, play) {
|
||||
|
||||
const dispatcher = queue.connection
|
||||
.play(
|
||||
await ytdl(song.url, streamConfig.ytdlOptions).pipe(transcoder),
|
||||
ytdl(song.url, streamConfig.ytdlOptions).pipe(transcoder),
|
||||
streamConfig.options
|
||||
)
|
||||
.on("finish", () => {
|
||||
|
Reference in New Issue
Block a user