Adding handlers for discord presense

This commit is contained in:
Logan Cusano
2024-05-05 18:24:59 -04:00
parent 9d0aa0191f
commit 0fd511cfaf
2 changed files with 14 additions and 2 deletions

View File

@@ -75,6 +75,15 @@ export const leaveVoiceChannel = async (guildId) => {
});
};
// Set the presense of the discord client
export const setDiscordClientPrsense = (system) => {
return new Promise((res) => {
io.timeout(25000).emit('set_system', { system: system }, (status) => {
res();
});
});
};
// Placeholder functions (replace with actual implementation)
export const checkIfConnectedToVC = async (guildId) => {
console.log("Pdab process var:", pdabProcess);

View File

@@ -1,4 +1,4 @@
import { connectToChannel, leaveVoiceChannel, checkIfConnectedToVC, initDiscordBotClient, requestDiscordUsername, requestDiscordID, requestDiscordClientClose, closePdabSocketServer } from './pdabHandler.mjs';
import { connectToChannel, leaveVoiceChannel, checkIfConnectedToVC, initDiscordBotClient, requestDiscordUsername, requestDiscordID, requestDiscordClientClose, closePdabSocketServer, setDiscordClientPrsense } from './pdabHandler.mjs';
import { openOP25, closeOP25 } from '../op25Handler/op25Handler.mjs';
let activeDiscordClient = undefined;
@@ -20,7 +20,10 @@ export const joinDiscordVC = async (joinData) => {
// Open a new client and join the requested channel with the requested ID
initDiscordBotClient(joinData.clientID, () => {
console.log("Started PDAB")
console.log("Started PDAB");
console.log("Setting the presense of the bot");
setDiscordClientPrsense(joinData.system);
// Add the client object to the IO instance
console.log("Connecting to channel")