Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Bot is joining the voice call and talking (see the green border), however I am unable to hear anything... #10218

Closed
Z3NTL3 opened this issue Apr 15, 2024 · 1 comment

Comments

@Z3NTL3
Copy link

Z3NTL3 commented Apr 15, 2024

Which package is this bug report for?

discord.js

Issue description

image
Bot is joining the voice call and talking (see the green border), however I am unable to hear anything...
I think some encoding issue, but the documentation stated when I have all dependencies installed, mp3's should be fine/

Every required dependency for the voice pkg is installed:

[root]🌐 pix4 in ~/nunu-bot [📦 v1.0.0][ v20.12.2][⏱ 1m6s]
❯ ts-node index.ts 
--------------------------------------------------
Core Dependencies
- @discordjs/voice: 0.16.1
- prism-media: 1.3.5

Opus Libraries
- @discordjs/opus: 0.9.0
- opusscript: 0.0.8

Encryption Libraries
- sodium-native: 4.1.1
- sodium: 3.0.2
- libsodium-wrappers: 0.7.13
- tweetnacl: 1.0.3

FFmpeg
- version: 6.0-static https://johnvansickle.com/ffmpeg/ 
- libopus: yes
--------------------------------------------------
Started refreshing 1 application (/) commands.
Successfully reloaded 1 application (/) commands.
Bot running: 'test#4180'
Currently in 1 guild(s)
join

Code sample

var GUILD_ID = "1184190430435364964"
var PLAYER = createAudioPlayer()

PLAYER.on(AudioPlayerStatus.Idle, (oldState, newState) => {
    let conn = getVoiceConnection(GUILD_ID)
    if (typeof conn !== "undefined")
        conn.destroy()
})

client.on(Events.VoiceStateUpdate, (oldState, newState) => {
    if (newState.guild.id === GUILD_ID && !newState.member?.user.bot && !oldState.mute && !newState.mute) {
        let conn = getVoiceConnection(newState.guild.id)
        if (typeof conn !== "undefined")
            conn.destroy()

        conn = joinVoiceChannel({
            channelId: newState.channelId as string,
            guildId: newState.guild.id,
            adapterCreator: newState.guild.voiceAdapterCreator,
            selfDeaf: false,
            selfMute: false
        })

        conn.on(VoiceConnectionStatus.Disconnected, (oldState_, newState_) => {
            console.log("rejoin")
            if (!conn.rejoin())
                conn.destroy()
        })
        conn.receiver.speaking.once("start", (uid) => {
            var AUDIO_FEED = createAudioResource(
                path.join(__dirname, "feed", "eray.mp3")
            );

            conn.subscribe(PLAYER)
            PLAYER.play(AUDIO_FEED)
            entersState(PLAYER, AudioPlayerStatus.Playing, 1000 * 300)
            setTimeout(() => {
                // garbage collector
                AUDIO_FEED = null as any
                conn.disconnect()
            }, 1000 * 300)
        })


    }

})
})

Versions

❯ node -v
v20.12.2

❯ npm -v
10.5.0

[root]🌐 pix4 in ~/nunu-bot [📦 v1.0.0][ v20.12.2][⏱ 1m6s]
❯ ts-node index.ts 
--------------------------------------------------
Core Dependencies
- @discordjs/voice: 0.16.1
- prism-media: 1.3.5

Opus Libraries
- @discordjs/opus: 0.9.0
- opusscript: 0.0.8

Encryption Libraries
- sodium-native: 4.1.1
- sodium: 3.0.2
- libsodium-wrappers: 0.7.13
- tweetnacl: 1.0.3

FFmpeg
- version: 6.0-static https://johnvansickle.com/ffmpeg/ 
- libopus: yes
--------------------------------------------------
Started refreshing 1 application (/) commands.
Successfully reloaded 1 application (/) commands.
Bot running: 'test#4180'
Currently in 1 guild(s)
join

Issue priority

High (immediate attention needed)

Which partials do you have configured?

Channel

Which gateway intents are you subscribing to?

GuildVoiceStates

I have tested this issue on a development release

No response

@Jiralite Jiralite changed the title Discord.js voice bug Bot is joining the voice call and talking (see the green border), however I am unable to hear anything... Apr 15, 2024
@Z3NTL3
Copy link
Author

Z3NTL3 commented Apr 16, 2024

I just found out my default audio driver was not being used, so it was a problem that came from my. Discord audio was bound to my headset that was not even plugged in. I know so dumb, sorry.

@Z3NTL3 Z3NTL3 closed this as completed Apr 16, 2024
@Jiralite Jiralite closed this as not planned Won't fix, can't repro, duplicate, stale Apr 16, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants