Fix soundboard commands not getting players properly

This commit is contained in:
Essem 2022-06-28 00:40:54 -05:00
parent fbdf407e47
commit d98f989fde
No known key found for this signature in database
GPG key ID: 7D497397CC3A2A8C

View file

@ -36,7 +36,7 @@ export async function connect(client) {
manager.on("error", (node, error) => { manager.on("error", (node, error) => {
logger.error(`An error occurred on Lavalink node ${node}: ${error}`); logger.error(`An error occurred on Lavalink node ${node}: ${error}`);
}); });
manager.once("ready", (name) => { manager.once("ready", () => {
logger.log(`Successfully connected to ${manager.nodes.size} Lavalink node(s).`); logger.log(`Successfully connected to ${manager.nodes.size} Lavalink node(s).`);
connected = true; connected = true;
}); });
@ -66,7 +66,7 @@ export async function play(client, sound, options, music = false) {
const voiceChannel = options.channel.guild.channels.get(options.member.voiceState.channelID); const voiceChannel = options.channel.guild.channels.get(options.member.voiceState.channelID);
if (!voiceChannel.permissionsOf(client.user.id).has("voiceConnect")) return "I don't have permission to join this voice channel!"; if (!voiceChannel.permissionsOf(client.user.id).has("voiceConnect")) return "I don't have permission to join this voice channel!";
const player = players.get(options.channel.guild.id); const player = players.get(options.channel.guild.id);
if (!music && manager.players().has(options.channel.guild.id) && (player && player.type === "music")) return "I can't play a sound effect while playing music!"; if (!music && manager.players.has(options.channel.guild.id) && (player && player.type === "music")) return "I can't play a sound effect while playing music!";
let node = manager.getNode(); let node = manager.getNode();
if (!node) { if (!node) {
const status = await checkStatus(); const status = await checkStatus();