Fixed a bug in server update command #10

- Didn't properly get the open sockets
This commit is contained in:
Logan Cusano
2024-03-03 21:31:14 -05:00
parent 36c0ec8b13
commit 7efd0cd4f3

View File

@@ -17,13 +17,16 @@ export const deferInitialReply = false; // If we the initial reply in discord sh
*/ */
export const execute = async (nodeIo, interaction) => { export const execute = async (nodeIo, interaction) => {
try { try {
const sockets = await nodeIo.allSockets(); const openSockets = [...await nodeIo.allSockets()]; // TODO - Filter the returned nodes to only nodes that have the radio capability
console.log("All open sockets: ",sockets); console.log("All open sockets: ", openSockets);
await sockets.map(openSocket => {
// Check each open socket to see if the node has the requested system
await Promise.all(openSockets.map(openSocket => {
openSocket = nodeIo.sockets.sockets.get(openSocket);
requestNodeUpdate(openSocket); requestNodeUpdate(openSocket);
}) }));
//await interaction.reply(`**Online Sockets: '${sockets}'**`); //await interaction.reply(`**Online Sockets: '${sockets}'**`);
await interaction.reply('**Pong.**'); await interaction.reply('All nodes have been requested to update');
//await interaction.channel.send('**Pong.**'); //await interaction.channel.send('**Pong.**');
} catch (err) { } catch (err) {
console.error(err); console.error(err);