Restore default discord opus library
This commit is contained in:
@@ -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
|
||||
|
||||
Binary file not shown.
Reference in New Issue
Block a user