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,14 +17,17 @@ export const deferInitialReply = false; // If we the initial reply in discord sh
*/
export const execute = async (nodeIo, interaction) => {
try {
const sockets = await nodeIo.allSockets();
console.log("All open sockets: ",sockets);
await sockets.map(openSocket => {
requestNodeUpdate(openSocket);
})
//await interaction.reply(`**Online Sockets: '${sockets}'**`);
await interaction.reply('**Pong.**');
//await interaction.channel.send('**Pong.**');
const openSockets = [...await nodeIo.allSockets()]; // TODO - Filter the returned nodes to only nodes that have the radio capability
console.log("All open sockets: ", openSockets);
// 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);
}));
//await interaction.reply(`**Online Sockets: '${sockets}'**`);
await interaction.reply('All nodes have been requested to update');
//await interaction.channel.send('**Pong.**');
} catch (err) {
console.error(err);
// await interaction.reply(err.toString());