zeki
zeki
DIAdiscord.js - Imagine an app
Created by zeki on 12/19/2023 in #djs-questions
Play Audio Resource even when bot isn't in a voice channel
Hi guys, I've created a bot that gets a live feed from a radio station and then outputs the audio into a voice channel (by using a ReadableStream object as the input for createAudioResource()). Whenever there is nobody active in the voice channel, I make the bot leave the channel, and when someone rejoins, the bot also rejoins. Everything works fine except this: when the bot isn't actively in the voice channel, the playback pauses and then resumes at the same point when someone rejoins, rather than playing the latest chunks in the stream. Every second the bot isn't inside the voice channel, its playback basically delays an additional second from being actually live. Is there an easy way I can get around this? I'm not sure if the solution is JS-based or part of the discord.js library. I saw the noSubscriber: 'play' flag in createAudioPlayer() options but this only seems to ontinue playback when the bot is alone in a channel, not when the bot itself isn't in any channel.
7 replies