Update PDAB handler

- Move PDAB socket server startup to function
- Updated join server wrapper to start the server before opening the python app
This commit is contained in:
Logan Cusano
2024-05-05 23:39:05 -04:00
parent fee40dd609
commit 03c940e07c
2 changed files with 26 additions and 22 deletions

View File

@@ -1,4 +1,4 @@
import { connectToChannel, leaveVoiceChannel, checkIfConnectedToVC, initDiscordBotClient, requestDiscordUsername, requestDiscordID, requestDiscordClientClose, closePdabSocketServer, setDiscordClientPrsense } from './pdabHandler.mjs';
import { connectToChannel, leaveVoiceChannel, checkIfConnectedToVC, initDiscordBotClient, requestDiscordUsername, requestDiscordID, requestDiscordClientClose, closePdabSocketServer, setDiscordClientPrsense, startPdabSocketServer } from './pdabHandler.mjs';
import { openOP25, closeOP25 } from '../op25Handler/op25Handler.mjs';
let activeDiscordClient = undefined;
@@ -14,6 +14,7 @@ export const joinDiscordVC = async (joinData) => {
console.log("Checking if there is a client open");
if (!await checkIfClientIsOpen()) {
console.log("There is no open client, starting it now");
await startPdabSocketServer();
// Open an instance of OP25
console.log("Starting OP25")
openOP25(joinData.system);