Potential final fix for #30

This commit is contained in:
Logan Cusano
2023-06-23 17:48:28 -04:00
parent 47d18c494d
commit 7163df21e9
4 changed files with 48 additions and 34 deletions

View File

@@ -25,7 +25,7 @@ async function joinServerWrapper(presetName, channelId, connections) {
});
// Check which nodes have the selected preset
onlineNodes = onlineNodes.filter(node => node.nearbySystems.includes(presetName));
onlineNodes = onlineNodes.filter(node => node.presets.includes(presetName));
log.DEBUG("Filtered Online Nodes: ", onlineNodes);
// Check if any nodes with this preset are available
@@ -113,10 +113,7 @@ module.exports = {
var presetsAvailable = [];
for (const nodeObject of nodeObjects) {
log.DEBUG("Node object: ", nodeObject);
for (const presetName in nodeObject.nearbySystems) {
if (!isNaN(presetName)) presetsAvailable.push(nodeObject.nearbySystems[presetName]);
else presetsAvailable.push(presetName)
}
presetsAvailable.push.apply(presetsAvailable, nodeObject.presets);
}
log.DEBUG("All Presets available: ", presetsAvailable);
@@ -133,7 +130,7 @@ module.exports = {
try{
const guildId = interaction.guild.id;
const presetName = interaction.options.getString('preset');
if (!interaction.member.voice.channel.id) return interaction.editReply(`You need to be in a voice channel, ${interaction.user}`)
if (!interaction.member.voice.channel) return interaction.editReply(`You need to be in a voice channel, ${interaction.user}`)
const channelId = interaction.member.voice.channel.id;
log.DEBUG(`Join requested by: ${interaction.user.username}, to: '${presetName}', in channel: ${channelId} / ${guildId}`);