Skip to content
Discord Bot Railway to discord gateway

a year ago

I have issue with my discord bot it cant connect to VC and based on my analysis the problem is Railway due to network latency is there any help

3e6de7ce-253c-4831-9377-8873bbc36db5

Closed$20 Bounty

33 Replies

a year ago

Is there any way to fix this


Have you tried deploying in a different region?


a year ago

ill try now


a year ago

Discord voice handshakes from Railway are still failing with ConnectionClosed … code 4006


a year ago

Still failing


Are you using discord.py?


a year ago

no i am using pycord


a year ago

do i need to use discord.py for railway?


No, was just curious.

https://github.com/Rapptz/discord.py/issues/10207

Other users faced similar issues as you reported.

Have you tried switching the region of the vc?


You can change voice chat region in channel settings > region override.


a year ago

i did that and still not working


a year ago

Ill try to switch to discord.py


a year ago

Nvm cant switch to discord.py


a year ago

bec i need pycord lib for my bot


a year ago

needs receiving audio


a year ago

still having the issue


a year ago

any help on this from railway is it a discord issue?


a year ago

bec on hetzner Vps i have no issues


a year ago

Only on railway


a year ago

whats the issue/logs?


a year ago

.


a year ago

are you using a self-bot?


a year ago

or an actual discord bot?


a year ago

whats the traceback? cause 4006 is discord invalidating the voice connection


a year ago

not railway


a year ago

has it been working for you locally?



a year ago

Some tries it connected but 90% of time does not connect


a year ago

it worked locally


a year ago

your bot doesn’t have a process_commands method, which means the bot was created as a regular discord client instead of a commands bot. Every time a message arrives and your code runs bot.process_commands(message), Discord raises an AttributeError. If you aren’t using slash commands or commands at all, you shouldn’t call it on the client event (the process commands)

your logic for the voice connection is unstable, you don’t seem to check whether or not you are connected by voice_client.is_connected() before doing anything with the audio, you’re proceeding anyway despite the connection failing

is_connected() returned False, but connect() succeeded. This is common on Railway due to network latency. Proceeding anyway... (is what appears from your logs)


a year ago

overall from what I can tell, your logic is incorrect or flaky that it sometimes works and sometimes doesn’t


a year ago

if you have a public git repo I can help you fix it, but if it’s private then I can only guide you on it


a year ago

Thanks will try out to change the logic and see


Welcome!

Sign in to your Railway account to join the conversation.

Loading...