Closed Titancube closed 5 years ago
If the latter code example didn't work I'm convinced you have a network connection issue somewhere since in that example you're not even trying to play audio, just connect to voice.
Could you update to the latest commit (https://github.com/discordjs/discord.js/commit/aab3523fb5b60d21d20cbf2be01c32bdf21aa8ae) and try the following to produce some more debug information:
client.on('debug', console.log);
You should see output something like this:
If you could try this again and send me the full output from this log -- this will contain sensitive information so I'd recommend messaging me on Discord at hydrabolt#0001. However, you should still be ok to post the details here on GitHub if you remove your IP address from the logs and partially redact any IDs.
Hi, I was out for few days and checked this just an hour ago. Thank you for the reply! I Updated to the latest commit on master and also had to change few lines.
//11.4.2
let vChan = msg.member.voiceChannel;
dispatcher.on('end', () => {
vChan.leave();
});
//12.0.0-dev
let vChan = msg.member.voice.channel;
dispatcher.on('finnish', () => {
vChan.leave();
});
//Add detroy
dispatcher.destroy();
Then I tested the bot, and got VOICE_CONNECTION_TIMEOUT error.
Optional packages installed
[VOICE (GUILD_ID:2)]: Sending voice state update (queue length is 0): {"guild_id":"GUILD_ID","channel_id":"CHANNEL_ID","self_mute":false,"self_deaf":false}
[VOICE] received voice state update: {"channel_id":"CHANNEL_ID","deaf":false,"guild_id":"GUILD_ID","mute":false,"self_deaf":false,"self_mute":false,"self_video":false,"session_id":"SESSION_ID","suppress":false,"user_id":"USER_ID","member":{"deaf":false,"joined_at":"2019-01-17T10:41:23.123491+00:00","mute":false,"nick":null,"roles":["ROLE_ID"],"user":{"avatar":"f7ba7df099315fbf0fc5035cd5039463","bot":true,"discriminator":"7283","id":"USER_ID","username":"H3RM4N"}}}
[VOICE] connection? true, GUILD_ID SESSION_ID CHANNEL_ID
[VOICE (GUILD_ID:2)]: Setting sessionID SESSION_ID (stored as "undefined")
[VOICE (GUILD_ID:2)]: Authenticated with sessionID SESSION_ID
[VOICE] received voice server: {"d":{"endpoint":"japan576.discord.gg:80","guild_id":"GUILD_ID","token":"TOKEN"},"op":0,"s":7,"t":"VOICE_SERVER_UPDATE"}
[VOICE] voiceServer guild: GUILD_ID token: TOKEN endpoint: japan576.discord.gg:80
[VOICE (GUILD_ID:2)]: Token "TOKEN" and endpoint "japan576.discord.gg:80"
[VOICE (GUILD_ID:2)]: Endpoint resolved as japan576.discord.gg
[VOICE (GUILD_ID:2)]: Authenticated with sessionID SESSION_ID
[VOICE (GUILD_ID:1)]: Connect triggered
[VOICE (GUILD_ID:1)]: [WS] connect requested
[VOICE (GUILD_ID:1)]: [WS] connecting, 1 attempts, undefined
[VOICE (GUILD_ID:1)]: [WS] opened at gateway japan576.discord.gg
[VOICE (GUILD_ID:1)]: [WS] >> {"op":0,"d":{"server_id":"GUILD_ID","user_id":"USER_ID","token":"TOKEN","session_id":"SESSION_ID"}}
[VOICE (GUILD_ID:1)]: [WS] << {"op":8,"d":{"v":4,"heartbeat_interval":13750}}
[VOICE (GUILD_ID:1)]: [WS] << {"op":2,"d":{"ssrc":7,"port":50104,"modes":["xsalsa20_poly1305_lite","xsalsa20_poly1305_suffix","xsalsa20_poly1305"],"ip":"III.PPP.VVV.444"}}
[VOICE (GUILD_ID:1)]: Selecting the xsalsa20_poly1305_lite mode
[VOICE (GUILD_ID:1)]: [UDP] created socket
[VOICE (GUILD_ID:1)]: [WS] >> {"op":3,"d":2301756717}
[VOICE (GUILD_ID:1)]: [WS] << {"op":6,"d":2301756717}
[VOICE (GUILD_ID:1)]: Authenticate failed - VOICE_CONNECTION_TIMEOUT
{ Error [VOICE_CONNECTION_TIMEOUT]: Connection not established within 15 seconds.
at VoiceConnection.authenticateFailed (/home/cabox/workspace/H3RM4N/node_modules/discord.js/src/client/voice/VoiceConnection.js:291:26)
at connectTimeout.client.setTimeout (/home/cabox/workspace/H3RM4N/node_modules/discord.js/src/client/voice/VoiceConnection.js:313:18)
at Timeout.setTimeout (/home/cabox/workspace/H3RM4N/node_modules/discord.js/src/client/BaseClient.js:83:7)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10) [Symbol(code)]: 'VOICE_CONNECTION_TIMEOUT' }
Thanks for the info @Titancube, could you try uninstalling uws and just using ws
to see if that helps? Thanks
I think there's something wrong with the UDP socket, can you try the above commit and see if that produces any more debug information?
Deleted uws
and updated discord.js
to latest commit.
This is the log where [WS]
appears.
[VOICE (GUILD_ID:1)]: Connect triggered
[VOICE (GUILD_ID:1)]: [WS] connect requested
[VOICE (GUILD_ID:1)]: [WS] connecting, 1 attempts, undefined
[VOICE (GUILD_ID:1)]: [WS] opened at gateway japan894.discord.media
[VOICE (GUILD_ID:1)]: [WS] >> {"op":0,"d":{"server_id":"GUILD_ID","user_id":"USER_ID","token":"TOKEN","session_id":"SESSION_ID"}}
[VOICE (GUILD_ID:1)]: [WS] << {"op":8,"d":{"v":4,"heartbeat_interval":13750}}
[VOICE (GUILD_ID:1)]: [WS] << {"op":2,"d":{"ssrc":7,"port":51694,"modes":["xsalsa20_poly1305_lite","xsalsa20_poly1305_suffix","xsalsa20_poly1305"],"ip":"III.PPP.VVV.444"}}
[VOICE (GUILD_ID:1)]: Selecting the xsalsa20_poly1305_lite mode
[VOICE (GUILD_ID:1)]: [UDP] created socket
[VOICE (GUILD_ID:1)]: Sending IP discovery packet: [0,0,0,7,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0,0]
[VOICE (GUILD_ID:1)]: Successfully sent IP discovery packet
[VOICE (GUILD_ID:1)]: [WS] >> {"op":3,"d":99740693725}
[VOICE (GUILD_ID:1)]: [WS] << {"op":6,"d":99740693725}
[VOICE (GUILD_ID:1)]: Authenticate failed - VOICE_CONNECTION_TIMEOUT
{ Error [VOICE_CONNECTION_TIMEOUT]: Connection not established within 15 seconds.
at VoiceConnection.authenticateFailed (/home/cabox/workspace/H3RM4N/node_modules/discord.js/src/client/voice/VoiceConnection.js:291:26)
at connectTimeout.client.setTimeout (/home/cabox/workspace/H3RM4N/node_modules/discord.js/src/client/voice/VoiceConnection.js:313:18)
at Timeout.setTimeout (/home/cabox/workspace/H3RM4N/node_modules/discord.js/src/client/BaseClient.js:83:7)
at ontimeout (timers.js:436:11)
at tryOnTimeout (timers.js:300:5)
at listOnTimeout (timers.js:263:5)
at Timer.processTimers (timers.js:223:10) [Symbol(code)]: 'VOICE_CONNECTION_TIMEOUT' }
[VOICE (GUILD_ID:4)]: [WS] >> {"op":3,"d":32248445883}
[VOICE (GUILD_ID:4)]: [WS] << {"op":6,"d":32248445883}
Ok, it looks like there's a network issue here as Discord.js is successfully sending the IP discovery packet, but a response is never received so the connection can't be fulfilled. Can you make sure that a firewall isn't blocking your bot?
Could you also try ping address
with the address you have redacted above as III.PPP.VVV.444
?
Thanks
Tried ping from both container and PC and no packet loss. And it Seems like ports from 50000 to 65535 are all open.
PING III.PPP.VVV.444 (III.PPP.VVV.444) 56(84) bytes of data.
64 bytes from III.PPP.VVV.444: icmp_seq=1 ttl=44 time=148 ms
64 bytes from III.PPP.VVV.444: icmp_seq=2 ttl=44 time=148 ms
64 bytes from III.PPP.VVV.444: icmp_seq=3 ttl=44 time=148 ms
64 bytes from III.PPP.VVV.444: icmp_seq=4 ttl=44 time=148 ms
64 bytes from III.PPP.VVV.444: icmp_seq=5 ttl=44 time=148 ms
64 bytes from III.PPP.VVV.444: icmp_seq=6 ttl=44 time=148 ms
64 bytes from III.PPP.VVV.444: icmp_seq=7 ttl=44 time=148 ms
64 bytes from III.PPP.VVV.444: icmp_seq=8 ttl=44 time=148 ms
64 bytes from III.PPP.VVV.444: icmp_seq=9 ttl=44 time=148 ms
64 bytes from III.PPP.VVV.444: icmp_seq=10 ttl=44 time=148 ms
....
--- II.PPP.VVV.444 ping statistics ---
30 packets transmitted, 30 received, 0% packet loss, time 29029ms
rtt min/avg/max/mdev = 148.152/148.500/153.743/1.042 ms
It's already 7 months passed since the last comment and I have to admit it's the network problem. So apparently It seems like Codeanywhere server can send normal things quite well but no voice packets. I don't know exactly why though.
Please describe the problem you are having in as much detail as possible: I made a simple bot that joins the voice channel I'm in, and play a shore mp3 file. The bot joins voicechannel perfectly, but none of these code works past ".then". I've seen #1499 already. It says this bug is fixed on master branch but can't find the problem.
Include a reproducible code sample here, if possible:
Error
Btw, I've tested with simpler code for debugging:
Still, "console.log('test'); " didn't run.
Further details:
IDE: codeanywhere.com
discord.js version: 11.4.2
Node.js version: 10.15.0
Operating system: Ubuntu 16.0.4 LTS
Priority this issue should have – please be realistic and elaborate if possible:
[x] I have also tested the issue on latest master, commit hash: