dimsey
dimsey
Explore posts from servers
DIAdiscord.js - Imagine an app
Created by dimsey on 10/15/2023 in #djs-voice
Is it possible to have 2 bots in voice channels in discord js?
I registered two clients. I attempt to connect each to a voice channel, and after the first bot connects, the second will not connect. Additionally, getVoiceConnection returns a voice connection when the second bot attempts to connect
11 replies
DIAdiscord.js - Imagine an app
Created by dimsey on 9/30/2023 in #djs-voice
Issue w/ Opus -> Ogg recording voice with prism-media@v2.0.0-alpha.0 - ERR_REQUIRE_ESM
I was trying to follow this example recording voice demo (https://github.com/discordjs/voice-examples/blob/main/recorder/src/createListeningStream.ts#L19C1-L27C5), but I'm running into the following error:
👂 Listening to dimsey8_0
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/user/Desktop/unicorn/Voice/node_modules/node-crc/lib/lib.js from /Users/user/Desktop/unicorn/Voice/node_modules/prism-media/dist/ogg/OggLogicalBitstream.js not supported.
Instead change the require of lib.js in /Users/user/Desktop/unicorn/Voice/node_modules/prism-media/dist/ogg/OggLogicalBitstream.js to a dynamic import() which is available in all CommonJS modules.
}
👂 Listening to dimsey8_0
Error [ERR_REQUIRE_ESM]: require() of ES Module /Users/user/Desktop/unicorn/Voice/node_modules/node-crc/lib/lib.js from /Users/user/Desktop/unicorn/Voice/node_modules/prism-media/dist/ogg/OggLogicalBitstream.js not supported.
Instead change the require of lib.js in /Users/user/Desktop/unicorn/Voice/node_modules/prism-media/dist/ogg/OggLogicalBitstream.js to a dynamic import() which is available in all CommonJS modules.
}
I am using ESM instead of CommonJS (the example link uses CommonJS). As a result, despite prism being ESM compatible, an underlying part of it, e.g., node-crc seems to be using CJS. I'm not sure how to go about fixing this. Any ideas would be great. I was thinking of looking for another stream encoder for Opus -> Ogg but I haven't found any that work yet. Does anyone have advice for me? Thank you in advance. Code will be pasted as a comment.
10 replies