#16 Updated join

-  After getting all available IDs, it now checks if there are IDs. If not telling the user
This commit is contained in:
Logan Cusano
2024-05-05 22:00:04 -04:00
parent 5671503594
commit fee40dd609

View File

@@ -58,12 +58,18 @@ export async function execute(nodeIo, interaction) {
const openSocket = await nodeIo.sockets.sockets.get(selectedNodeSocketId); const openSocket = await nodeIo.sockets.sockets.get(selectedNodeSocketId);
// Get the open ID for this connection\ // Get the open ID for this connection\
const discordToken = await getAvailableTokensInGuild(nodeIo, interaction.guild.id); const discordToken = await getAvailableTokensInGuild(nodeIo, interaction.guild.id);
// TODO - Implement a method to have preferred tokens (bot users) for specific systems console.log("Available discord tokens: ", discordToken);
console.log("Joining selected open socket:", selectedNodeSocketId, system.name, channelToJoin.id, openSocket.node.name, discordToken);
// Ask the node to join the selected channel and system if (discordToken.length >= 1) {
await requestNodeJoinSystem(openSocket, system.name, channelToJoin.id, discordToken[0].token); // TODO - Implement a method to have preferred tokens (bot users) for specific systems
console.log("Joining selected open socket:", selectedNodeSocketId, system.name, channelToJoin.id, openSocket.node.name, discordToken[0].token);
// Ask the node to join the selected channel and system
await requestNodeJoinSystem(openSocket, system.name, channelToJoin.id, discordToken[0].token);
}
else {
return await interaction.editReply({ content: `<@${interaction.member.id}>, there are no free bots. Free up or create a new bot ID (discord app) to listen to this system.`, ephemeral: true })
}
} }
// Get all open socket nodes // Get all open socket nodes