Adding handlers for discord presense
This commit is contained in:
@@ -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)
|
// Placeholder functions (replace with actual implementation)
|
||||||
export const checkIfConnectedToVC = async (guildId) => {
|
export const checkIfConnectedToVC = async (guildId) => {
|
||||||
console.log("Pdab process var:", pdabProcess);
|
console.log("Pdab process var:", pdabProcess);
|
||||||
|
|||||||
@@ -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';
|
import { openOP25, closeOP25 } from '../op25Handler/op25Handler.mjs';
|
||||||
|
|
||||||
let activeDiscordClient = undefined;
|
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
|
// Open a new client and join the requested channel with the requested ID
|
||||||
initDiscordBotClient(joinData.clientID, () => {
|
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
|
// Add the client object to the IO instance
|
||||||
console.log("Connecting to channel")
|
console.log("Connecting to channel")
|
||||||
|
|||||||
Reference in New Issue
Block a user