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) => { 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 => {
requestNodeUpdate(openSocket); // Check each open socket to see if the node has the requested system
}) await Promise.all(openSockets.map(openSocket => {
//await interaction.reply(`**Online Sockets: '${sockets}'**`); openSocket = nodeIo.sockets.sockets.get(openSocket);
await interaction.reply('**Pong.**'); requestNodeUpdate(openSocket);
//await interaction.channel.send('**Pong.**'); }));
//await interaction.reply(`**Online Sockets: '${sockets}'**`);
await interaction.reply('All nodes have been requested to update');
//await interaction.channel.send('**Pong.**');
} catch (err) { } catch (err) {
console.error(err); console.error(err);
// await interaction.reply(err.toString()); // await interaction.reply(err.toString());