Discord Bot Railway to discord gateway

9 months 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

9 months ago

Is there any way to fix this


Have you tried deploying in a different region?


9 months ago

ill try now


9 months ago

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


9 months ago

Still failing


Are you using discord.py?


9 months ago

no i am using pycord


9 months 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.


9 months ago

i did that and still not working


9 months ago

Ill try to switch to discord.py


9 months ago

Nvm cant switch to discord.py


9 months ago

bec i need pycord lib for my bot


9 months ago

needs receiving audio


9 months ago

still having the issue


9 months ago

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


9 months ago

bec on hetzner Vps i have no issues


9 months ago

Only on railway


9 months ago

whats the issue/logs?


8 months ago

.


8 months ago

are you using a self-bot?


8 months ago

or an actual discord bot?


8 months ago

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


8 months ago

not railway


8 months ago

has it been working for you locally?



8 months ago

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


8 months ago

it worked locally


8 months 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)


8 months ago

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


8 months 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


8 months ago

Thanks will try out to change the logic and see


Welcome!

Sign in to your Railway account to join the conversation.

Loading...