diff --git a/Client/controllers/commandController.js b/Client/controllers/commandController.js index f826c28..e12dd50 100644 --- a/Client/controllers/commandController.js +++ b/Client/controllers/commandController.js @@ -3,14 +3,13 @@ const { DebugBuilder } = require("../utilities/debugBuilder.js"); const log = new DebugBuilder("client-bot", "commandController"); // Modules const { joinVoiceChannel, VoiceConnectionStatus, getVoiceConnection } = require("@discordjs/voice"); -//const { OpusEncoder } = require("@discordjs/opus"); +const { OpusEncoder } = require("@discordjs/opus"); // Utilities const {replyToInteraction} = require("../utilities/messageHandler.js"); const {createAudioInstance} = require("../controllers/audioController.js"); -const { encode } = require("../utilities/arm64-linux.node"); // Declare the encoder -//const encoder = new OpusEncoder(48000, 2); +const encoder = new OpusEncoder(48000, 2); /** * Join the specified voice channel @@ -45,10 +44,10 @@ exports.join = async function join({interaction= undefined, guildID= undefined, audioInstance.on('audio', (buffer) => { buffer = Buffer.from(buffer); log.DEBUG("Audio buffer: ", buffer); - const encoded = encode(buffer); - log.DEBUG("Encoded packet: ", encoded); + const encodedBuffer = encoder.encode(buffer); + log.DEBUG("Encoded packet: ", encodedBuffer); // TODO Add a function here to check the volume of either buffer and only play audio to discord when there is audio to be played - voiceConnection.playOpusPacket(encoded); + voiceConnection.playOpusPacket(encodedBuffer); }) // Exit the audio handler when the bot disconnects diff --git a/Client/utilities/arm64-linux.node b/Client/utilities/arm64-linux.node deleted file mode 100644 index f2c6ba4..0000000 Binary files a/Client/utilities/arm64-linux.node and /dev/null differ